make shellcheck happy
correct slight bug from last commit
This commit is contained in:
2
default
2
default
@@ -9,7 +9,7 @@ HISTORY_SIZE=450
|
|||||||
# Change to yes to enable UAT/978 display in tar1090
|
# Change to yes to enable UAT/978 display in tar1090
|
||||||
ENABLE_978=no
|
ENABLE_978=no
|
||||||
# If running dump978-fa on another computer, modify the IP-address as appropriate.
|
# If running dump978-fa on another computer, modify the IP-address as appropriate.
|
||||||
# The URL needs to point at where you would normally find the skyview978 webinterface
|
# The URL needs to point at where you would normally find the skyaware978 webinterface
|
||||||
URL_978="http://127.0.0.1/skyaware978"
|
URL_978="http://127.0.0.1/skyaware978"
|
||||||
|
|
||||||
# 1-9 are valid, lower lvl: less CPU usage, higher level: less network bandwidth used when loading the page
|
# 1-9 are valid, lower lvl: less CPU usage, higher level: less network bandwidth used when loading the page
|
||||||
|
|||||||
66
install.sh
66
install.sh
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# shellcheck shell=bash disable=SC2016
|
||||||
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
trap 'echo "[ERROR] Error in line $LINENO when executing: $BASH_COMMAND"' ERR
|
trap 'echo "[ERROR] Error in line $LINENO when executing: $BASH_COMMAND"' ERR
|
||||||
@@ -19,13 +21,12 @@ if [[ -n "$3" ]]; then ipath="$3"; fi
|
|||||||
lighttpd=no
|
lighttpd=no
|
||||||
nginx=no
|
nginx=no
|
||||||
function useSystemd () { command -v systemd &>/dev/null; }
|
function useSystemd () { command -v systemd &>/dev/null; }
|
||||||
function useSystemd () { return 1; }
|
|
||||||
|
|
||||||
mkdir -p $ipath
|
mkdir -p "$ipath"
|
||||||
|
|
||||||
if useSystemd && ! id -u tar1090 &>/dev/null
|
if useSystemd && ! id -u tar1090 &>/dev/null
|
||||||
then
|
then
|
||||||
adduser --system --home $ipath --no-create-home --quiet tar1090 || adduser --system --home-dir $ipath --no-create-home tar1090
|
adduser --system --home "$ipath" --no-create-home --quiet tar1090 || adduser --system --home-dir "$ipath" --no-create-home tar1090
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# terminate with /
|
# terminate with /
|
||||||
@@ -107,7 +108,7 @@ if ! { [[ "$1" == "test" ]] && cd "$ipath/git-db"; }; then
|
|||||||
getGIT "$db_repo" "master" "$ipath/git-db" || true
|
getGIT "$db_repo" "master" "$ipath/git-db" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! cd $ipath/git-db
|
if ! cd "$ipath/git-db"
|
||||||
then
|
then
|
||||||
echo "Unable to download files, exiting! (Maybe try again?)"
|
echo "Unable to download files, exiting! (Maybe try again?)"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -190,16 +191,18 @@ if ! diff tar1090.sh "$ipath"/tar1090.sh &>/dev/null; then
|
|||||||
else
|
else
|
||||||
service="tar1090"
|
service="tar1090"
|
||||||
fi
|
fi
|
||||||
useSystemd && systemctl stop $service 2>/dev/null || true
|
if useSystemd; then
|
||||||
|
systemctl stop "$service" 2>/dev/null || true
|
||||||
|
fi
|
||||||
done < <(echo "$instances")
|
done < <(echo "$instances")
|
||||||
cp tar1090.sh $ipath
|
cp tar1090.sh "$ipath"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# copy over base files
|
# copy over base files
|
||||||
cp install.sh uninstall.sh getupintheair.sh LICENSE README.md $ipath
|
cp install.sh uninstall.sh getupintheair.sh LICENSE README.md "$ipath"
|
||||||
cp default $ipath/example_config_dont_edit
|
cp default "$ipath/example_config_dont_edit"
|
||||||
rm -f $ipath/default
|
rm -f "$ipath/default"
|
||||||
|
|
||||||
# create 95-tar1090-otherport.conf
|
# create 95-tar1090-otherport.conf
|
||||||
{
|
{
|
||||||
@@ -230,26 +233,25 @@ do
|
|||||||
html_path="$ipath/html"
|
html_path="$ipath/html"
|
||||||
service="tar1090"
|
service="tar1090"
|
||||||
fi
|
fi
|
||||||
services+="$service "
|
services+=("$service")
|
||||||
names+="$instance "
|
names+="$instance "
|
||||||
|
|
||||||
# don't overwrite existing configuration
|
# don't overwrite existing configuration
|
||||||
cp -n default /etc/default/$service
|
useSystemd && cp -n default /etc/default/"$service"
|
||||||
sed -i -e 's/skyview978/skyaware978/' /etc/default/$service
|
|
||||||
|
|
||||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?${service}?g" \
|
||||||
-e "s?/INSTANCE??g" -e "s?HTMLPATH?$html_path?g" 95-tar1090-otherport.conf
|
-e "s?/INSTANCE??g" -e "s?HTMLPATH?$html_path?g" 95-tar1090-otherport.conf
|
||||||
|
|
||||||
if [[ "$instance" == "webroot" ]]; then
|
if [[ "$instance" == "webroot" ]]; then
|
||||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?${service}?g" \
|
||||||
-e "s?/INSTANCE??g" -e "s?HTMLPATH?$html_path?g" 88-tar1090.conf
|
-e "s?/INSTANCE??g" -e "s?HTMLPATH?$html_path?g" 88-tar1090.conf
|
||||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?${service}?g" \
|
||||||
-e "s?/INSTANCE/?/?g" -e "s?HTMLPATH?$html_path?g" nginx.conf
|
-e "s?/INSTANCE/?/?g" -e "s?HTMLPATH?$html_path?g" nginx.conf
|
||||||
sed -i -e "s?/INSTANCE?/?g" nginx.conf
|
sed -i -e "s?/INSTANCE?/?g" nginx.conf
|
||||||
else
|
else
|
||||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?${service}?g" \
|
||||||
-e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" 88-tar1090.conf
|
-e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" 88-tar1090.conf
|
||||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?${service}?g" \
|
||||||
-e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" nginx.conf
|
-e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -263,7 +265,7 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" tar1090.service
|
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?${service}?g" tar1090.service
|
||||||
|
|
||||||
cp -r -T html "$TMP"
|
cp -r -T html "$TMP"
|
||||||
cp -r -T "$ipath/git-db/db" "$TMP/db-$DB_VERSION"
|
cp -r -T "$ipath/git-db/db" "$TMP/db-$DB_VERSION"
|
||||||
@@ -305,7 +307,7 @@ do
|
|||||||
|
|
||||||
cd "$dir"
|
cd "$dir"
|
||||||
|
|
||||||
cp nginx.conf "$ipath/nginx-$service.conf"
|
cp nginx.conf "$ipath/nginx-${service}.conf"
|
||||||
|
|
||||||
if [[ $lighttpd == yes ]]; then
|
if [[ $lighttpd == yes ]]; then
|
||||||
# clean up broken symlinks in conf-enabled ...
|
# clean up broken symlinks in conf-enabled ...
|
||||||
@@ -322,27 +324,27 @@ do
|
|||||||
true
|
true
|
||||||
elif [[ "$instance" == "webroot" ]]
|
elif [[ "$instance" == "webroot" ]]
|
||||||
then
|
then
|
||||||
cp 88-tar1090.conf /etc/lighttpd/conf-available/99-$service.conf
|
cp 88-tar1090.conf /etc/lighttpd/conf-available/99-"${service}".conf
|
||||||
ln -f -s /etc/lighttpd/conf-available/99-$service.conf /etc/lighttpd/conf-enabled/99-$service.conf
|
ln -f -s /etc/lighttpd/conf-available/99-"${service}".conf /etc/lighttpd/conf-enabled/99-"${service}".conf
|
||||||
else
|
else
|
||||||
cp 88-tar1090.conf /etc/lighttpd/conf-available/88-$service.conf
|
cp 88-tar1090.conf /etc/lighttpd/conf-available/88-"${service}".conf
|
||||||
ln -f -s /etc/lighttpd/conf-available/88-$service.conf /etc/lighttpd/conf-enabled/88-$service.conf
|
ln -f -s /etc/lighttpd/conf-available/88-"${service}".conf /etc/lighttpd/conf-enabled/88-"${service}".conf
|
||||||
if [ -f /etc/lighttpd/conf.d/69-skybup.conf ]; then
|
if [ -f /etc/lighttpd/conf.d/69-skybup.conf ]; then
|
||||||
mv /etc/lighttpd/conf-enabled/88-$service.conf /etc/lighttpd/conf-enabled/66-$service.conf
|
mv /etc/lighttpd/conf-enabled/88-"${service}".conf /etc/lighttpd/conf-enabled/66-"${service}".conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if useSystemd; then
|
if useSystemd; then
|
||||||
if [[ $changed == yes ]] || ! diff tar1090.service /lib/systemd/system/$service.service &>/dev/null
|
if [[ $changed == yes ]] || ! diff tar1090.service /lib/systemd/system/"${service}".service &>/dev/null
|
||||||
then
|
then
|
||||||
cp tar1090.service /lib/systemd/system/$service.service
|
cp tar1090.service /lib/systemd/system/"${service}".service
|
||||||
if systemctl enable $service
|
if systemctl enable "${service}"
|
||||||
then
|
then
|
||||||
echo "Restarting $service ..."
|
echo "Restarting ${service} ..."
|
||||||
systemctl restart $service || ! pgrep systemd
|
systemctl restart "$service" || ! pgrep systemd
|
||||||
else
|
else
|
||||||
echo "$service.service is masked, could not start it!"
|
echo "${service}.service is masked, could not start it!"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -436,8 +438,8 @@ if [[ $nginx == yes ]]; then
|
|||||||
echo
|
echo
|
||||||
echo "To configure nginx for tar1090, please add the following line(s) in the server {} section:"
|
echo "To configure nginx for tar1090, please add the following line(s) in the server {} section:"
|
||||||
echo
|
echo
|
||||||
for service in $services; do
|
for service in "${services[@]}"; do
|
||||||
echo "include ${ipath}/nginx-$service.conf;"
|
echo "include ${ipath}/nginx-${service}.conf;"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user