wiedehopf / tar1090

Provides an improved webinterface for use with ADS-B decoders readsb / dump1090-fa
Other
1.27k stars 237 forks source link

Bugfix - add trailing slash to install script, enabling `jq` to be installed where it is not already present #242

Closed MysterAitch closed 1 year ago

MysterAitch commented 1 year ago

Notes I noted recently that a fresh install to a rasperry pi / raspbian OS did not install jq.

jq not being installed as part of the normal install process appears to be due to an omitted trailing slash when specifying the string to pass into read (the trailing token is required to denote the end of the last item).

This pull request inserts that trailing slash.

For reference/convenience, these are the relevant lines within install.sh.

## https://github.com/wiedehopf/tar1090/blob/994d4ee08c6c9749a156c5b1a88b83e4b85b6c73/install.sh#L32C1-L34
# terminate with /
command_package="git git/jq jq"
packages=()

Test script To test/validate this, here is a slightly tweaked copy of the script which allows for toggling between the slash being present or not and the each branch of the if to be printed to the console.

# terminate with /
command_package="git git/jq jq"
#command_package="git git/jq jq/"
packages=()

while read -r -d '/' CMD PKG
do
    if ! command -v "$CMD" &>/dev/null
    then
        echo "command $CMD not found, will try to install package $PKG"
        packages+=("$PKG")
    else
        echo "command $CMD found, package $PKG not required"
        true
    fi
done < <(echo "$command_package")

Terminal output Note that without the trailing slash, jq is neither required nor found to be absent (meaning that it failed to be read).

pi@raspberry:~ $ ./script--no_trailing_slash.sh
command git found, package git not required

pi@raspberry:~ $ ./script--trailing_slash.sh
command git found, package git not required
command jq not found, will try to install package jq

pi@raspberry:~ $
mpentler commented 1 year ago

I think I have also had this but will confirm off a fresh install of raspbian lite + readsb + tar1090 tomorrow.