This file is indexed.

config is in gpsd 3.9-3.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

get_socket_from_opts() {
    echo " $1 " | sed 's,.* -F *,,;s, .*,,'
}
strip_socket_from_opts() {
    echo "$1" | sed 's,-F *[^ ]*,,'
}

if [ -s /etc/default/gpsd ]; then
    . /etc/default/gpsd
    if [ -n "$START_DAEMON" ] ; then
        db_set gpsd/start_daemon "$START_DAEMON"
    fi
    if [ -n "$GPSD_OPTIONS" ]; then
	    db_set gpsd/daemon_options "$GPSD_OPTIONS"
    else
        if [ -n "$DAEMON_OPTS" ]; then
            if echo "$DAEMON_OPTS" | grep -q -- '-F'; then
                if [ -z "$GPSD_SOCKET" ]; then
                    GPSD_SOCKET=$(get_socket_from_opts "$DAEMON_OPTS")
                fi    
                DAEMON_OPTS=$(strip_socket_from_opts "$DAEMON_OPTS")
            fi
            db_set gpsd/daemon_options "$DAEMON_OPTS"
        fi
    fi
    if [ -n "$DEVICES" ] ; then
        db_set gpsd/device "$DEVICES"
    fi
    if [ -n "$USBAUTO" ]; then
        db_set gpsd/autodetection "$USBAUTO"
    fi
    if [ -n "$GPSD_SOCKET" ]; then
        db_set gpsd/socket "$GPSD_SOCKET"
    fi
fi


db_input medium gpsd/start_daemon || true
db_go
db_get gpsd/start_daemon
startd="$RET"

db_input low gpsd/autodetection || true
db_go
db_get gpsd/autodetection
autodet="$RET"

db_capb backup

STATE=3
while [ "$startd" = "true" ] || [ "$autodet" = "true" ] ; do

    case "$STATE" in
        0)
            # There is no way to go back from the
            # first question. Exit is the only sane way.
            exit 10
        ;;
        1)
            db_input low gpsd/start_daemon || true           
        ;;
        2)
            db_input low gpsd/autodetection || true
        ;;
        3)
            db_input low gpsd/device || true
        ;;
        4)
            db_input low gpsd/daemon_options || true
        ;;
        5)
            db_get gpsd/daemon_options
            opts="$RET"
            if echo "$opts" | grep -q -- '-F'; then
                db_set gpsd/socket "$(get_socket_from_opts "$opts")"
                db_set gpsd/daemon_options "$(strip_socket_from_opts "$opts" )"
            fi
            db_input low gpsd/socket || true
        ;;
        6)
            db_get gpsd/autodetection
            autodet="$RET"
            if [ "$autodet" = "true" ]; then
                db_get gpsd/socket
                socket="$RET"
                if [ -z "$socket" ]; then
                    db_set gpsd/socket "/var/run/gpsd.sock"
                fi
            fi
            break
        ;;
        *)
            break
        ;;
    esac


    OLDSTATE="$STATE"
    if db_go; then
        STATE=$(($STATE + 1))
    else
        STATE=$(($STATE - 1))
    fi

    case $OLDSTATE in
        1)
            db_get gpsd/start_daemon
            startd="$RET"
        ;;
        2)
            db_get gpsd/autodetection
            autodet="$RET"
        ;;
    esac
done