summaryrefslogtreecommitdiff
path: root/gpsd.hotplug.wrapper
blob: 29902154441c9966d19c71920da28b8891e38ca2 (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
36
37
38
#!/bin/sh
#
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.

PATH=/usr/sbin:$PATH
export PATH

if [ -r /etc/default/gpsd ]; then
  . /etc/default/gpsd
elif [ -r /etc/sysconfig/gpsd ]; then
  . /etc/sysconfig/gpsd
  GPSD_OPTIONS=$OPTIONS
  GPSD_SOCKET=$CONTROL_SOCKET
fi

if [ -n "$GPSD_OPTIONS" ]; then
  export GPSD_OPTIONS
fi
if [ -n "$GPSD_SOCKET" ]; then
  export GPSD_SOCKET
fi

if [ -n "$USBAUTO" ]; then
  [ "$USBAUTO" = "true" ] || exit 0
fi

if [ "$ACTION" = "remove" ] ; then
  if echo $DEVLINKS | grep -q /dev/gps; then
    exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"
  fi
  exit 0
fi

if [ -x /usr/bin/python ]; then
  exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"
fi