svn path=/trunk/packages/invirt-remote-server/; revision=1743
+invirt-remote-server (0.1.4) unstable; urgency=low
+
+ * Steal some init script ideas from debathena-pyhesiodfs
+
+ -- Evan Broder <broder@mit.edu> Sat, 22 Nov 2008 05:31:49 -0500
+
invirt-remote-server (0.1.3) unstable; urgency=low
* Switched to using "raw" select expressions instead of using the ORM;
invirt-remote-server (0.1.3) unstable; urgency=low
* Switched to using "raw" select expressions instead of using the ORM;
NAME=invirt-remote-server
DESC="the Invirt remctl configuration filesystem"
DAEMON=/usr/sbin/invirt-remconffs
NAME=invirt-remote-server
DESC="the Invirt remctl configuration filesystem"
DAEMON=/usr/sbin/invirt-remconffs
-DAEMON_ARGS="/etc/remctl/remconffs"
+MOUNTPOINT="/etc/remctl/remconffs"
+DAEMON_ARGS="-f $MOUNTPOINT"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
GEN_FILES=/etc/remctl/acl/web
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
GEN_FILES=/etc/remctl/acl/web
. /lib/init/gen-files.sh
. /lib/init/std-init.sh
. /lib/init/gen-files.sh
. /lib/init/std-init.sh
+#
+# 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
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
- gen_files
- modprobe fuse
- daemon --running -n $NAME && return 1
- daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
+
+ # Try to make sure fuse is setup
+ [ -e /dev/fuse ] || modprobe fuse || return 2
+
+ if cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
+ return 1
+ fi
+
+ gen_config
+
+ daemon -r -O daemon.info -E daemon.err -n $NAME -- $DAEMON $DAEMON_ARGS || return 2
+#
+# Function that stops the daemon/service
+#
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
+
+ if ! cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
+ return 1
+ fi
+
daemon --stop -n $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
daemon --stop -n $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
- umount "$DAEMON_ARGS"
- return "$RETVAL"
+}
+
+do_reload()
+{
+ gen_config