summaryrefslogtreecommitdiff
blob: 05bdf97c58b6e534853e1c9f8d511eeb4d8fa207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/files/gpsd.init,v 1.5 2007/01/14 23:01:11 nerdboy Exp $

# You can use this init script to manage a serial port GPS or other
# non-hotplug device (or any device for that matter).  By design,
# USB devices should use the hotplug script instead.

depend() {
	after serial hotplug
	before ntpd
}

checkconfig() {
	if [ -z "${GPS_DEV}" ]; then
	    eerror "You must define GPS_DEV in /etc/conf.d/gpsd."
	    return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting gpsd"
	touch /var/run/gpsd.pid
	/usr/sbin/gpsd ${GPSD_OPTS} ${GPS_DEV}
	eend $? "Failed to start gpsd"
}

stop() {
	ebegin "Stopping gpsd"
	killall -q gpsd >/dev/null
	eend $? "Failed to stop gpsd"
	rm -f /var/run/gpsd.pid
}