2021-02-06 14:50:50 +00:00
|
|
|
#!/bin/bash
|
2021-02-17 23:13:58 +00:00
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
|
2021-02-17 23:22:37 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
2021-02-06 14:50:50 +00:00
|
|
|
OWRX_USER="openwebrx"
|
|
|
|
OWRX_DATADIR="/var/lib/openwebrx"
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure)
|
|
|
|
adduser --system --group --no-create-home --home /nonexistent --quiet "${OWRX_USER}"
|
|
|
|
usermod -aG plugdev openwebrx
|
|
|
|
|
|
|
|
# create OpenWebRX data directory and set the correct permissions
|
|
|
|
if [ ! -d "${OWRX_DATADIR}" ] && [ ! -L "${OWRX_DATADIR}" ]; then mkdir "${OWRX_DATADIR}"; fi
|
2021-02-10 23:24:02 +00:00
|
|
|
chown "${OWRX_USER}". ${OWRX_DATADIR}
|
2021-02-06 17:59:01 +00:00
|
|
|
|
|
|
|
# create initial openwebrx user
|
2021-02-17 23:13:58 +00:00
|
|
|
db_get openwebrx/admin_user_password
|
2021-02-18 00:12:26 +00:00
|
|
|
if [ ! -z "${RET}" ] && [ "${RET}" != "__DONE__" ]; then
|
2021-02-17 23:13:58 +00:00
|
|
|
OWRX_PASSWORD="${RET}" openwebrx-admin --noninteractive --silent adduser admin
|
2021-02-18 00:12:26 +00:00
|
|
|
# remove actual password from debconf database, but leave a marker
|
|
|
|
db_set openwebrx/admin_user_password "__DONE__"
|
2021-02-17 23:13:58 +00:00
|
|
|
fi
|
2021-02-06 14:50:50 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "postinst called with unknown argument '$1'" 1>&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#DEBHELPER#
|