X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/2cfee565a20a17fc0cb6e3b90d807e222cd302a0..0703b52897d0ec752bbf019f58e17d7ae265c4eb:/debian/sipb-xen-remctl-auto.init diff --git a/debian/sipb-xen-remctl-auto.init b/debian/sipb-xen-remctl-auto.init index 70794ac..b35f5ba 100755 --- a/debian/sipb-xen-remctl-auto.init +++ b/debian/sipb-xen-remctl-auto.init @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash ### BEGIN INIT INFO # Provides: sipb-xen-remctl-auto # Required-Start: $local_fs $remote_fs @@ -6,104 +6,30 @@ # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: conserver config from invirt config for invirt host -# Description: -### END INIT INFO +# Description: +### END INIT INFO -# Author: Invirt/XVM Project, MIT SIPB +PACKAGE=sipb-xen-remctl-auto -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="Invirt host console config" -NAME=sipb-xen-remctl-auto -SCRIPTNAME=/etc/init.d/$NAME - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions gen_config() { - echo "host/$(invirt-getconf remote.hostname)@$(invirt-getconf authn.0.realm)" \ - > /etc/remctl/acl/remote -} - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - gen_config -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - return 0 -} - -do_reload() -{ - gen_config + for i in /etc/remctl/acl/remote + do mako-render $i.mako > $i + done } case "$1" in - start) - [ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; + start|reload|force-reload|restart) + log_begin_msg "Reloading config for $PACKAGE" + gen_config + log_end_msg $? + /etc/init.d/openbsd-inetd start # idempotent, thankfully + ;; stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - reload|force-reload) - log_daemon_msg "Reloading $DESC" "$NAME" - do_reload - log_end_msg $? - ;; - restart) - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; + ;; *) - echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - exit 3 - ;; + log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}" + ;; esac - -: