summaryrefslogtreecommitdiff
path: root/pcr/opendnssec/opendnssec.install
blob: e9e2eed807a96919c605302ecfa5753538f71d00 (plain)
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
post_install() {
    if [ -z "`grep '^opendnssec:' /etc/group`" ]; then
        groupadd -g 227 opendnssec
    fi
    if [ -z "`grep '^opendnssec:' /etc/passwd`" ]; then
        useradd -u 227 -d /var/lib/opendnssec -g opendnssec -s /bin/false opendnssec
    fi
    
    systemd-tmpfiles --create opendnssec.conf

    echo ">> You need an HSM implementation (try softhsm)"
}


post_upgrade() {
    post_install $1
    OLD=$(echo $2 | sed "s/\(.*\)\.\(.*\)\.\(.*\)/\1\.\2/g")
    NEW=$(echo $1 | sed "s/\(.*\)\.\(.*\)\.\(.*\)/\1\.\2/g")
    if [ $OLD != "1.4" -a $NEW == "1.4" ]; then
        echo ">> NOTICE: UPGRADE TO 1.4"
        echo "This update requires upgrading the database"
        echo "Run /usr/share/opendnssec/migrate_adapters_1.sqlite3 on your kasp database"
	echo "e.g: sqlite3 kasp.db < /usr/share/opendnssec/migrate_adapters_1.sqlite3"
    fi
    if [ $OLD != "1.4.8" -a $NEW == "1.4.8" ]; then
        echo ">> NOTICE: UPGRADE TO 1.4.8"
        echo "This update requires upgrading the database"
        echo "Run /usr/share/opendnssec/migrate_1_4_8.sqlite3 on your kasp database"
        echo "e.g: sqlite3 kasp.db < /usr/share/opendnssec/migrate_1_4_8.sqlite3"
    fi
}

post_remove() {
    userdel opendnssec
}