/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: 2024-09-09 04:24:39 UTC
  • Revision ID: teddy@recompile.se-20240909042439-j85mr20uli2hnyis
Eliminate compiler warnings

Many programs use nested functions, which now result in a linker
warning about executable stack.  Hide this warning.  Also, rewrite a
loop in the plymouth plugin to avoid warning about signed overflow.
This change also makes the plugin pick the alphabetically first
process entry instead of the last, in case many plymouth processes are
found (which should be unlikely).

* Makefile (plugin-runner, dracut-module/password-agent,
  plugins.d/password-prompt, plugins.d/mandos-client,
  plugins.d/plymouth): New target; set LDFLAGS to add "-Xlinker
  --no-warn-execstack".
* plugins.d/plymouth.c (get_pid): When no pid files are found, and we
  are looking through the process list, go though it from the start
  instead of from the end, i.e. in normal alphabetical order and not
  in reverse order.

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 1>&2
 
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" 1>&2
 
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 \
 
54
            /etc/keys/mandos/tls-privkey.pem 2>/dev/null || :
 
55
        rm --force /etc/mandos/plugin-runner.conf \
 
56
            /etc/keys/mandos/pubkey.txt \
 
57
            /etc/keys/mandos/seckey.txt \
 
58
            /etc/keys/mandos/tls-privkey.pem \
 
59
            /etc/keys/mandos/tls-pubkey.pem \
 
60
            /etc/keys/mandos/dhparams.pem 2>/dev/null
 
61
        update_initramfs
 
62
        ;;
 
63
    upgrade|failed-upgrade|disappear|abort-install|abort-upgrade)
 
64
        ;;
 
65
 
 
66
    *)
 
67
        echo "$0 called with unknown argument '$1'" 1>&2
 
68
        exit 1
 
69
        ;;
 
70
esac
 
71
 
 
72
#DEBHELPER#
 
73
 
 
74
exit 0