blob: 675f783425bb8ae4444f356e8586edd9af253090 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/bin/sh
# postinst script for naskpass
#
# see: dh_installdeb(1)
set -e
export RDSUM="5924c70e5c9fabf0398050349c3f4f283ab80091b23ea8c677249ee7bdd41f6e4910ce5e1bc32577e67763dc30d9b96cc3528256e1cc63dba959a5e3866ec21f"
export ORGFILE="/usr/share/initramfs-tools/scripts/local-top/cryptroot"
export DIVFILE="/usr/share/naskpass/cryptroot.orig"
export BCKFILE="/var/backups/cryptroot.naskpass"
case "$1" in
install)
mkdir -p /usr/share/naskpass
if [ ! -f ${ORGFILE} ]; then
whiptail --title "Missing file" --msgbox "/usr/share/initramfs-tools/scripts/local-top/cryptroot is missing!\nabort .." 9 70
else
if [ ${RDSUM} = "$(sha512sum ${ORGFILE} | grep -Eo '^[0-9a-zA-Z]*')" ]; then
dpkg-divert --package naskpass --divert ${DIVFILE} --rename --add ${ORGFILE}
else
whiptail --title "Wrong SHA checksum" --msgbox "in /usr/share/initramfs-tools/scripts/local-top/cryptroot\n\nabort .." 9 70
fi
fi
;;
configure)
if [ ${RDSUM} = "$(sha512sum ${ORGFILE} | grep -Eo '^[0-9a-zA-Z]*')" ]; then
active=0
text="NOT active. Activate?"
else
active=1
text="active. Deactivate?"
fi
set +e
whiptail --yesno "naskpass is $text" --defaultno 10 70
choice=$?
set -e
case ${choice} in
0)
if [ ${active} -eq 0 ]; then
echo "Activating naskpass .." >&2
dpkg-divert --package naskpass --divert ${DIVFILE} --rename --add ${ORGFILE} || true
mv ${BCKFILE} ${ORGFILE} 2>/dev/null || true
elif [ ${active} -eq 1 ]; then
echo "Deactivating naskpass .." >&2
mv ${ORGFILE} ${BCKFILE} 2>/dev/null || true
dpkg-divert --package naskpass --remove --rename ${ORGFILE} || true
else
echo "Doin' nothing .." >&2
fi
;;
1)
echo "Keeping naskpass' status .." >&2
;;
*)
echo "Unknown whiptail error occured .." >&2
;;
esac
;;
upgrade)
update-initramfs -u
;;
*)
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
|