From 1a6f738c97013f154f2f3080039a59168f7e1230 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Thu, 18 Feb 2021 18:28:12 +0100 Subject: [PATCH] fix permission problems on initial install --- debian/openwebrx.postinst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/openwebrx.postinst b/debian/openwebrx.postinst index 4ac385a..3a96d66 100755 --- a/debian/openwebrx.postinst +++ b/debian/openwebrx.postinst @@ -5,6 +5,7 @@ set -euo pipefail OWRX_USER="openwebrx" OWRX_DATADIR="/var/lib/openwebrx" +OWRX_USERS_FILE="${OWRX_DATADIR}/users.json" case "$1" in configure|reconfigure) @@ -15,9 +16,15 @@ case "$1" in if [ ! -d "${OWRX_DATADIR}" ] && [ ! -L "${OWRX_DATADIR}" ]; then mkdir "${OWRX_DATADIR}"; fi chown "${OWRX_USER}". ${OWRX_DATADIR} - # create initial openwebrx user + if [ ! -e "${OWRX_USERS_FILE}" ]; then + # create an empty users file now to avoid permission problems later + echo "[]" > "${OWRX_USERS_FILE}" + chown "${OWRX_USER}". ${$OWRX_USERS_FILE} + fi + db_get openwebrx/admin_user_password if [ ! -z "${RET}" ]; then + # create initial openwebrx user OWRX_PASSWORD="${RET}" openwebrx-admin --noninteractive adduser admin fi # remove password from debconf database