This file is indexed.

postinst is in dropbear-initramfs 2016.72-1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
51
#!/bin/sh
set -e


showpubkey() {
    local keyfile="$1" pubkey

    if ! which ssh-keygen >/dev/null 2>&1; then
        cat
    else
        pubkey=$(mktemp)
        grep -m1 -E '^(ssh-(dss|rsa)|ecdsa-sha2-nistp(256|384|521)) ' >"$pubkey"
        ssh-keygen -v -lf "$pubkey" | sed -r "1s@$pubkey(\s+\([^)]+\))\$@$keyfile\1@"
        rm -f "$pubkey"
    fi
}

if [ "$1" = 'configure' ] && \
   [ -r /etc/initramfs-tools/initramfs.conf -a -x /usr/sbin/update-initramfs ]; then

    mkdir -p /etc/initramfs-tools/etc/dropbear
    for keytype in dss rsa ecdsa; do
        keyfile="/etc/initramfs-tools/etc/dropbear/dropbear_${keytype}_host_key"
        [ ! -e "$keyfile" ] || continue

        echo "Generating Dropbear $(echo "$keytype" | tr '[a-z]' '[A-Z]') host key.  Please wait." >&2
        dropbearkey -t "$keytype" -f "$keyfile" | showpubkey "$keyfile"
    done

    # update initramfs
    for i in /etc/initramfs-tools/initramfs.conf /usr/share/initramfs-tools/conf-hooks.d/*; do
        [ ! -r "$i" ] || . "$i"
    done

    if [ "$DROPBEAR" = y ] || [ "$DROPBEAR" != n -a -r /etc/crypttab ]; then
        # XXX here we could read the configured network-config, and use it
        # for default values for prompting the user for the
        # initramfs-network- config (subsequently writing it to menu.lst:#
        # kopt= or lilo.conf), instead of just printing the reminder below.
        update-initramfs -u
        cat <<-EOT
			Dropbear has been added to the initramfs. Don't forget to check
			your "ip=" kernel bootparameter to match your desired initramfs
			ip configuration.

		EOT
    fi
fi


exit 0