blob: 5f82f226a2dfc180af54785dc35889b3e6df2b87 (
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
|
#!/bin/sh
export ORGCHKSM="2057abcd4c0038fb3357680ac3057b208672d5d81bca85e1cc668f17d4060a23bda4c34352682b289d17a18f6ab75c4b9ea9df1a9f85709e3042ff7fdc83e245"
export ORGFILE="/usr/share/initramfs-tools/scripts/local-top/cryptroot"
. /usr/share/debconf/confmodule
_nask_cmd () {
db_get naskpass/active
if [ "x$1" = "xACTV" ] && [ "$RET" = "false" ]; then
if [ "${ORGCHKSM}" != "$(/usr/bin/sha512sum ${ORGFILE} | grep -Eo '^[0-9a-zA-Z]*')" ]; then
export ERRMSG="$0: sha512sum mismatch"
return 1
fi
dpkg-divert --package naskpass --add --rename --divert /var/backups/cryptroot.initramfs.bak ${ORGFILE}
cp /usr/share/naskpass/naskpass.initscript ${ORGFILE}
ln -s /usr/share/naskpass/naskpass.inithook \
/usr/share/initramfs-tools/hooks/naskpass
db_set naskpass/active true
elif [ "x$1" = "xDCTV" ] && [ "$RET" = "true" ]; then
rm ${ORGFILE}
rm /usr/share/initramfs-tools/hooks/naskpass
dpkg-divert --package naskpass --rename --remove ${ORGFILE}
db_set naskpass/active false
elif [ "x$1" = "xUPDT" ] && [ "$RET" = "true" ]; then
cp /usr/share/naskpass/naskpass.initscript ${ORGFILE}
fi
return 0
}
nask_activate () { _nask_cmd "ACTV"; return $?; }
nask_deactivate () { _nask_cmd "DCTV"; return $?; }
nask_update () { _nask_cmd "UPDT"; return $?; }
|