summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-navigation/gpsd/gpsd/gpsd.init158
-rw-r--r--meta-oe/recipes-navigation/gpsd/gpsd_3.20.bb3
2 files changed, 160 insertions, 1 deletions
diff --git a/meta-oe/recipes-navigation/gpsd/gpsd/gpsd.init b/meta-oe/recipes-navigation/gpsd/gpsd/gpsd.init
new file mode 100644
index 0000000000..c9db0bb5c2
--- /dev/null
+++ b/meta-oe/recipes-navigation/gpsd/gpsd/gpsd.init
@@ -0,0 +1,158 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: gpsd
4# Required-Start: $remote_fs $syslog $network
5# Should-Start: bluetooth dbus udev
6# Required-Stop: $remote_fs $syslog $network
7# Should-Stop:
8# Default-Start: 2 3 4 5
9# Default-Stop: 0 1 6
10# X-Start-Before: ntp
11# Short-Description: GPS (Global Positioning System) daemon start/stop script
12# Description: Start/Stop script for the gpsd service daemon,
13# which is able to monitor one or more GPS devices
14# connected to a host computer, making all data on
15# the location and movements of the sensors available
16# to be queried on TCP port 2947.
17### END INIT INFO
18
19
20# PATH should only include /usr/* if it runs after the mountnfs.sh script
21PATH=/sbin:/usr/sbin:/bin:/usr/bin
22
23DESC="GPS (Global Positioning System) daemon"
24NAME="gpsd"
25DAEMON=/usr/sbin/$NAME
26PIDFILE=/var/run/$NAME.pid
27
28. /etc/init.d/functions || exit 1
29
30# Exit if the package is not installed
31[ -x "$DAEMON" ] || exit 0
32
33# Read configuration variable file if it is present
34[ -r /etc/default/$NAME ] && . /etc/default/$NAME
35
36if [ -z "$GPSD_SOCKET" ] && [ -z "$DEVICES" ]; then
37 GPSD_SOCKET=/var/run/gpsd.sock
38fi
39
40if [ -n "$GPSD_SOCKET" ]; then
41 GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET"
42fi
43
44DAEMON_ARGS="$GPSD_OPTIONS $DEVICES"
45
46#
47# Function that starts the daemon/service
48#
49do_start() {
50 local status pid
51
52 status=0
53 pid=`pidofproc $NAME` || status=$?
54 case $status in
55 0)
56 echo "$DESC already running ($pid)."
57 exit 1
58 ;;
59 *)
60 echo "Starting $DESC ..."
61 exec $DAEMON $DAEMON_ARGS >/dev/null 2>&1 || status=$?
62 echo "ERROR: Failed to start $DESC."
63 exit $status
64 ;;
65 esac
66}
67
68#
69# Function that stops the daemon/service
70#
71do_stop() {
72 local pid status
73
74 status=0
75 pid=`pidofproc $NAME` || status=$?
76 case $status in
77 0)
78 # Exit when fail to stop, the kill would complain when fail
79 kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \
80 echo "Stopped $DESC ($pid)." || exit $?
81 ;;
82 *)
83 echo "$DESC is not running; none killed." >&2
84 ;;
85 esac
86
87 return $status
88}
89
90#
91# Function that sends a SIGHUP to the daemon/service
92#
93do_reload() {
94 local pid status
95
96 status=0
97 # If the daemon can reload its configuration without
98 # restarting (for example, when it is sent a SIGHUP),
99 # then implement that here.
100 pid=`pidofproc $NAME` || status=$?
101 case $status in
102 0)
103 echo "Reloading $DESC ..."
104 kill -s 1 $pid || exit $?
105 ;;
106 *)
107 echo "$DESC is not running; none reloaded." >&2
108 ;;
109 esac
110 exit $status
111}
112
113
114#
115# Function that shows the daemon/service status
116#
117status_of_proc () {
118 local pid status
119
120 status=0
121 # pidof output null when no program is running, so no "2>/dev/null".
122 pid=`pidofproc $NAME` || status=$?
123 case $status in
124 0)
125 echo "$DESC is running ($pid)."
126 exit 0
127 ;;
128 *)
129 echo "$DESC is not running." >&2
130 exit $status
131 ;;
132 esac
133}
134
135case "$1" in
136start)
137 do_start
138 ;;
139stop)
140 do_stop || exit $?
141 ;;
142status)
143 status_of_proc
144 ;;
145restart)
146 # Always start the service regardless the status of do_stop
147 do_stop
148 do_start
149 ;;
150force-reload)
151 # Only start the service when do_stop succeeds
152 do_stop && do_start
153 ;;
154*)
155 echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
156 exit 3
157 ;;
158esac
diff --git a/meta-oe/recipes-navigation/gpsd/gpsd_3.20.bb b/meta-oe/recipes-navigation/gpsd/gpsd_3.20.bb
index 390e6a8c3b..3888ad8fa3 100644
--- a/meta-oe/recipes-navigation/gpsd/gpsd_3.20.bb
+++ b/meta-oe/recipes-navigation/gpsd/gpsd_3.20.bb
@@ -8,6 +8,7 @@ PROVIDES = "virtual/gpsd"
8SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ 8SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \
9 file://0001-SConstruct-prefix-includepy-with-sysroot-and-drop-sy.patch \ 9 file://0001-SConstruct-prefix-includepy-with-sysroot-and-drop-sy.patch \
10 file://0001-Revert-SConstruct-Add-test-for-sizeof-time_t-result-.patch \ 10 file://0001-Revert-SConstruct-Add-test-for-sizeof-time_t-result-.patch \
11 file://gpsd.init \
11" 12"
12SRC_URI[md5sum] = "cf7fdec7ce7221d20bee1a7246362b05" 13SRC_URI[md5sum] = "cf7fdec7ce7221d20bee1a7246362b05"
13SRC_URI[sha256sum] = "172a7805068eacb815a3c5225436fcb0be46e7e49a5001a94034eac43df85e50" 14SRC_URI[sha256sum] = "172a7805068eacb815a3c5225436fcb0be46e7e49a5001a94034eac43df85e50"
@@ -66,7 +67,7 @@ do_install() {
66 67
67do_install_append() { 68do_install_append() {
68 install -d ${D}/${sysconfdir}/init.d 69 install -d ${D}/${sysconfdir}/init.d
69 install -m 0755 ${S}/packaging/deb/etc_init.d_gpsd ${D}/${sysconfdir}/init.d/gpsd 70 install -m 0755 ${WORKDIR}/gpsd.init ${D}/${sysconfdir}/init.d/gpsd
70 install -d ${D}/${sysconfdir}/default 71 install -d ${D}/${sysconfdir}/default
71 install -m 0644 ${S}/packaging/deb/etc_default_gpsd ${D}/${sysconfdir}/default/gpsd.default 72 install -m 0644 ${S}/packaging/deb/etc_default_gpsd ${D}/${sysconfdir}/default/gpsd.default
72 73