Debian Codegraph @

debian/barman.postinst-jammy

raw
1 #!/bin/sh
2 # postinst script for barman
3
4 set -e
5
6 case "$1" in
7 configure)
8 # Add barman user
9 if ! getent passwd barman > /dev/null
10 then
11 adduser --system --quiet --home /var/lib/barman --no-create-home \
12 --gecos "Backup and Recovery Manager for PostgreSQL" \
13 --shell /bin/bash --group barman
14 fi
15 # Add barman to /etc/aliases on install; not on upgrade
16 if [ -z "$2" ]; then
17 if [ -f /etc/aliases ] || [ -L /etc/aliases ]; then
18 if ! grep -qi "^barman[[:space:]]*:" /etc/aliases; then
19 echo "barman: root" >> /etc/aliases
20 test -x "$(command -v newaliases)" && newaliases || :
21 fi
22 fi
23 fi
24 # Make sure the home and log directories exist
25 for dir in /var/lib/barman /var/log/barman
26 do
27 mkdir -p $dir
28 chown barman:barman $dir
29 chmod 750 $dir
30 done
31 ;;
32
33 abort-upgrade|abort-remove|abort-deconfigure)
34 ;;
35
36 *)
37 echo "postinst called with unknown argument \`$1'" >&2
38 exit 1
39 ;;
40 esac
41
42 #DEBHELPER#
43
44 exit 0