Commit 012f591a by John Lane Committed by Stéphane Graber

lxc-archlinux: support enabling systemd units

parent 734d0bed
...@@ -206,6 +206,7 @@ Mandatory args: ...@@ -206,6 +206,7 @@ Mandatory args:
Optional 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,--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 -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 -c,--config use specified pacman config when installing container packages
-a,--arch use specified architecture instead of host's architecture -a,--arch use specified architecture instead of host's architecture
-t,--network_type set container network interface type (${lxc_network_type}) -t,--network_type set container network interface type (${lxc_network_type})
...@@ -215,7 +216,7 @@ EOF ...@@ -215,7 +216,7 @@ EOF
return 0 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 if [ ${?} -ne 0 ]; then
usage $(basename ${0}) usage $(basename ${0})
exit 1 exit 1
...@@ -230,6 +231,7 @@ do ...@@ -230,6 +231,7 @@ do
-n|--name) name=${2}; shift 2;; -n|--name) name=${2}; shift 2;;
--rootfs) rootfs_path=${2}; shift 2;; --rootfs) rootfs_path=${2}; shift 2;;
-P|--packages) additional_packages=${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;; -c|--config) pacman_config=${2}; shift 2;;
-a|--arch) arch=${2}; shift 2;; -a|--arch) arch=${2}; shift 2;;
-t|--network_type) lxc_network_type=${2}; shift 2;; -t|--network_type) lxc_network_type=${2}; shift 2;;
...@@ -306,4 +308,13 @@ if [ ${?} -ne 0 ]; then ...@@ -306,4 +308,13 @@ if [ ${?} -ne 0 ]; then
exit 1 exit 1
fi 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" echo "container config is ${config_path}/config"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment