hyperboria/rules/packaging/templates/postinst.jinja2
the-superpirate 8472f27ec5 No description
GitOrigin-RevId: ddf02e70d2827c048db49b687ebbcdcc67807ca6
2021-01-04 18:12:22 +03:00

37 lines
801 B
Django/Jinja

#!/usr/bin/env bash
set -e
case "$1" in
configure)
{% if add_user -%}
id -u {{ add_user }} &>/dev/null || adduser --disabled-password --gecos "" {{ add_user }}
{% for group in user_groups %}
usermod -a -G {{ group }} {{ add_user }}
{%- endfor %}
{%- endif -%}
{% for line in extra_postinst %}
{{ line }}
{%- endfor %}
{% for line in services %}
systemctl enable {{ line }}
systemctl daemon-reload
service {{ line }} start
{%- endfor %}
{% if restart_nginx -%}
service nginx reload || service nginx restart
{%- endif %}
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0