From: John Lane Date: Thu, 12 Dec 2013 12:00:38 +0000 (+0000) Subject: lxc-archlinux: support enabling systemd units X-Git-Tag: lxc-1.0.0.beta2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=012f591a7df0a3cb025905ba2e7d2033b550dac1;p=thirdparty%2Flxc.git lxc-archlinux: support enabling systemd units Signed-off-by: John Lane Acked-by: Stéphane Graber --- diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in index 3d50981d8..954e16a99 100755 --- a/templates/lxc-archlinux.in +++ b/templates/lxc-archlinux.in @@ -206,6 +206,7 @@ Mandatory args: Optional args: -p,--path path to where the container rootfs will be created, defaults to ${default_path}/rootfs. The container config will go under ${default_path} in that case -P,--packages preinstall additional packages, comma-separated list + -e,--enable_units Enable additional systemd units, comma-separated list -c,--config use specified pacman config when installing container packages -a,--arch use specified architecture instead of host's architecture -t,--network_type set container network interface type (${lxc_network_type}) @@ -215,7 +216,7 @@ EOF return 0 } -options=$(getopt -o hp:P:n:c:a:l:t: -l help,rootfs:,path:,packages:,name:,config:,arch:,network_type:,network_link: -- "${@}") +options=$(getopt -o hp:P:e:n:c:a:l:t: -l help,rootfs:,path:,packages:,enable_units:,name:,config:,arch:,network_type:,network_link: -- "${@}") if [ ${?} -ne 0 ]; then usage $(basename ${0}) exit 1 @@ -230,6 +231,7 @@ do -n|--name) name=${2}; shift 2;; --rootfs) rootfs_path=${2}; shift 2;; -P|--packages) additional_packages=${2}; shift 2;; + -e|--enable_units) enable_units=${2}; shift 2;; -c|--config) pacman_config=${2}; shift 2;; -a|--arch) arch=${2}; shift 2;; -t|--network_type) lxc_network_type=${2}; shift 2;; @@ -306,4 +308,13 @@ if [ ${?} -ne 0 ]; then exit 1 fi +if [ ${#enable_units[@]} -gt 0 ]; then + split_string ${enable_units} + for unit in ${result[@]}; do + [ "${unit}" = *'.'* ] || unit="${unit}.service" + ln -s /usr/lib/systemd/system/"${unit}" \ + "${rootfs_path}"/etc/systemd/system/multi-user.target.wants + done +fi + echo "container config is ${config_path}/config"