File: softhsm-common.postinst

package info (click to toggle)
softhsm 1.3.7-2%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,688 kB
  • ctags: 1,498
  • sloc: sh: 11,139; cpp: 8,504; ansic: 1,614; makefile: 110
file content (41 lines) | stat: -rw-r--r-- 896 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
#!/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

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

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

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

#DEBHELPER#

exit 0