summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2011-04-24 15:24:45 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2011-04-24 15:24:45 +0000
commit5e57ddb9c687c2b94edd098c5a945711e5fe6f45 (patch)
tree7257357498382bb17eb0841211bf41c157e89c0b /app-emulation/lxc
parentSlotmove libwpd 0.8 and 0.9. (diff)
downloadhistorical-5e57ddb9c687c2b94edd098c5a945711e5fe6f45.tar.gz
historical-5e57ddb9c687c2b94edd098c5a945711e5fe6f45.tar.bz2
historical-5e57ddb9c687c2b94edd098c5a945711e5fe6f45.zip
Revision bump to improve the init script so that it searches the new location of configuration files created by lxc-create (closes bug #364611).
Package-Manager: portage-2.2.0_alpha30/cvs/Linux x86_64
Diffstat (limited to 'app-emulation/lxc')
-rw-r--r--app-emulation/lxc/ChangeLog9
-rw-r--r--app-emulation/lxc/Manifest12
-rw-r--r--app-emulation/lxc/files/lxc.initd170
-rw-r--r--app-emulation/lxc/lxc-0.7.4.1-r1.ebuild (renamed from app-emulation/lxc/lxc-0.7.4.1.ebuild)2
4 files changed, 109 insertions, 84 deletions
diff --git a/app-emulation/lxc/ChangeLog b/app-emulation/lxc/ChangeLog
index 3f3d55f9ccf8..50dfe2f43d92 100644
--- a/app-emulation/lxc/ChangeLog
+++ b/app-emulation/lxc/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for app-emulation/lxc
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/ChangeLog,v 1.21 2011/03/30 12:09:06 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/ChangeLog,v 1.22 2011/04/24 15:24:44 flameeyes Exp $
+
+*lxc-0.7.4.1-r1 (24 Apr 2011)
+
+ 24 Apr 2011; Diego E. Pettenò <flameeyes@gentoo.org> -lxc-0.7.4.1.ebuild,
+ +lxc-0.7.4.1-r1.ebuild, files/lxc.initd:
+ Revision bump to improve the init script so that it searches the new location
+ of configuration files created by lxc-create (closes bug #364611).
*lxc-0.7.4.1 (30 Mar 2011)
diff --git a/app-emulation/lxc/Manifest b/app-emulation/lxc/Manifest
index aea231f752dd..1c8ebb08c192 100644
--- a/app-emulation/lxc/Manifest
+++ b/app-emulation/lxc/Manifest
@@ -1,15 +1,15 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-AUX lxc.initd 3206 RMD160 012b94240f1c061eb9d3f6a3e1bc31414ee952c3 SHA1 5de2218a1e7529ef285099b8d28bdb010267d7f8 SHA256 33802f04be6fbc8623a6332eb31d67ade45a7e9b6b40e531e574f35a19ae58b9
+AUX lxc.initd 3602 RMD160 9c1b3f16fb72f534c8c64b03e4dd4f4c5b05f800 SHA1 03827502cf7752ff6a2974cf2da598215aa60bfa SHA256 5029d19ee5f62032663065bb53a300faa7be3310929900ad7d19d0b85e69a30d
DIST lxc-0.7.4.1.tar.gz 274420 RMD160 1028abd9ae0f2689ac9cd15f33f9dc0b2aa0a8fb SHA1 837be69ef9fa20441793bb97b6d1291dba9191c2 SHA256 6354e7c0ada65bcd1649d4a8333adde97e6480da518399ad2298a7364ef7881f
-EBUILD lxc-0.7.4.1.ebuild 3560 RMD160 df87dc6cf142bd94206543160b23f2c83195b92d SHA1 4ed55392bdeeb5f04ac01c9193f6aa348a83b644 SHA256 c2cc16757f746c847750b9e4740646404e1d2e7b9455c4a48d7dffabca4c8dab
-MISC ChangeLog 4992 RMD160 5061646c7bce20c959dd6693768a881172dcc8b7 SHA1 e9ea9649507ae4e99db2da2edcc842345473ecaf SHA256 fc388d5b0facbf3f4ef19d26fdd0005bdb3a0e55b06ea742414e6b850cb5e200
+EBUILD lxc-0.7.4.1-r1.ebuild 3563 RMD160 0a26c85f5f145efc1c08617b3463da1467e02728 SHA1 84cc09e9ab4c08ffe41873497311d2aefaef38cd SHA256 892409e759499d46fa9607dddb92e3836f53d9ceb4e0fa664e66997c964543db
+MISC ChangeLog 5293 RMD160 fbf999d7d926b09ab5218a12d9195d9799ed5014 SHA1 a5cf78d2f303862f970a4bb9a7f077173e57bb24 SHA256 619441c30a91f0faaafe39f46b94ba3930e9279482d2f44d3a9bd85b43fda5a0
MISC metadata.xml 653 RMD160 d6139a7ce3a5dab18f33c7f111f2e7827c290723 SHA1 47ba631625b4f2b20e491a964e65c78dd236f6f2 SHA256 35f64761067f47ff7abd0e3f3cb57f4bab888a2546bf3267d59987505101a190
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
-iEYEARECAAYFAk2THWgACgkQAiZjviIA2XjO0gCg03LQZTDWrJkGpxoddC62/y+d
-+dgAoLyvqovVVf9R0aY7ZDM+RSYkrZ0r
-=thhC
+iEYEARECAAYFAk20QLkACgkQAiZjviIA2XhXWgCg1tuxMMBpmo12hqplcrGYBibO
+cLoAoMvUYpnGnyDtq9J2qIX2AQnIqH98
+=8xHn
-----END PGP SIGNATURE-----
diff --git a/app-emulation/lxc/files/lxc.initd b/app-emulation/lxc/files/lxc.initd
index 86bae5f75762..4388fb2304bf 100644
--- a/app-emulation/lxc/files/lxc.initd
+++ b/app-emulation/lxc/files/lxc.initd
@@ -1,32 +1,50 @@
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.3 2011/02/26 18:02:51 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.4 2011/04/24 15:24:44 flameeyes Exp $
CONTAINER=${SVCNAME#*.}
CONFIGFILE=${CONFIGFILE:-/etc/lxc/${CONTAINER}.conf}
+lxc_get_configfile() {
+ if [ -n "${CONFIGFILE}" ]; then
+ echo "${CONFIGFILE}"
+ elif [ -f "/etc/lxc/${CONTAINER}.conf" ]; then
+ echo "/etc/lxc/${CONTAINER}.conf"
+ elif [ -f "/etc/lxc/${CONTAINER}/config" ]; then
+ echo "/etc/lxc/${CONTAINER}/config"
+ else
+ eerror "Unable to find a suitable configuration file."
+ eerror "If you set up the contianer in a non-standard"
+ eerror "location, please set the CONFIGFILE variable."
+ return 1
+ fi
+}
+
lxc_get_var() {
- awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
+ awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' $(lxc_get_configfile)
}
cgroup_get_mount() {
- mount | awk '$5 == "cgroup" { print $3; exit }'
+ mount | awk '$5 == "cgroup" { print $3; exit }'
}
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
- fi
-
- utsname=$(lxc_get_var lxc.utsname)
- if [ ${CONTAINER} != ${utsname} ]; then
- eerror "You should use the same name for the service and the"
- eerror "container. Right now the container is called ${utsname}"
- return 1
- fi
+ 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
+ fi
+
+ # no need to output anything, the function takes care of that.
+ [ -z "$(lxc_get_configfile)" ] && return 1
+
+ utsname=$(lxc_get_var lxc.utsname)
+ if [ ${CONTAINER} != ${utsname} ]; then
+ eerror "You should use the same name for the service and the"
+ eerror "container. Right now the container is called ${utsname}"
+ return 1
+ fi
}
depend() {
@@ -34,81 +52,81 @@ depend() {
# non-muxed init script, unfortunately.
checkconfig 2>/dev/null || return 0
- config ${CONFIGFILE}
+ config $(lxc_get_configfile)
need localmount
- # find out which network interface the container is linked to,
- # and then require that to be enabled, so that the
- # dependencies are correct.
- netif=$(lxc_get_var lxc.network.link)
- [ -n "${netif}" ] && need net.${netif}
+ # find out which network interface the container is linked to,
+ # and then require that to be enabled, so that the
+ # dependencies are correct.
+ netif=$(lxc_get_var lxc.network.link)
+ [ -n "${netif}" ] && need net.${netif}
}
start() {
- checkconfig || return 1
-
- # make sure that cgroup is mounted if it isn't already, this
- # ensures that we can actually proceed!
- cgroupmount=$(cgroup_get_mount)
- if [ -z ${cgroupmount} ]; then
- mkdir -p /cgroup
-
- if ! mount -t cgroup cgroup /cgroup; then
- eerror "Unable to mount cgroup pseudo-filesystem on /cgroup"
- return 1
- fi
-
- cgroupmount=/cgroup
- fi
-
- rm /var/log/lxc/${CONTAINER}.log
-
- rootpath=$(lxc_get_var lxc.rootfs)
-
- # Check the format of our init and the chroot's init, to see if we
- # have to use linux32 or linux64…
- case $(scanelf -BF '%M#f' /sbin/init ${rootpath}/sbin/init | tr '\n' ':') in
- ELFCLASS64:ELFCLASS64:) setarch=;;
- ELFCLASS32:ELFCLASS32:) setarch=;;
- ELFCLASS32:ELFCLASS64:) setarch=linux64;;
- ELFCLASS64:ELFCLASS32:) setarch=linux32;;
- esac
-
- ebegin "Starting ${CONTAINER}"
- ${setarch} lxc-start -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
- sleep 0.5
-
- # lxc-start -d will _always_ report a correct startup, even if it
- # failed, so rather than trust that, check that the cgroup exists.
- [ -d ${cgroupmount}/${CONTAINER} ]
- eend $?
+ checkconfig || return 1
+
+ # make sure that cgroup is mounted if it isn't already, this
+ # ensures that we can actually proceed!
+ cgroupmount=$(cgroup_get_mount)
+ if [ -z ${cgroupmount} ]; then
+ mkdir -p /cgroup
+
+ if ! mount -t cgroup cgroup /cgroup; then
+ eerror "Unable to mount cgroup pseudo-filesystem on /cgroup"
+ return 1
+ fi
+
+ cgroupmount=/cgroup
+ fi
+
+ rm /var/log/lxc/${CONTAINER}.log
+
+ rootpath=$(lxc_get_var lxc.rootfs)
+
+ # Check the format of our init and the chroot's init, to see if we
+ # have to use linux32 or linux64...
+ case $(scanelf -BF '%M#f' /sbin/init ${rootpath}/sbin/init | tr '\n' ':') in
+ ELFCLASS64:ELFCLASS64:) setarch=;;
+ ELFCLASS32:ELFCLASS32:) setarch=;;
+ ELFCLASS32:ELFCLASS64:) setarch=linux64;;
+ ELFCLASS64:ELFCLASS32:) setarch=linux32;;
+ esac
+
+ ebegin "Starting ${CONTAINER}"
+ ${setarch} lxc-start -l WARN -n ${CONTAINER} -f $(lxc_get_configfile) -d -o /var/log/lxc/${CONTAINER}.log
+ sleep 0.5
+
+ # lxc-start -d will _always_ report a correct startup, even if it
+ # failed, so rather than trust that, check that the cgroup exists.
+ [ -d ${cgroupmount}/${CONTAINER} ]
+ eend $?
}
stop() {
- checkconfig || return 1
+ checkconfig || return 1
- cgroupmount=$(cgroup_get_mount)
+ cgroupmount=$(cgroup_get_mount)
- if ! [ -d ${cgroupmount}/${CONTAINER} ]; then
- ewarn "${CONTAINER} doesn't seem to be started."
- return 0
- fi
+ if ! [ -d ${cgroupmount}/${CONTAINER} ]; then
+ ewarn "${CONTAINER} doesn't seem to be started."
+ return 0
+ fi
- init_pid=$(head -n1 ${cgroupmount}/${CONTAINER}/tasks)
+ init_pid=$(head -n1 ${cgroupmount}/${CONTAINER}/tasks)
- ebegin "Shutting down system in ${CONTAINER}"
- kill -INT ${init_pid}
- eend $?
+ ebegin "Shutting down system in ${CONTAINER}"
+ kill -INT ${init_pid}
+ eend $?
- sleep 15
+ sleep 15
- missingprocs=$(pgrep -P ${init_pid})
+ missingprocs=$(pgrep -P ${init_pid})
- if [ -n "${missingprocs}" ]; then
- ewarn "Something failed to properly shut down in ${CONTAINER}"
- fi
+ if [ -n "${missingprocs}" ]; then
+ ewarn "Something failed to properly shut down in ${CONTAINER}"
+ fi
- ebegin "Stopping ${CONTAINER}"
- lxc-stop -n ${CONTAINER}
- eend $?
+ ebegin "Stopping ${CONTAINER}"
+ lxc-stop -n ${CONTAINER}
+ eend $?
}
diff --git a/app-emulation/lxc/lxc-0.7.4.1.ebuild b/app-emulation/lxc/lxc-0.7.4.1-r1.ebuild
index d47f902cd057..3ff2f65aa066 100644
--- a/app-emulation/lxc/lxc-0.7.4.1.ebuild
+++ b/app-emulation/lxc/lxc-0.7.4.1-r1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/lxc-0.7.4.1.ebuild,v 1.1 2011/03/30 12:09:06 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/lxc-0.7.4.1-r1.ebuild,v 1.1 2011/04/24 15:24:44 flameeyes Exp $
EAPI="2"