#!/bin/sh NAME=dump1090-mutability CONFIGFILE=/etc/default/$NAME set -e . /usr/share/debconf/confmodule db_set_yn() { if [ "x$2" = "xyes" ]; then db_set $1 true; else db_set $1 false; fi } # Load config file, if it exists. if [ -e $CONFIGFILE ]; then . $CONFIGFILE || true # Store values from config file into # debconf db. db_set_yn $NAME/auto-start "$START_DUMP1090" db_set $NAME/run-as-user "$DUMP1090_USER" db_set $NAME/log-file "$LOGFILE" db_set $NAME/rtlsdr-device "$DEVICE" db_set $NAME/rtlsdr-gain "$GAIN" db_set $NAME/rtlsdr-ppm "$PPM" db_set_yn $NAME/rtlsdr-oversample "$OVERSAMPLE" db_set_yn $NAME/decode-fixcrc "$FIX_CRC" db_set_yn $NAME/decode-phase-enhance "$PHASE_ENHANCE" db_set_yn $NAME/decode-aggressive "$AGGRESSIVE" db_set $NAME/decode-lat "$LAT" db_set $NAME/decode-lon "$LON" db_set $NAME/net-http-port "$HTTP_PORT" db_set $NAME/net-ri-port "$RAW_INPUT_PORT" db_set $NAME/net-ro-port "$RAW_OUTPUT_PORT" db_set $NAME/net-bi-port "$BEAST_INPUT_PORT" db_set $NAME/net-bo-port "$BEAST_OUTPUT_PORT" db_set $NAME/net-sbs-port "$SBS_OUTPUT_PORT" db_set $NAME/net-fatsv-port "$FATSV_OUTPUT_PORT" db_set $NAME/net-heartbeat "$NET_HEARTBEAT" db_set $NAME/net-out-size "$NET_OUTPUT_SIZE" db_set $NAME/net-out-interval "$NET_OUTPUT_INTERVAL" db_set $NAME/net-buffer "$NET_BUFFER" db_set $NAME/net-bind-address "$NET_BIND_ADDRESS" db_set $NAME/stats-interval "$STATS_INTERVAL" db_set $NAME/json-dir "$JSON_DIR" db_set $NAME/json-interval "$JSON_INTERVAL" db_set $NAME/extra-args "$EXTRA_ARGS" fi # Ask questions. db_input high $NAME/auto-start || true db_go || true; db_get $NAME/auto-start; if [ "$RET" = "true" ]; then # all of these are only relevant if the init script is enabled db_input low $NAME/run-as-user || true db_input low $NAME/log-file || true db_input medium $NAME/rtlsdr-device || true db_go || true; db_get $NAME/rtlsdr-device; if [ "x$RET" != "xnone" ]; then # only if a real device was chosen: db_input medium $NAME/rtlsdr-gain || true db_input medium $NAME/rtlsdr-ppm || true db_input low $NAME/rtlsdr-oversample || true fi db_input low $NAME/decode-fix-crc || true db_input low $NAME/decode-aggressive || true db_input medium $NAME/decode-lat || true db_go || true; db_get $NAME/decode-lat; if [ -n "$RET" ]; then # only if latitude was given: db_input medium $NAME/decode-lon || true fi db_input medium $NAME/net-http-port || true db_input low $NAME/net-ri-port || true db_input low $NAME/net-ro-port || true db_input low $NAME/net-bi-port || true db_input low $NAME/net-bo-port || true db_input low $NAME/net-sbs-port || true db_input low $NAME/net-fatsv-port || true db_input low $NAME/net-heartbeat || true db_input low $NAME/net-out-size || true db_input low $NAME/net-out-interval || true db_input low $NAME/net-buffer || true db_input medium $NAME/net-bind-address || true db_input low $NAME/stats-interval || true db_input low $NAME/json-interval || true db_go || true; db_get $NAME/json-interval; if [ -n "$RET" ] && [ "$RET" -gt 0 ]; then # only if json-interval was given and non-zero db_input low $NAME/json-dir || true fi db_input low $NAME/extra-args || true db_go || True fi # Done. db_stop