]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gpsd/files/gpsd
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gpsd / files / gpsd
1 #!/bin/sh
2 #
3 # gpsd  This shell script starts and stops gpsd.
4 #
5 # chkconfig: 345 90 40
6 # description: Gpsd manages access to a serial- or USB-connected GPS
7 # processname: gpsd
8
9 # If you must specify a non-NMEA driver, uncomment and modify the next line
10 #GPSD_OPTS=
11 GPS_DEV="/dev/ttyS3"
12
13 # Source function library.
14 #. /etc/rc.d/init.d/functions
15
16 RETVAL=0
17 prog="gpsd"
18
19 start() {
20         # Start daemons.
21         echo -n "Starting $prog: "
22         # We don't use the daemon function here because of a known bug
23         # in initlog -- it spuriously returns a nonzero status when 
24         # starting daemons that fork themselves.  See
25         # http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130629
26         # for discussion.  Fortunately:
27         #
28         # 1. gpsd startup can't fail, or at least not in the absence of
29         # much larger resource-exhaustion problems that would be very obvious.
30         #
31         # 2. We don't need all the logging crud that daemon/initlog sets
32         # up -- gpsd does its own syslog calls.
33         #
34         if [ -e "${GPS_DEV}" ]
35         then
36             gpsd ${GPSD_OPTS} -p ${GPS_DEV}
37              echo "success"
38         else
39             # User needs to symlink ${GPS_DEV} to the right thing
40             echo "No ${GPS_DEV} device, aborting gpsd startup."
41         fi
42         RETVAL=$?
43         echo
44         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/gpsd
45         return $RETVAL
46 }
47
48 stop() {
49         # Stop daemons.
50         echo -n "Shutting down $prog: "
51         killall gpsd
52 #        killproc gpsd
53         RETVAL=$?
54         echo
55         if [ $RETVAL -eq 0 ]
56         then
57             rm -f /var/lock/subsys/gpsd;
58         fi
59         return $RETVAL
60 }
61
62 # See how we were called.
63 case "$1" in
64   start)
65         start
66         ;;
67   stop)
68         stop
69         ;;
70   restart|reload)
71         stop
72         start
73         RETVAL=$?
74         ;;
75   condrestart)
76         if [ -f /var/lock/subsys/gpsd ]; then
77             stop
78             start
79             RETVAL=$?
80         fi
81         ;;
82   status)
83 #       status gpsd
84 #       RETVAL=$?
85         ;;
86   *)
87         echo "Usage: $0 {start|stop|restart|condrestart|status}"
88         exit 1
89 esac
90
91 exit $RETVAL