Debian Codegraph @

debian/initramfs/hooks/cryptgnupg

raw symbols SCIP
1 #!/bin/sh
2
3 set -e
4
5 PREREQ="cryptroot"
6
7 prereqs()
8 {
9 echo "$PREREQ"
10 }
11
12 case "$1" in
13 prereqs)
14 prereqs
15 exit 0
16 ;;
17 esac
18
19 . /usr/share/initramfs-tools/hook-functions
20 . /lib/cryptsetup/functions
21
22 if [ ! -x "$DESTDIR/lib/cryptsetup/scripts/decrypt_gnupg" ] || [ ! -f "$TABFILE" ]; then
23 exit 0
24 fi
25
26 # Hooks for loading gnupg software and symmetrically encrypted key into
27 # the initramfs
28 copy_keys() {
29 crypttab_parse_options
30 if [ "${CRYPTTAB_OPTION_keyscript-}" = "/lib/cryptsetup/scripts/decrypt_gnupg" ]; then
31 if [ -f "$CRYPTTAB_KEY" ]; then
32 [ -f "$DESTDIR$CRYPTTAB_KEY" ] || copy_file keyfile "$CRYPTTAB_KEY" || RV=$?
33 else
34 cryptsetup_message "ERROR: Target $CRYPTTAB_NAME has a non-existing key file $CRYPTTAB_KEY"
35 RV=1
36 fi
37 fi
38 }
39
40 RV=0
41 crypttab_foreach_entry copy_keys
42
43 # install askpass and GnuPG
44 copy_exec /lib/cryptsetup/askpass
45 copy_exec /usr/bin/gpg
46 exit $RV