File: corosync-qnetd.postinst

package info (click to toggle)
corosync-qdevice 3.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,516 kB
  • sloc: ansic: 22,520; sh: 11,882; makefile: 391
file content (30 lines) | stat: -rwxr-xr-x 767 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

set -e

dir=/etc/corosync/qnetd
db="$dir/nssdb"
pwdfile="$db/pwdfile.txt"
user=coroqnetd

if [ "$1" = configure ]; then
    adduser --system --group --quiet --home "$dir" \
        --no-create-home --disabled-login "$user"

    # https://fedoraproject.org/wiki/Changes/NSSDefaultFileFormatSql
    if ! [ -f "$db/cert9.db" ]; then
	if [ -f "$dir/nssdb/cert8.db" ]; then
	    # password file should have an empty line to be accepted
	    [ -f "$pwdfile" -a ! -s "$pwdfile" ] && echo > "$pwdfile"

	    # upgrade to SQLite database
	    certutil -N -d "sql:$db" -f "$pwdfile" -@ "$pwdfile"
	    chmod g+r "$db/cert9.db" "$db/key4.db"
	else
            corosync-qnetd-certutil -i -G
	fi
	chgrp "$user" "$db" "$db/cert9.db" "$db/key4.db"
    fi
fi

#DEBHELPER#