#!/bin/sh set -e case $1 in configure) # Add the "orthanc" user if ! getent passwd orthanc > /dev/null; then adduser --system --quiet \ --home /var/lib/orthanc --no-create-home \ --shell /bin/bash --group --gecos "Orthanc Administrator" orthanc fi if test "`id -u orthanc`" -eq 0; then echo "The orthanc administrative user must not be root." >&2 false fi if test "`id -g orthanc`" -eq 0; then echo "The orthanc administrative group must not be root." >&2 false fi # Configure the permissions of the working directories chown orthanc:orthanc /var/lib/orthanc chown orthanc:orthanc /var/log/orthanc chmod 0750 /var/lib/orthanc chmod 0750 /var/log/orthanc # The "credentials.json" contains unencrypted sensitive # configuration options ("RegisteredUsers"): It must only be # readble by the users running Orthanc. chown root:orthanc /etc/orthanc/credentials.json chmod 0640 /etc/orthanc/credentials.json # Make sure the en_US locale has been generated (required for # case-insensitive comparison of strings with accents) locale-gen en_US locale-gen en_US.UTF-8 update-locale # Start the Orthanc service after installation # https://www.debian.org/doc/debian-policy/ch-opersys.html#s9.3.3.2 if [ -x /etc/init.d/orthanc ]; then if which invoke-rc.d >/dev/null 2>&1; then invoke-rc.d orthanc start else /etc/init.d/orthanc start fi fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_installinit/13.3.4 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "/etc/init.d/orthanc" ]; then update-rc.d orthanc defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native orthanc $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.3.4 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # This will only remove masks created by d-s-h on package removal. deb-systemd-helper unmask 'orthanc.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'orthanc.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'orthanc.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'orthanc.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.3.4 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'orthanc.service' >/dev/null || true fi fi # End automatically added section