summaryrefslogtreecommitdiffstats
path: root/client/debuginfofs.init
diff options
context:
space:
mode:
Diffstat (limited to 'client/debuginfofs.init')
-rwxr-xr-xclient/debuginfofs.init93
1 files changed, 93 insertions, 0 deletions
diff --git a/client/debuginfofs.init b/client/debuginfofs.init
new file mode 100755
index 0000000..e8d63f2
--- /dev/null
+++ b/client/debuginfofs.init
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+### BEGIN INIT INFO
+# Provides: debuginfofs
+# Required-Start: $local_fs $network $named $remote_fs $syslog
+# Required-Stop: $local_fs $network $named $remote_fs $syslog
+# Short-Description: Remote debuginfo filesystem
+# Description: Mount a remote debuginfo filesystem for use with debugging tools
+### END INIT INFO
+
+# debuginfofs Mounts/unmounts the debuginfo filesystem
+#
+# chkconfig: - 85 15
+# description: debuginfofs mounts a WebDAV share of debuginfo files at the \
+# appropriate place(s) in the filesystem for use by gdb and other \
+# debugging tools.
+# config: /etc/sysconfig/debuginfofs
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Source our configuration
+. /etc/sysconfig/debuginfofs
+
+RETVAL=0
+prog="debuginfofs"
+
+start() {
+ # Mount filesystems.
+
+ # Check that networking is up.
+ [ ${NETWORKING} = "no" ] && exit 1
+
+ # Sanity check binary and configuration
+ [ -x /usr/sbin/mount.davfs ] || exit 1
+ [ -n "$BUILDID_URL" ] || exit 1
+ [ -n "$BUILDID_MOUNTPOINT" ] || exit 1
+ [ -d "$BUILDID_MOUNTPOINT" ] || mkdir -p "$BUILDID_MOUNTPOINT"
+
+ echo -n $"Starting debuginfofs: "
+ mount -t davfs "$BUILDID_URL" "$BUILDID_MOUNTPOINT" \
+ -o ro,conf=/etc/davfs2/debuginfofs.conf $MOUNT_ARGS
+ RETVAL=$?
+
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/debuginfofs
+ [ $RETVAL -eq 0 ] && success $"$prog startup" || failure $"$prog startup"
+ echo
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping debuginfofs: "
+ umount "$BUILDID_MOUNTPOINT"
+ RETVAL=$?
+ rm -f /var/lock/subsys/debuginfofs
+ [ $RETVAL -eq 0 ] && success $"$prog shutdown" || failure $"$prog shutdown"
+ echo
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload|force-reload)
+ stop
+ start
+ RETVAL=$?
+ ;;
+ condrestart)
+ if [ -f /var/lock/subsys/debuginfofs ]; then
+ stop
+ start
+ RETVAL=$?
+ fi
+ ;;
+ status)
+ status $prog
+ RETVAL=$?
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+ exit 1
+esac
+
+exit $RETVAL