From c97f33e1fa6d4b927a79d6a4695ed5ac342a6883 Mon Sep 17 00:00:00 2001 From: DreamConnected <1487442471@qq.com> Date: Sat, 24 Jan 2026 10:09:45 +0800 Subject: [PATCH 1/2] src/confile: fix values of lxc.cap.keep and lxc.cap.drop Signed-off-by: DreamConnected <1487442471@qq.com> --- src/lxc/confile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 7163cd1b22..b313114ae5 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -4309,6 +4309,9 @@ static int get_config_cap_drop(const char *key, char *retv, int inlen, int len, fulllen = 0; struct cap_entry *cap; + if (c->caps.keep) + return fulllen; + if (!retv) inlen = 0; else @@ -4327,6 +4330,9 @@ static int get_config_cap_keep(const char *key, char *retv, int inlen, int len, fulllen = 0; struct cap_entry *cap; + if (!c->caps.keep) + return fulllen; + if (!retv) inlen = 0; else From 5b64b50160980ae304e57184e4f1cbd15ef8c2da Mon Sep 17 00:00:00 2001 From: Herman Semenoff Date: Thu, 29 Jan 2026 11:01:41 +0300 Subject: [PATCH 2/2] lxc: added support OpenRC init system https://github.com/OpenRC/openrc Signed-off-by: Herman Semenoff --- config/init/openrc/lxc-containers.in | 19 +++++++++++++++++++ config/init/openrc/lxc-net.in | 18 ++++++++++++++++++ config/init/openrc/meson.build | 17 +++++++++++++++++ meson.build | 11 +++++++++-- meson_options.txt | 2 +- 5 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 config/init/openrc/lxc-containers.in create mode 100644 config/init/openrc/lxc-net.in create mode 100644 config/init/openrc/meson.build diff --git a/config/init/openrc/lxc-containers.in b/config/init/openrc/lxc-containers.in new file mode 100644 index 0000000000..7be3899344 --- /dev/null +++ b/config/init/openrc/lxc-containers.in @@ -0,0 +1,19 @@ +#!/sbin/openrc-run + +depend() { + need net + use logger + after cgroupfs-mount +} + +start() { + ebegin "Starting LXC autoboot containers" + @LIBEXECDIR@/lxc/lxc-containers start + eend $? +} + +stop() { + ebegin "Stopping LXC containers" + @LIBEXECDIR@/lxc/lxc-containers stop + eend $? +} diff --git a/config/init/openrc/lxc-net.in b/config/init/openrc/lxc-net.in new file mode 100644 index 0000000000..016739f655 --- /dev/null +++ b/config/init/openrc/lxc-net.in @@ -0,0 +1,18 @@ +#!/sbin/openrc-run + +depend() { + need net + use logger +} + +start() { + ebegin "Starting LXC network bridge" + @LIBEXECDIR@/lxc/lxc-net start + eend $? +} + +stop() { + ebegin "Stopping LXC network bridge" + @LIBEXECDIR@/lxc/lxc-net stop + eend $? +} diff --git a/config/init/openrc/meson.build b/config/init/openrc/meson.build new file mode 100644 index 0000000000..3bad5f6e47 --- /dev/null +++ b/config/init/openrc/meson.build @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: LGPL-2.1+ + +if 'openrc' in init_script + configure_file( + configuration: conf, + input: 'lxc-containers.in', + output: 'lxc-containers', + install: true, + install_dir: join_paths(sysconfdir, 'init.d')) + + configure_file( + configuration: conf, + input: 'lxc-net.in', + output: 'lxc-net', + install: true, + install_dir: join_paths(sysconfdir, 'init.d')) +endif diff --git a/meson.build b/meson.build index b8185c2cb2..eef4e6900c 100644 --- a/meson.build +++ b/meson.build @@ -924,8 +924,15 @@ subdir('config/bash') subdir('config/etc') if want_install_init subdir('config/init/common') - subdir('config/init/systemd') - subdir('config/init/sysvinit') + if 'systemd' in init_script + subdir('config/init/systemd') + endif + if 'sysvinit' in init_script + subdir('config/init/sysvinit') + endif + if 'openrc' in init_script + subdir('config/init/openrc') + endif subdir('config/sysconfig') endif if want_selinux diff --git a/meson_options.txt b/meson_options.txt index f93ab1f607..d24261effe 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -15,7 +15,7 @@ option('examples', type: 'boolean', value: true, # was --init-script in autotools option('init-script', type: 'array', - choices: ['systemd', 'sysvinit'], value: ['systemd'], + choices: ['systemd', 'sysvinit', 'openrc'], value: ['systemd'], description: 'init script') # was --systemd-unidir in autotools