diff options
Diffstat (limited to 'testing/lxd/lxd.initd')
-rw-r--r-- | testing/lxd/lxd.initd | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/testing/lxd/lxd.initd b/testing/lxd/lxd.initd index 6f5576cdc16..c1aef377ab6 100644 --- a/testing/lxd/lxd.initd +++ b/testing/lxd/lxd.initd @@ -1,17 +1,19 @@ #!/sbin/openrc-run -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxd/files/lxd.initd,v 1.1 2015/07/19 20:36:34 alunduil Exp $ +# $Id$ DAEMON=/usr/sbin/lxd PIDFILE=/run/lxd.pid +extra_commands="stopall" + depend() { - need cgmanager + need net + use lxcfs - if echo "${LXD_OPTIONS}" | grep -e "--tcp" >/dev/null; then - need net - fi + # remove with 2.0 release + need cgmanager } start() { @@ -29,7 +31,20 @@ start() { } stop() { - ebegin "Stopping lxd server" - start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} + if [[ $RC_GOINGDOWN = YES ]] || [[ $RC_REBOOT = YES ]]; then + stopall + else + ebegin "Stopping lxd service (but not containers)" + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} + eend $? + fi +} + +stopall() { + ebegin "Stopping lxd service and containers" + if "${DAEMON}" shutdown; then + /etc/init.d/lxd zap + rm -f ${PIDFILE} + fi eend $? } |