File: softhsm2-common.postinst

package info (click to toggle)
softhsm2 2.6.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,484 kB
  • sloc: cpp: 65,875; sh: 4,363; ansic: 2,018; makefile: 655
file content (42 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# postinst script for softhsm-common

set -e

set_perms() {
    if ! dpkg-statoverride --list "$4" >/dev/null; then
        dpkg-statoverride --update --add "$@"
    fi
}

case "$1" in
    configure)

	# add softhsm group if it doesn't exists
	if ! getent group softhsm > /dev/null; then
	    groupadd --system softhsm > /dev/null
	fi

	# set correct permissions on softhsm directories
	set_perms root softhsm 0750 /etc/softhsm
	set_perms root softhsm 02770 /var/lib/softhsm
	set_perms root softhsm 02770 /var/lib/softhsm/tokens

	# create new and update old configuration file and set permissions
	ucf /usr/share/softhsm/softhsm2.conf /etc/softhsm/softhsm2.conf
	ucfr softhsm /etc/softhsm/softhsm2.conf
	set_perms root softhsm 0640 /etc/softhsm/softhsm2.conf
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0