#!/bin/sh # postinst script for barman set -e case "$1" in configure) # Add barman user if ! getent passwd barman > /dev/null then adduser --system --quiet --home /var/lib/barman --no-create-home \ --gecos "Backup and Recovery Manager for PostgreSQL" \ --shell /bin/bash --group barman fi # Add barman to /etc/aliases on install; not on upgrade if [ -z "$2" ]; then if [ -f /etc/aliases ] || [ -L /etc/aliases ]; then if ! grep -qi "^barman[[:space:]]*:" /etc/aliases; then echo "barman: root" >> /etc/aliases test -x "$(command -v newaliases)" && newaliases || : fi fi fi # Make sure the home and log directories exist for dir in /var/lib/barman /var/log/barman do mkdir -p $dir chown barman:barman $dir chmod 750 $dir done ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_installsystemd/13.31 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'barman.timer' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'barman.timer'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'barman.timer' >/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 'barman.timer' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.31 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 'barman.service' 'barman.timer' >/dev/null || true fi fi # End automatically added section exit 0