62 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-01-14 11:35:39 +00:00
#!/bin/sh
# postinst script for mobilizon.
#
# See: dh_installdeb(1).
set -e
2024-01-14 11:27:41 +00:00
# Load debconf
. /usr/share/debconf/confmodule
2024-01-14 11:35:39 +00:00
case "$1" in
configure)
# TODO create system user
if ! getent passwd mobilizon >/dev/null; then
adduser \
--disabled-password \
--quiet \
--system \
--home /usr/share/mobilizon \
--no-create-home \
--gecos "Mobilizon server" \
--group \
mobilizon
fi
2024-01-14 11:27:41 +00:00
# Use debconf values to initialize config.exs
db_get mobilizon/domain_name
sed -i "s/__DOMAIN_NAME__/${RET}/" /etc/mobilizon/config.exs
db_get mobilizon/listen_port
sed -i "s/__LISTEN_PORT__/${RET}/" /etc/mobilizon/config.exs
db_get mobilizon/db_host
sed -i "s/__DB_HOST__/${RET}/" /etc/mobilizon/config.exs
db_get mobilizon/db_name
sed -i "s/__DB_NAME__/${RET}/" /etc/mobilizon/config.exs
db_get mobilizon/db_username
sed -i "s/__DB_USERNAME__/${RET}/" /etc/mobilizon/config.exs
db_get mobilizon/db_userpass
sed -i "s/__DB_USERPASS__/${RET}/" /etc/mobilizon/config.exs
2024-01-14 11:35:39 +00:00
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument '$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0