[Pkg-voip-commits] r2935 - zaptel/trunk/debian
Tzafrir Cohen
tzafrir-guest at alioth.debian.org
Thu Jan 4 00:29:17 CET 2007
Author: tzafrir-guest
Date: 2007-01-04 00:29:16 +0100 (Thu, 04 Jan 2007)
New Revision: 2935
Modified:
zaptel/trunk/debian/zaptel.init
Log:
Make the init.d script LSB-compliant:
* LSB init stanza.
* The "status" operation checks for a zaptel timing source. I wonder if this
is a good test. Note that it may fail for non-root.
Modified: zaptel/trunk/debian/zaptel.init
===================================================================
--- zaptel/trunk/debian/zaptel.init 2007-01-03 23:14:41 UTC (rev 2934)
+++ zaptel/trunk/debian/zaptel.init 2007-01-03 23:29:16 UTC (rev 2935)
@@ -1,15 +1,19 @@
#! /bin/sh
-#
-# skeleton example file to build /etc/init.d/ scripts.
-# This file should be used to construct scripts for /etc/init.d.
-#
-# Written by Miquel van Smoorenburg <miquels at cistron.nl>.
-# Modified for Debian
-# by Ian Murdock <imurdock at gnu.ai.mit.edu>.
-#
-# Version: @(#)skeleton 1.9 26-Feb-2001 miquels at cistron.nl
-#
+### BEGIN INIT INFO
+# Provides: zaptel
+# Required-Start:
+# Required-Stop:
+# Should-Start: $local_fs hotplug module-init-tools
+# Should-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Configures zaptel kernel modules.
+# Description: Configures zaptel kernel modules. Waits until
+# they are fully loaded or loads ztdummy (if modules
+# are availble).
+### END INIT INFO
+
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/sbin/ztcfg
ZAPCONF_FILE=/etc/zaptel.conf
@@ -117,6 +121,15 @@
fi
}
+# this checks that:
+# A. /dev/zap/pseudo exists (if devfs/udev is in use, it implies zaptel loaded)
+# B. Readable to the user running this script. No poblem if run by root.
+# C. There is an active zaptel timing source. Either a zaptel hardware
+# device or ztdummy.
+test_zaptel_timing() {
+ head -c 0 /dev/zap/pseudo 2>/dev/null
+}
+
case "$1" in
start|reload)
echo -n "$DESC: "
@@ -131,7 +144,7 @@
# If there is no zaptel timing source, load
# ztdummy. Other modules should have been loaded by
# now.
- if ! head -c 0 /dev/zap/pseudo 2>/dev/null
+ if ! test_zaptel_timing
then modprobe ztdummy || true # will fail if there is no module package
fi
if [ -r /etc/fxotune.conf ] && [ -x $FXOTUNE ]; then
@@ -148,14 +161,16 @@
unload)
unload_module zaptel
;;
+ status)
+ check_zaptel_timing
+ ;;
force-reload|restart)
# there's no 'stop'
$0 start
;;
*)
N=/etc/init.d/$NAME
- # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
- echo "Usage: $N {start|stop|restart|force-reload}" >&2
+ echo "Usage: $N {start|stop|restart|force-reload|status|unload}" >&2
exit 1
;;
esac
More information about the Pkg-voip-commits
mailing list