From 7765abf9b524d90e4a09610247268b83c135a8c1 Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Wed, 28 Jan 2009 19:28:05 -0600 Subject: [PATCH] Merged changes from svenstaro to the Arch init script, and then did some cleanup edits in this tree. --- in/init=arch=wicd.in | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/in/init=arch=wicd.in b/in/init=arch=wicd.in index 5e5b114..fbfdb75 100755 --- a/in/init=arch=wicd.in +++ b/in/init=arch=wicd.in @@ -1,26 +1,39 @@ #!/bin/bash -# borrowed from -# http://repos.archlinux.org/viewvc.cgi/wicd/repos/extra-i686/wicd-daemon?revision=1&view=markup -# and modified for 1.5.0 +# Arch init script for wicd . /etc/rc.conf . /etc/rc.d/functions +WICD_BIN=%SBIN%wicd + +if [ -f /var/run/wicd/wicd.pid ]; then + PID="$(cat /var/run/wicd/wicd.pid)" +fi + case "$1" in start) stat_busy "Starting wicd Daemon" - killall wicd &> /dev/null - %SBIN%wicd-daemon &> /dev/null - add_daemon wicd - stat_done - ;; + if [ -z "$PID" ]; then + $WICD_BIN &> /dev/null + fi + if [ ! -z "$PID" -o $? -gt 0 ]; then + stat_fail + else + add_daemon wicd + stat_done + fi + ;; stop) stat_busy "Stopping wicd Daemon" - killall wicd &> /dev/null - rm_daemon wicd - stat_done - ;; + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon wicd + stat_done + fi + ;; restart) $0 stop sleep 1 @@ -29,5 +42,6 @@ case "$1" in *) echo "usage: $0 {start|stop|restart}" esac + exit 0