diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-12-02 10:34:28 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-12-02 10:36:04 +0000 |
commit | 60f848e0d35df7c3dc69de560dbab69e71f9a71f (patch) | |
tree | 4def071b9f80062c6fb94a70099d485ee40317bf | |
parent | 862c741a3ccc0936ce80840bad3937dec6a52c4d (diff) | |
download | aports-60f848e0d35df7c3dc69de560dbab69e71f9a71f.tar.bz2 aports-60f848e0d35df7c3dc69de560dbab69e71f9a71f.tar.xz |
main/lxc: add support for lxc's autostart feature
this makes it possible to mark which containers you want to be
autostarted in the container config and then use
/etc/init.d/lxc start
to start them all
same with stop/reboot.
-rw-r--r-- | main/lxc/APKBUILD | 8 | ||||
-rw-r--r-- | main/lxc/lxc.initd | 27 |
2 files changed, 28 insertions, 7 deletions
diff --git a/main/lxc/APKBUILD b/main/lxc/APKBUILD index 4206b48420..ab71bc5146 100644 --- a/main/lxc/APKBUILD +++ b/main/lxc/APKBUILD @@ -3,7 +3,7 @@ pkgname=lxc pkgver=1.0.6 _mypkgver=${pkgver/_rc/.rc} -pkgrel=2 +pkgrel=3 pkgdesc="linux containers - tools" url="http://lxc.sourceforge.net/" arch="all" @@ -94,7 +94,7 @@ dev() { md5sums="3949cd916a120f40c2355c9a5b65cd51 lxc-1.0.6.tar.gz 79e90616b5049a472ccdcb5b1dcdd8b1 version.patch -1268d4b3e6ed004a47216b8714d09bfd lxc.initd +2c21cb054c7f373318e373cfa9e4f78c lxc.initd 0800600ea0e9a0a4eab5822e8f14d6a2 0001-Support-openvswitch-bridges.patch 82f16afb2cec1dfca66e4057daf02694 0002-fix-typo.patch fc502befeee596d5a1cf78d4f294a3e9 0003-Update-the-openvswitch-bridge-attach-code.patch @@ -102,7 +102,7 @@ b0bf2ec6a49bd7d5a9db107c0d6bf925 0001-lxc-alpine-make-sure-dev-shm-is-world-wri b0eeceaa8a13df9d37f0739961320c25 0002-lxc-alpine-create-a-default-tty-for-console.patch" sha256sums="2aea199a89e2cd946f93406af6c3f62844f36954b79a6991b36d2c33022cb11c lxc-1.0.6.tar.gz b6d85fb23940d2511b3951de56b2532843c0e03ec1613548366361cc0c1a46b9 version.patch -bc108a722dc359a24c48837ef7012c776b1d20a533ae0e2231f75081dad4e2f5 lxc.initd +97606cf912818f7ba099d72cb42b25fee44789c1bfd67f1c0150253e86dc6979 lxc.initd a415aa17655788a49627eb2e06fd06b3f73dfea283a9c67c9bf7029430fcca88 0001-Support-openvswitch-bridges.patch e6502aa038b18dc4dff7eea6d916215babb8ce775d7c79b2fb7669edcc23ea97 0002-fix-typo.patch 3a63dda403a2fab04fa5d2c9e7762efdcb911cbd913399b8226abdec6643fec9 0003-Update-the-openvswitch-bridge-attach-code.patch @@ -110,7 +110,7 @@ b699d220332a1a004cd7305eed8700f80fc86160299fdbbaa234f6b545a17217 0001-lxc-alpin 33fb2866dbfc1aabedee65fe2b5f3e8ebce1d081a1ea5d8734a43793308f40c6 0002-lxc-alpine-create-a-default-tty-for-console.patch" sha512sums="fe85ccb57865d86704df6b4b79d60f31892785b07dc9dd2580cc6c384c89c29c23516e906b7a16bc03c6582c1fb2432bb8ff11bd17c09efa8f6a035fb41f46b1 lxc-1.0.6.tar.gz e2ffcbf55447291a8434a4f37255c3a6a119bc4116c75d205006aa2b070bf6be28535cf6107bead14bbf64bf9fa415346ab544bd1c15e1add7d1c6380e6b2def version.patch -6618ceb59f1927bb82ad1a0fe0a7d4c452ced7855d8f0953556fce9154f30a4c5afbd7a2ab07fb26e6e793b07d4c8f906f8dc27c1defe0580dcf1545c80d1d60 lxc.initd +bcf73032f2c7d17d457bcd5405071a869dcdeef36ef6b9bf5e13f21d5b4c5e1548a09114dd032863ba91358b74b2a72598bf01e53520185492593c2f4db15ffc lxc.initd 636dc009496f8648ba10aec6b590c2d1f5db17bf76161fec2b38a7a994198d2ac9c1af7e342f4d3e695d53951b5309447f20155fb79e00489a2f5c0513d08d89 0001-Support-openvswitch-bridges.patch dc5f5f230df91ea951e231aaedebab8217bcf6a676e2da88f4db3e0b36cdd922fb888c0f6a0eb34d5065add9c002b080c9ac687f9cd16875bd18d4f120f56d6e 0002-fix-typo.patch c7089b58dc7c4d2fc8cb245c7eb43930bd9e821e136e5461c3f79af063c640076c07d92afd5675cc57bb832e85690d917b87b337d075505a65e154efa7c45bc0 0003-Update-the-openvswitch-bridge-attach-code.patch diff --git a/main/lxc/lxc.initd b/main/lxc/lxc.initd index 1b348894d4..db4a149618 100644 --- a/main/lxc/lxc.initd +++ b/main/lxc/lxc.initd @@ -35,9 +35,8 @@ lxc_get_var() { checkconfig() { if [ ${CONTAINER} = ${SVCNAME} ]; then - eerror "You have to create an init script for each container:" - eerror " ln -s lxc /etc/init.d/lxc.container" - return 1 + CONTAINER= + return 0 fi CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)} @@ -52,8 +51,20 @@ checkconfig() { fi } +_autostart() { + ebegin "$1 LXC containers" + shift + lxc-autostart --group "${LXC_GROUP:-onboot,}" "$@" + eend $? +} + start() { checkconfig || return 1 + if [ -z "$CONTAINER" ]; then + _autostart "Starting" + return + fi + rm -f /var/log/lxc/${CONTAINER}.log rootpath=$(lxc_get_var lxc.rootfs) @@ -75,6 +86,10 @@ start() { stop() { checkconfig || return 1 + if [ -z "$CONTAINER" ]; then + _autostart "Stopping" --shutdown --timeout ${LXC_TIMEOUT:-30} + return + fi ebegin "Stopping container ${CONTAINER}" start-stop-daemon --stop --pidfile ${pidfile} \ @@ -85,8 +100,14 @@ stop() { reboot() { checkconfig || return 1 + if [ -z "$CONTAINER" ]; then + _autostart "Rebooting" --reboot + return + fi + ebegin "Sending reboot signal to container $CONTAINER" start-stop-daemon --signal ${RESTART_SIG:-SIGTERM} \ --pidfile ${pidfile} eend $? } + |