diff --git a/debian/numerus.postinst b/debian/numerus.postinst new file mode 100644 index 0000000..a5d30f3 --- /dev/null +++ b/debian/numerus.postinst @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +. /usr/share/debconf/confmodule + +case "$1" in + configure) + # Create numerus user and group + if ! getent group numerus >/dev/null; then + addgroup --system --quiet numerus + fi + if ! getent passwd numerus >/dev/null; then + adduser --quiet \ + --system \ + --disabled-login \ + --no-create-home \ + --shell /bin/bash \ + --ingroup numerus \ + --home /usr/share/numerus \ + --gecos "Numerus Daemon" \ + numerus + fi + + # Make sure log directory has correct permissions set + dpkg-statoverride --list "/var/log/numerus" >/dev/null || \ + dpkg-statoverride --add --force --quiet --update numerus adm 0750 /var/log/numerus + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/numerus.service b/debian/numerus.service new file mode 100644 index 0000000..0d0c62d --- /dev/null +++ b/debian/numerus.service @@ -0,0 +1,15 @@ +[Unit] +Description=Numerus application server +Requires=postgresql.service +After=postgresql.service + +[Service] +Type=simple +User=numerus +Group=numerus +WorkingDirectory=/usr/share/numerus +EnvironmentFile=-/etc/default/numerus +ExecStart=/usr/bin/numerus +Restart=always +StandardOutput=append:/var/log/numerus/access.log +StandardError=append:/var/log/numerus/error.log