62 lines
1.5 KiB
Bash
62 lines
1.5 KiB
Bash
#!/bin/sh
|
|
# postinst script for mobilizon.
|
|
#
|
|
# See: dh_installdeb(1).
|
|
|
|
set -e
|
|
|
|
# Load debconf
|
|
. /usr/share/debconf/confmodule
|
|
|
|
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
|
|
|
|
# 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
|
|
|
|
;;
|
|
|
|
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
|