/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to debian/mandos-client.postrm

  • Committer: Teddy Hogeborn
  • Date: 2021-02-03 08:41:01 UTC
  • mfrom: (1235 trunk)
  • mto: This revision was merged to the branch mainline in revision 1236.
  • Revision ID: teddy@recompile.se-20210203084101-411siabek78fx6bi
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# This script can be called in the following ways:
 
3
#
 
4
# After the package was removed:
 
5
#       <postrm> remove
 
6
#
 
7
# After the package was purged:
 
8
#       <postrm> purge
 
9
#
 
10
# After the package was upgraded:
 
11
#       <old-postrm> upgrade <new-version>
 
12
# if that fails:
 
13
#       <new-postrm> failed-upgrade <old-version>
 
14
#
 
15
#
 
16
# After all of the packages files have been replaced:
 
17
#       <postrm> disappear <overwriting-package> <version>
 
18
#
 
19
#
 
20
# If preinst fails during install:
 
21
#       <new-postrm> abort-install
 
22
#
 
23
# If preinst fails during upgrade of removed package:
 
24
#       <new-postrm> abort-install <old-version>
 
25
#
 
26
# If preinst fails during upgrade:
 
27
#       <new-postrm> abort-upgrade <old-version>
 
28
 
 
29
set -e
 
30
 
 
31
# Update the initial RAM file system image
 
32
update_initramfs()
 
33
{
 
34
    if command -v update-initramfs >/dev/null; then
 
35
        update-initramfs -k all -u
 
36
    elif command -v dracut >/dev/null; then
 
37
        # Logic taken from dracut.postinst
 
38
        for kernel in /boot/vmlinu[xz]-*; do
 
39
            kversion="${kernel#/boot/vmlinu[xz]-}"
 
40
            if [ "$kversion" != "*" ]; then
 
41
                /etc/kernel/postinst.d/dracut "$kversion"
 
42
            fi
 
43
        done
 
44
    fi
 
45
}
 
46
 
 
47
case "$1" in
 
48
    remove)
 
49
        update_initramfs
 
50
        ;;
 
51
 
 
52
    purge)
 
53
        shred --remove /etc/keys/mandos/seckey.txt 2>/dev/null || :
 
54
        rm --force /etc/mandos/plugin-runner.conf \
 
55
            /etc/keys/mandos/pubkey.txt \
 
56
            /etc/keys/mandos/seckey.txt \
 
57
            /etc/keys/mandos/tls-privkey.pem \
 
58
            /etc/keys/mandos/tls-pubkey.pem \
 
59
            /etc/keys/mandos/dhparams.pem 2>/dev/null
 
60
        update_initramfs
 
61
        ;;
 
62
    upgrade|failed-upgrade|disappear|abort-install|abort-upgrade)
 
63
        ;;
 
64
 
 
65
    *)
 
66
        echo "$0 called with unknown argument '$1'" 1>&2
 
67
        exit 1
 
68
        ;;
 
69
esac
 
70
 
 
71
#DEBHELPER#
 
72
 
 
73
exit 0