Debian Codegraph @

debian/softhsm2-common.postinst

raw
1 #!/bin/sh
2 # postinst script for softhsm-common
3
4 set -e
5
6 set_perms() {
7 if ! dpkg-statoverride --list "$4" >/dev/null; then
8 dpkg-statoverride --update --add "$@"
9 fi
10 }
11
12 case "$1" in
13 configure)
14
15 # add softhsm group if it doesn't exists
16 if ! getent group softhsm > /dev/null; then
17 groupadd --system softhsm > /dev/null
18 fi
19
20 # set correct permissions on softhsm directories
21 set_perms root softhsm 0750 /etc/softhsm
22 set_perms root softhsm 02770 /var/lib/softhsm
23 set_perms root softhsm 02770 /var/lib/softhsm/tokens
24
25 # create new and update old configuration file and set permissions
26 ucf /usr/share/softhsm/softhsm2.conf /etc/softhsm/softhsm2.conf
27 ucfr softhsm /etc/softhsm/softhsm2.conf
28 set_perms root softhsm 0640 /etc/softhsm/softhsm2.conf
29 ;;
30
31 abort-upgrade|abort-remove|abort-deconfigure)
32 ;;
33
34 *)
35 echo "postinst called with unknown argument \`$1'" >&2
36 exit 1
37 ;;
38 esac
39
40 #DEBHELPER#
41
42 exit 0