Initial commit: Uploaded everything from abs/core
[arch-rock.git] / support / ipw3945d / ipw3945d.rc
blobb0e02bb6b81ee71990e155f1db4a458176bbbcaa
2 #!/bin/bash
4 . /etc/rc.conf
5 . /etc/rc.d/functions
7 PID=`pidof -o %PPID /sbin/ipw3945d`
8 case "$1" in
9   start)
10     stat_busy "Starting IPW3945d"
11     [ -z "$PID" ] && /sbin/ipw3945d --quiet
12     if [ $? -gt 0 ]; then
13       stat_fail
14     else
15       echo `pidof -o %PPID /sbin/ipw3945d` > /var/run/ipw3945d.pid
16       add_daemon ipw3945d
17       sleep 1 # not good, but daemon needs time to upload to card, otherwise network fails.
18       stat_done
19     fi
20       
21     sleep 0.5
22     ;;
23   stop)
24     stat_busy "Stopping IPW3945d"
25     [ ! -z "$PID" ]  && /sbin/ipw3945d --kill
26     if [ $? -gt 0 ]; then
27       stat_fail
28     else
29       rm_daemon ipw3945d
30       stat_done
31     fi
32     ;;
33   restart)
34     $0 stop
35     sleep 1
36     $0 start
37     ;;
38   *)
39     echo "usage: $0 {start|stop|restart}" 
40 esac
41 exit 0