add postinst/postrm integration

This commit is contained in:
Jakob Ketterl 2021-02-18 00:13:58 +01:00
parent f488a01c78
commit 8fcfa689ae
2 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
. /usr/share/debconf/confmodule
OWRX_USER="openwebrx" OWRX_USER="openwebrx"
OWRX_DATADIR="/var/lib/openwebrx" OWRX_DATADIR="/var/lib/openwebrx"
@ -14,7 +16,12 @@ case "$1" in
chown "${OWRX_USER}". ${OWRX_DATADIR} chown "${OWRX_USER}". ${OWRX_DATADIR}
# create initial openwebrx user # create initial openwebrx user
openwebrx-admin --noninteractive --silent adduser admin db_get openwebrx/admin_user_password
if [ "${RET}" != "__DONE__" ]; then
OWRX_PASSWORD="${RET}" openwebrx-admin --noninteractive --silent adduser admin
fi
# remove actual password from debconf database, but leave a marker
db_set openwebrx/admin_user_password "__DONE__"
;; ;;
*) *)
echo "postinst called with unknown argument '$1'" 1>&2 echo "postinst called with unknown argument '$1'" 1>&2

6
debian/openwebrx.postrm vendored Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh -e
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi