SHA256
1
0
forked from pool/rp-pppoe
rp-pppoe/init-suse.diff

88 lines
2.3 KiB
Diff
Raw Normal View History

--- scripts/pppoe-init-suse.in
+++ scripts/pppoe-init-suse.in
@@ -12,9 +12,19 @@
# 2 or any later version.
# Modifed to work with SuSE 6.4 linux by Gary Cameron.
#
-# Source function library.
-#. /etc/rc.d/init.d/functions # For red hat?
-. /etc/rc.config # For SuSE, enables setting from /etc/rc.config
+# Modifed and fixed to work with SuSE linux by Anas Nashif <nashif@suse.de>
+
+### BEGIN INIT INFO
+# Provides: rp-pppoe
+# Required-Start: $remote_fs $syslog $network $named
+# Required-Stop: $syslog $remote_fs
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Start Roaring Penguin ADSL
+# Description: Start Roaring Penguin ADSL
+### END INIT INFO
+
+. /etc/rc.status
#Tweak this
restart_time=120
@@ -28,21 +38,27 @@
STOP=@sbindir@/pppoe-stop
STATUS=@sbindir@/pppoe-status
-test "$PPPoE_START" = "yes" || exit 0
-
# The echo return value for success (defined in /etc/rc.config).
-return=$rc_done
case "$1" in
start)
echo -n "Bringing up PPPoE link"
- $START > /dev/null 2>&1 || return=$rc_failed
- echo -e "$return"
+ $START > /dev/null 2>&1
+ rc_status -v
;;
stop)
echo -n "Shutting down PPPoE link"
- $STOP > /dev/null 2>&1 || return=$rc_failed
- echo -e "$return"
+ $STOP > /dev/null 2>&1
+ rc_status -v
+ ;;
+
+ try-restart)
+ ## Stop the service and if this succeeds (i.e. the
+ ## service was running before), start it again.
+ $0 stop && $0 start
+
+ # Remember status and be quiet
+ rc_status
;;
restart)
@@ -50,15 +66,23 @@
echo "Waiting" $restart_time "seconds for the host to reset itself"
sleep $restart_time #Note: Need time for host to reset itself
$0 start
+ rc_status
;;
status)
- $STATUS
+ checkproc /usr/sbin/pppoe; rc=$?
+ if test $rc = 0; then echo "OK"
+ else echo "No process"
+ if test -e /var/run/pppoe.conf-adsl.pid.pppoe;
+ then exit 1
+ else exit 3
+ fi
+ fi
;;
*)
- echo "Usage: pppoe {start|stop|restart|status}"
+ echo "Usage: pppoe {start|stop|restart|status|try-restart}"
exit 1
esac
+rc_exit
-exit 0