[gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.3

2015-06-13 Thread Markos Chandras (hwoarang)
hwoarang15/06/13 11:54:25

  Modified: lxc.initd.3
  Log:
  Do not hardcode LXC_PATH. Bug #548568. Patch by Erik Mackdanz 
erikm...@gmail.com
  
  (Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 
09BF4F54C2BA7F3C!)

Revision  ChangesPath
1.3  app-emulation/lxc/files/lxc.initd.3

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?rev=1.3view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?rev=1.3content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?r1=1.2r2=1.3

Index: lxc.initd.3
===
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lxc.initd.3 23 Apr 2015 16:31:44 -  1.2
+++ lxc.initd.3 13 Jun 2015 11:54:25 -  1.3
@@ -1,11 +1,11 @@
 #!/sbin/runscript
 # Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v 1.2 
2015/04/23 16:31:44 hwoarang Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v 1.3 
2015/06/13 11:54:25 hwoarang Exp $
 
 CONTAINER=${SVCNAME#*.}
 
-LXC_PATH=/var/lib
+LXC_PATH=`lxc-config lxc.lxcpath`
 
 lxc_get_configfile() {
if [ -f ${LXC_PATH}/${CONTAINER}.conf ]; then






[gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.3

2015-04-23 Thread Markos Chandras (hwoarang)
hwoarang15/04/23 16:31:44

  Modified: lxc.initd.3
  Log:
  Version bump. Bug #546232. Fix lxc path in the openrc init script. Bug #547266
  
  (Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key 
09BF4F54C2BA7F3C!)

Revision  ChangesPath
1.2  app-emulation/lxc/files/lxc.initd.3

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?rev=1.2view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?rev=1.2content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?r1=1.1r2=1.2

Index: lxc.initd.3
===
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lxc.initd.3 18 Oct 2014 17:00:37 -  1.1
+++ lxc.initd.3 23 Apr 2015 16:31:44 -  1.2
@@ -1,15 +1,17 @@
 #!/sbin/runscript
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v 1.1 
2014/10/18 17:00:37 hwoarang Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v 1.2 
2015/04/23 16:31:44 hwoarang Exp $
 
 CONTAINER=${SVCNAME#*.}
 
+LXC_PATH=/var/lib
+
 lxc_get_configfile() {
-   if [ -f /etc/lxc/${CONTAINER}.conf ]; then
-   echo /etc/lxc/${CONTAINER}.conf
-   elif [ -f /etc/lxc/${CONTAINER}/config ]; then
-   echo /etc/lxc/${CONTAINER}/config
+   if [ -f ${LXC_PATH}/${CONTAINER}.conf ]; then
+   echo ${LXC_PATH}/${CONTAINER}.conf
+   elif [ -f ${LXC_PATH}/${CONTAINER}/config ]; then
+   echo ${LXC_PATH}/${CONTAINER}/config
else
eerror Unable to find a suitable configuration file.
eerror If you set up the container in a non-standard






[gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.3

2014-10-18 Thread Markos Chandras (hwoarang)
hwoarang14/10/18 17:00:37

  Added:lxc.initd.3
  Log:
  Version bump. Fixes bug #516772, #518484, #519662
  
  (Portage version: 2.2.14_rc1/cvs/Linux x86_64, signed Manifest commit with 
key 09BF4F54C2BA7F3C!)

Revision  ChangesPath
1.1  app-emulation/lxc/files/lxc.initd.3

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?rev=1.1view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.3?rev=1.1content-type=text/plain

Index: lxc.initd.3
===
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v 1.1 
2014/10/18 17:00:37 hwoarang Exp $

CONTAINER=${SVCNAME#*.}

lxc_get_configfile() {
if [ -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 container in a non-standard
eerror location, please set the CONFIGFILE variable.
return 1
fi
}

[ $CONTAINER != $SVCNAME ]  CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}

lxc_get_var() {
awk 'BEGIN { FS=[ \t]*=[ \t]* } $1 == '$1' { print $2; exit }' 
${CONFIGFILE}
}

lxc_get_net_link_type() {
awk 'BEGIN { FS=[ \t]*=[ \t]*; _link=; _type= }
$1 == lxc.network.type {_type=$2;}
$1 == lxc.network.link {_link=$2;}
{if(_link !=   _type != ){
printf(%s:%s\n, _link, _type );
_link=; _type=;
}; }' ${CONFIGFILE}
}

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

# no need to output anything, the function takes care of that.
[ -z ${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() {
# be quiet, since we have to run depend() also for the
# non-muxed init script, unfortunately.
checkconfig 2/dev/null || return 0

config ${CONFIGFILE}
need localmount

local _x _if
for _x in $(lxc_get_net_link_type); do
_if=${_x%:*}
case ${_x##*:} in
# when the network type is set to phys, we can make use 
of a
# network service (for instance to set it up before we 
disable
# the net_admin capability), but we might also not set 
it up
# at all on the host and leave the net_admin capable 
service
# to take care of it.
phys)   use net.${_if} ;;
*)  need net.${_if} ;;
esac
done
}

start() {
checkconfig || return 1
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; always use setarch
# when required, as that makes it easier to deal with
# x32-based containers.
case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in
EM_X86_64)  setarch=linux64;;
EM_386) setarch=linux32;;
esac

ebegin Starting ${CONTAINER}
env -i ${setarch} $(type -p 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 /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]
eend $?
}

stop() {
checkconfig || return 1


if ! [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]; then
ewarn ${CONTAINER} doesn't seem to be started.
return 0
fi

init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }')

if [ -z ${init_pid} ]; then
ewarn ${CONTAINER} doesn't seem to be running.
return 0
fi

ebegin Shutting down system in ${CONTAINER}
kill -PWR ${init_pid}
eend $?

TIMEOUT=${TIMEOUT:-30}
i=0
while [ -n $(pgrep -P ${init_pid}) -a $i -lt ${TIMEOUT} ]; do