Gentoo Archives: gentoo-commits

From: "Diego Petteno (flameeyes)" <flameeyes@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd
Date: Mon, 05 Sep 2011 18:32:56
Message-Id: 20110905183244.724FE20051@flycatcher.gentoo.org
1 flameeyes 11/09/05 18:32:44
2
3 Modified: lxc.initd
4 Log:
5 Version bump; also includes fixes for the init script, closing bugs #379679 and #379683 by George Georgiev.
6
7 (Portage version: 2.2.0_alpha53/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.6 app-emulation/lxc/files/lxc.initd
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd?rev=1.6&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd?rev=1.6&content-type=text/plain
14 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd?r1=1.5&r2=1.6
15
16 Index: lxc.initd
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v
19 retrieving revision 1.5
20 retrieving revision 1.6
21 diff -u -r1.5 -r1.6
22 --- lxc.initd 6 May 2011 11:03:46 -0000 1.5
23 +++ lxc.initd 5 Sep 2011 18:32:44 -0000 1.6
24 @@ -1,15 +1,12 @@
25 #!/sbin/runscript
26 # Copyright 1999-2011 Gentoo Foundation
27 # Distributed under the terms of the GNU General Public License v2
28 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.5 2011/05/06 11:03:46 flameeyes Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.6 2011/09/05 18:32:44 flameeyes Exp $
30
31 CONTAINER=${SVCNAME#*.}
32 -CONFIGFILE=${CONFIGFILE:-/etc/lxc/${CONTAINER}.conf}
33
34 lxc_get_configfile() {
35 - if [ -n "${CONFIGFILE}" ]; then
36 - echo "${CONFIGFILE}"
37 - elif [ -f "/etc/lxc/${CONTAINER}.conf" ]; then
38 + if [ -f "/etc/lxc/${CONTAINER}.conf" ]; then
39 echo "/etc/lxc/${CONTAINER}.conf"
40 elif [ -f "/etc/lxc/${CONTAINER}/config" ]; then
41 echo "/etc/lxc/${CONTAINER}/config"
42 @@ -21,8 +18,10 @@
43 fi
44 }
45
46 +CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}
47 +
48 lxc_get_var() {
49 - awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' $(lxc_get_configfile)
50 + awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
51 }
52
53 cgroup_get_mount() {
54 @@ -37,7 +36,7 @@
55 fi
56
57 # no need to output anything, the function takes care of that.
58 - [ -z "$(lxc_get_configfile)" ] && return 1
59 + [ -z "${CONFIGFILE}" ] && return 1
60
61 utsname=$(lxc_get_var lxc.utsname)
62 if [ ${CONTAINER} != ${utsname} ]; then
63 @@ -52,14 +51,14 @@
64 # non-muxed init script, unfortunately.
65 checkconfig 2>/dev/null || return 0
66
67 - config $(lxc_get_configfile)
68 + config ${CONFIGFILE}
69 need localmount
70
71 # find out which network interface the container is linked to,
72 # and then require that to be enabled, so that the
73 # dependencies are correct.
74 netif=$(lxc_get_var lxc.network.link)
75 - [ -n "${netif}" ] && need net.${netif}
76 + [ -n "${netif}" ] && use net.${netif}
77 }
78
79 start() {
80 @@ -93,7 +92,7 @@
81 esac
82
83 ebegin "Starting ${CONTAINER}"
84 - env -i ${setarch} $(type -p lxc-start) -l WARN -n ${CONTAINER} -f $(lxc_get_configfile) -d -o /var/log/lxc/${CONTAINER}.log
85 + env -i ${setarch} $(type -p lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
86 sleep 0.5
87
88 # lxc-start -d will _always_ report a correct startup, even if it