mirror of
https://github.com/gryf/wicd.git
synced 2025-12-21 13:28:08 +01:00
Updated setup.py to pick which initscript to install based on the distro detected. Updated MANIFEST.in to make sure launchdaemon.sh is included in the sdist build. Fixed a bunch of crash bugs in tool detection system when tools are detected. Made tool detection work correctly when "which" returns output if no match is found (as opposed to no output). Eventually we might want to hardcode possible paths instead of using which at all... Fixed some message formatting in the daemon. Added some docstrings. Added a pidfile system for increased initscript compatibility (sort of, it's somewhat incomplete).
76 lines
1.5 KiB
Bash
76 lines
1.5 KiB
Bash
#!/bin/sh
|
|
#
|
|
# wicd: wicd daemon
|
|
#
|
|
# chkconfig: 345 20 89
|
|
# description: This is a daemon for managing network connections.
|
|
#
|
|
# processname: wicd
|
|
# pidfile: /var/run/wicd/wicd.pid
|
|
#
|
|
|
|
WICD_BIN=/opt/wicd/daemon.py
|
|
|
|
# Sanity checks.
|
|
[ -x $WICD_BIN ] || exit 11
|
|
|
|
# Source function library.
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
# so we can rearrange this easily
|
|
processname=$WICD_BIN
|
|
servicename=wicd
|
|
pidfile=/var/run/wicd/wicd.pid
|
|
|
|
RETVAL=0
|
|
|
|
start()
|
|
{
|
|
echo -n $"Starting wicd daemon: "
|
|
daemon --check $servicename $processname --pid-file=$pidfile
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
|
|
}
|
|
|
|
stop()
|
|
{
|
|
echo -n $"Stopping wicd daemon: "
|
|
killproc -p $pidfile $servicename
|
|
RETVAL=$?
|
|
echo
|
|
if [ $RETVAL -eq 0 ]; then
|
|
rm -f /var/lock/subsys/$servicename
|
|
rm -f $pidfile
|
|
fi
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status -p $pidfile $processname
|
|
RETVAL=$?
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
condrestart)
|
|
if [ -f /var/lock/subsys/$servicename ]; then
|
|
stop
|
|
start
|
|
fi
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
|
|
;;
|
|
esac
|
|
exit $RETVAL
|
|
|