aboutsummaryrefslogtreecommitdiff
path: root/debian/naskpass.postinst
blob: 255bfd0459cac7d2d454ef3add64846cfbec1f85 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# postinst script for naskpass
#
# see: dh_installdeb(1)

set -e

. /usr/share/debconf/confmodule
. /usr/share/naskpass/naskconf

case "$1" in

    configure)
        nask_update
        db_input high naskpass/activate || true
        db_go
        db_get naskpass/activate
        if [ "x$RET" = "xtrue" ]; then
          nask_activate || true
          if [ "x${ERRMSG}" != "x" ]; then
            echo "* ${ERRMSG}" >&2
            nask_deactivate
            false
          fi
        else
          nask_deactivate
        fi
	if [ -x /usr/bin/ssh-keygen ]; then
		[ -r /etc/initramfs-tools/etc/ssh/ssh_host_rsa_key ] || /usr/bin/ssh-keygen -t rsa -N '' -b 4096 -f /etc/initramfs-tools/etc/ssh/ssh_host_rsa_key
		[ -r /etc/initramfs-tools/etc/ssh/ssh_host_dsa_key ] || /usr/bin/ssh-keygen -t dsa -N '' -b 1024 -f /etc/initramfs-tools/etc/ssh/ssh_host_dsa_key
		[ -r /etc/initramfs-tools/etc/ssh/authorized_keys ] || cat /etc/initramfs-tools/etc/ssh/ssh_host_rsa_key.pub >/etc/initramfs-tools/etc/ssh/authorized_keys
	fi
        update-initramfs -u
    ;;

    install|upgrade|abort-upgrade)
    ;;

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0