#!/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 exit 0