From 49ed9f62514447f5a3f33574bde4715c99071b9b Mon Sep 17 00:00:00 2001 From: Andrew Psaltis Date: Tue, 29 Dec 2009 21:22:23 -0500 Subject: [PATCH] Modified two initscripts to support wicd -k, made wicd -k have a non-zero exit code if it can't find a daemon to kill. --- in/init=redhat=wicd.in | 26 ++++++++++++++++++++++---- in/init=slackware=rc.wicd.in | 15 ++++++++++++--- in/man=wicd-curses.8.in | 2 +- wicd/wicd-daemon.py | 4 ++-- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/in/init=redhat=wicd.in b/in/init=redhat=wicd.in index 4153a38..12c68c7 100755 --- a/in/init=redhat=wicd.in +++ b/in/init=redhat=wicd.in @@ -22,13 +22,28 @@ start() echo [ "$RETVAL" = "0" ] && touch /var/lock/subsys/$servicename } -stop() +stop() +{ + echo -n "Stopping wicd service and closing connections: " + $WICD_BIN -k + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + echo_success + rm -f /var/lock/subsys/$servicename + rm -f $pidfile + else + echo_failure + fi + echo +} + +force_stop() { echo -n "Stopping wicd service: " killproc -p $pidfile wicd RETVAL=$? echo - if [ $RETVAL -eq 0 ]; then + if [ $retval -eq 0 ]; then rm -f /var/lock/subsys/$servicename rm -f $pidfile fi @@ -42,16 +57,19 @@ case "$1" in stop) stop ;; + force_stop) + force_stop + ;; status) status -p $pidfile $processname RETVAL=$? ;; restart | reload) - stop + force_stop start ;; *) - echo "Usage: wicd {start|stop|status|reload|restart}" + echo "Usage: wicd {start|stop|force_stop|status|reload|restart}" exit 1 ;; esac diff --git a/in/init=slackware=rc.wicd.in b/in/init=slackware=rc.wicd.in index 69c3f77..0f6d226 100755 --- a/in/init=slackware=rc.wicd.in +++ b/in/init=slackware=rc.wicd.in @@ -3,7 +3,7 @@ # /etc/rc.d/rc.wicd # Start/stop/restart the Wicd daemon -# This is defined in /usr/lib/python2.5/site-packages/wicd/wpath.py +# This is defined in /usr/lib/python2.6/site-packages/wicd/wpath.py PIDFILE="%PIDFILE%" DAEMON="%SBIN%wicd" @@ -21,7 +21,7 @@ wicd_start() { fi } -wicd_stop() { +wicd_force_stop() { echo "Stopping wicd daemon..." if [ -e $PIDFILE ]; then kill $(cat $PIDFILE) 2>/dev/null @@ -31,6 +31,12 @@ wicd_stop() { fi } +wicd_stop() { + echo "Stopping wicd daemon and closing connections..." + $DAEMON -k +} + + # See how we were called and take appropriate action case $1 in @@ -40,8 +46,11 @@ case $1 in stop) wicd_stop ;; - restart) + force_stop) wicd_stop + ;; + restart) + wicd_force_stop wicd_start ;; *) diff --git a/in/man=wicd-curses.8.in b/in/man=wicd-curses.8.in index c94c148..e69ca44 100644 --- a/in/man=wicd-curses.8.in +++ b/in/man=wicd-curses.8.in @@ -1,5 +1,5 @@ .\" First revision was r203 -.TH WICD-CURSES "8" "April 2009" "wicd-curses-%CURSES_REVNO%" +.TH WICD-CURSES "8" "December 2009" "wicd-curses-%CURSES_REVNO%" .SH NAME .B wicd-curses \- curses-based wicd(8) controller diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 2c2852a..4fbc478 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -1742,8 +1742,8 @@ def main(argv): try: f = open(wpath.pidfile) except: - print >> sys.stderr, "No wicd instance active, aborting." - sys.exit(0) + #print >> sys.stderr, "No wicd instance active, aborting." + sys.exit(1) from wicd import dbusmanager bus = dbusmanager.connect_to_dbus() dbus_ifaces = dbusmanager.get_dbus_ifaces()