Skip to content

Commit

Permalink
Improve output of script, replace which with more reliable hash #867
Browse files Browse the repository at this point in the history
  • Loading branch information
fnoop authored and TSC21 committed Nov 20, 2017
1 parent 129f38a commit a85a5d6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mavros/scripts/install_geographiclib_datasets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Script to install the model datasets required
# to GeographicLib apply certain conversions

set -x

if [[ $UID != 0 ]]; then
echo "This script require root privilegies!" 1>&2
exit 1
Expand All @@ -17,18 +15,20 @@ run_get() {

files=$(shopt -s nullglob dotglob; echo /usr/share/GeographicLib/$dir/$model* /usr/local/share/GeographicLib/$dir/$model*)
if (( ${#files} )); then
echo "GeographicLib $tool dataset $model already exists, skipping"
return
fi

geographiclib-get-$tool $model
echo "Installing GeographicLib $tool $model"
geographiclib-get-$tool $model >/dev/null 2>&1
}

# check which command script is available
if which /usr/sbin/geographiclib-get-geoids; then
if hash geographiclib-get-geoids; then
run_get geoids geoids egm96-5
run_get gravity gravity egm96
run_get magnetic magnetic emm2015
elif which geographiclib-datasets-download; then # only allows install the goid model dataset
elif hash geographiclib-datasets-download; then # only allows install the goid model dataset
geographiclib-datasets-download egm96_5;
else
echo "OS not supported! Check GeographicLib page for supported OS and lib versions." 1>&2
Expand Down

0 comments on commit a85a5d6

Please sign in to comment.