changeset 373:62b17f6d0269 noffle

[svn] made init script LSB compliant
author godisch
date Wed, 02 Apr 2003 22:58:16 +0100
parents 458aa509ca0f
children 11cca625263f
files debian/changelog debian/init
diffstat 2 files changed, 38 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/debian/changelog	Wed Apr 02 12:06:23 2003 +0100
+++ b/debian/changelog	Wed Apr 02 22:58:16 2003 +0100
@@ -1,8 +1,8 @@
 noffle (1.1.4-5.cvs20030402) unstable; urgency=low
 
-  * Fixed init script.
+  * Made init script LSB compliant.
 
- -- Martin A. Godisch <godisch@debian.org>  Wed, 02 Apr 2003 13:06:07 +0200
+ -- Martin A. Godisch <godisch@debian.org>  Wed, 02 Apr 2003 23:57:52 +0200
 
 noffle (1.1.4-5) unstable; urgency=low
 
--- a/debian/init	Wed Apr 02 12:06:23 2003 +0100
+++ b/debian/init	Wed Apr 02 22:58:16 2003 +0100
@@ -1,9 +1,24 @@
 #!/bin/sh
-# $Id: init 511 2003-04-02 11:05:33Z godisch $
+# $Id: init 513 2003-04-02 21:58:16Z godisch $
 
 set -e
+
+PATH="/bin:/usr/bin:/sbin:/usr/sbin"
 NOFFLE=/usr/bin/noffle
-[ -x "$NOFFLE" ] || exit 0
+
+help () {
+	echo "Usage: /etc/init.d/noffle { online | offline }" >&2
+}
+
+if [ ! -x "$NOFFLE" ]; then
+	echo "Cannot execute noffle: program not found." >&2
+	exit 5 # LSB: program is not installed
+fi
+
+if [ "$2" ]; then
+	help
+	exit 2 # LSB: invalid or excess argument(s)
+fi
 
 if [ -x /usr/sbin/pppd ]; then
 	NOFFLE_FETCHMODE="ppp"
@@ -15,12 +30,8 @@
 fi
 
 case "$1" in
-online|offline)
-	echo "Switching offline news server to $1 mode: noffle."
-	$NOFFLE --$1
-	;;
 start)
-	echo "Initializing offline news server: noffle."
+	echo -n "Initializing offline news server: noffle"
 	if [ "$NOFFLE_FETCHMODE" = ppp ]; then
 		$NOFFLE --offline
 	else
@@ -28,14 +39,28 @@
 	fi
 	;;
 stop)
-	$0 offline
+	echo -n "Switching offline news server into offline mode: noffle"
+	$NOFFLE --offline
+	;;
+restart)
+	echo -n "Restarting offline news server: noffle"
 	;;
-reload|force-reload|restart)
+reload|force-reload)
+	echo -n "Reloading offline news server configuration: noffle"
+	;;
+status)
+	help
+	exit 4 # LSB: program or service status is unknown
+	;;
+online|offline)
+	echo -n "Switching offline news server into $1 mode: noffle"
+	$NOFFLE --$1
 	;;
 *)
-	echo "Usage: $0 {start|stop|online|offline}" >&2
-	exit 1
+	help
+	exit 2 # LSB: invalid or excess argument(s)
 	;;
 esac
+echo "."
 
 exit 0