#!/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. if [ -r /etc/default/gpsd ]; then . /etc/default/gpsd elif [ -r /etc/sysconfig/gpsd ]; then . /etc/sysconfig/gpsd 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 # This was formerly in /lib/udev/hotplug.functions wait_for_file() { [ -e "$1" ] && return 0 local count=0 while sleep 1; do count=$(( $count + 1 )) [ -e "$1" ] && return 0 if [ $count -gt 60 ]; then return 1 fi done } # wait for /usr & /var to be mounted wait_for_file /usr/bin/python && \ wait_for_file /var/run && \ exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"