Skip to content
Snippets Groups Projects
Unverified Commit 1196bb54 authored by Duncan Macleod's avatar Duncan Macleod
Browse files

debian: add postinst script to create user

closes #25
parent 512bc0a3
No related branches found
No related tags found
1 merge request!68Add Debian postinst script to create user
......@@ -42,6 +42,7 @@ Depends:
${shlibs:Depends},
${misc:Depends},
${python3:Depends},
adduser,
python3-gwdatafind-server (= ${binary:Version}),
python3-gunicorn,
Description: Server app for the GWDataFind service
......
#!/bin/bash
# postinst script for gwdatafind-server
set -e
. /usr/share/debconf/confmodule
db_version 2.0
gwdatafind_server_user="gwdatafind"
gwdatafind_server_gecos="Dedicated gwdatafind service account"
gwdatafind_server_home="/var/lib/${gwdatafind_server_user}"
case "$1" in
configure)
# -- add the gwdatafind_server user (and group)
if [ ! "$(getent passwd '${gwdatafind_server_user}')" ]; then
adduser \
--system \
--group \
--gecos "${gwdatafind_server_gecos}" \
--home "${gwdatafind_server_home}" \
--disabled-password \
--disabled-login \
--quiet \
${gwdatafind_server_user} 2>/dev/null;
else
echo "I: Assuming that user "${gwdatafind_server_user}" already exists..."
fi
# -- configure systemd
# tell systemd to create tmpfiles, but do no harm if not available
systemd-tmpfiles --create --exclude-prefix=/dev || true
# reload system-daemon as service unit may have changed
systemctl daemon-reload >/dev/null || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
db_stop
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment