Package: lxc
Version: 1.0.0-2
Severity: wishlist
Tags: upstream

attached an improved init script the provided one is somehow terse
in my system /var/lock/subsys does not exists
I've removed from the script since I don't see exactly the point,
lxc-autostart knowns if a container is started.
Anyway if it's really needed the directory must be created

Regards


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages lxc depends on:
pn  libapparmor1       <none>
ii  libc6              2.18-1
ii  libcap2            1:2.22-1.2
ii  multiarch-support  2.18-1

Versions of packages lxc recommends:
ii  debootstrap  1.0.59
ii  libcap2-bin  1:2.22-1.2

lxc suggests no packages.
#!/bin/sh
#
# lxc Start/Stop LXC autoboot containers
#
# chkconfig: 345 99 01
# description: Starts/Stops all LXC containers configured for autostart.
#
### BEGIN INIT INFO
# Provides: lxc
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Bring up/down LXC autostart containers
# Description: Bring up/down LXC autostart containers
# X-Start-Before:
# X-Stop-After:
# X-Interactive:
### END INIT INFO

# Source function library.
.. /lib/lsb/init-functions

# Check for needed utility program
[ -x /usr/bin/lxc-autostart ] || exit 1

# If libvirtd is providing the bridge, it might not be
# immediately available, so wait a bit for it before starting
# up the containers or else any that use the bridge will fail
# to start
wait_for_bridge()
{
    [ -f /etc/lxc/default.conf ] || { return 0; }

    BRNAME=`grep lxc.network.link /etc/lxc/default.conf |awk '{print $3}'`
    [ -n $BRNAME ] || { return 0; }

    for try in `seq 1 30`; do
	ifconfig -a |grep "^$BRNAME" >/dev/null 2>&1
	if [ $? = 0 ]; then
	    return
	fi
	sleep 1
    done
}

lxc_autostart()
{
	/usr/bin/lxc-autostart -L $1 | while read name delay; do
		log_progress_msg "$name"
	done
	/usr/bin/lxc-autostart $1
	log_end_msg $?
}

# See how we were called.
case "$1" in
  start)
	# Start containers
	wait_for_bridge
	log_daemon_msg "Starting LXC containers"
	lxc_autostart
	;;
  stop)
	log_daemon_msg "Stopping LXC containers"
	lxc_autostart -s
	;;
  restart|reload|force-reload)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: $0 {start|stop|restart|reload|force-reload}"
	exit 2
esac
exit $?

Reply via email to