2019-01-13 21:04:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2021-02-06 20:55:47 +00:00
|
|
|
mkdir -p /etc/openwebrx/openwebrx.conf.d
|
|
|
|
mkdir -p /var/lib/openwebrx
|
2019-12-15 17:28:35 +00:00
|
|
|
mkdir -p /tmp/openwebrx/
|
2021-02-06 20:55:47 +00:00
|
|
|
if [[ ! -f /etc/openwebrx/openwebrx.conf.d/20-temporary-directory.conf ]] ; then
|
|
|
|
cat << EOF > /etc/openwebrx/openwebrx.conf.d/20-temporary-directory.conf
|
|
|
|
[core]
|
|
|
|
temporary_directory = /tmp/openwebrx
|
|
|
|
EOF
|
2019-01-13 21:04:29 +00:00
|
|
|
fi
|
2019-12-15 17:28:35 +00:00
|
|
|
if [[ ! -f /etc/openwebrx/bands.json ]] ; then
|
|
|
|
cp bands.json /etc/openwebrx/
|
|
|
|
fi
|
2021-02-06 15:38:03 +00:00
|
|
|
if [[ ! -f /etc/openwebrx/openwebrx.conf ]] ; then
|
|
|
|
cp openwebrx.conf /etc/openwebrx/
|
|
|
|
fi
|
2021-04-21 12:29:36 +00:00
|
|
|
if [[ ! -z "${OPENWEBRX_ADMIN_USER:-}" ]] && [[ ! -z "${OPENWEBRX_ADMIN_PASSWORD:-}" ]] ; then
|
2021-04-24 17:39:48 +00:00
|
|
|
if ! python3 openwebrx.py admin --silent hasuser "${OPENWEBRX_ADMIN_USER}" ; then
|
|
|
|
OWRX_PASSWORD="${OPENWEBRX_ADMIN_PASSWORD}" python3 openwebrx.py admin --noninteractive adduser "${OPENWEBRX_ADMIN_USER}"
|
2021-04-21 12:29:36 +00:00
|
|
|
fi
|
|
|
|
fi
|
2019-12-15 17:28:35 +00:00
|
|
|
|
|
|
|
|
2019-01-13 21:04:29 +00:00
|
|
|
_term() {
|
|
|
|
echo "Caught signal!"
|
|
|
|
kill -TERM "$child" 2>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
trap _term SIGTERM SIGINT
|
|
|
|
|
2019-06-20 12:46:04 +00:00
|
|
|
python3 openwebrx.py $@ &
|
2019-01-13 21:04:29 +00:00
|
|
|
|
|
|
|
child=$!
|
|
|
|
wait "$child"
|
|
|
|
|