initialize settings

This commit is contained in:
Jakob Ketterl 2021-04-26 20:10:44 +02:00
parent 4691987cc4
commit 7962da9454

View File

@ -6,6 +6,7 @@ set -euo pipefail
OWRX_USER="openwebrx" OWRX_USER="openwebrx"
OWRX_DATADIR="/var/lib/openwebrx" OWRX_DATADIR="/var/lib/openwebrx"
OWRX_USERS_FILE="${OWRX_DATADIR}/users.json" OWRX_USERS_FILE="${OWRX_DATADIR}/users.json"
OWRX_SETTINGS_FILE="${OWRX_DATADIR}/settings.json"
case "$1" in case "$1" in
configure|reconfigure) configure|reconfigure)
@ -23,6 +24,12 @@ case "$1" in
chmod 0600 "${OWRX_USERS_FILE}" chmod 0600 "${OWRX_USERS_FILE}"
fi fi
if [ ! -e "${OWRX_SETTINGS_FILE}" ]; then
# create an empty settings file now to avoid permission problems later
echo "{}" > "${OWRX_SETTINGS_FILE}"
chown "${OWRX_USER}". "${OWRX_SETTINGS_FILE}"
fi
db_get openwebrx/admin_user_password db_get openwebrx/admin_user_password
if [ ! -z "${RET}" ]; then if [ ! -z "${RET}" ]; then
if ! openwebrx admin --silent hasuser admin; then if ! openwebrx admin --silent hasuser admin; then