aboutsummaryrefslogtreecommitdiff
path: root/scripts/naskpass.initscript
diff options
context:
space:
mode:
authortoni <matzeton@googlemail.com>2015-02-05 11:05:32 +0100
committertoni <matzeton@googlemail.com>2015-02-07 03:45:13 +0100
commit590d34f183c9abc60068a767426edbfec30cda3e (patch)
tree7f084d1346d934a316ad12f4dac1d350587f49c1 /scripts/naskpass.initscript
parent997103f7218b82f8364fc41e9b744d5ab282516c (diff)
init- script/hook rewrote:
- plymouth compatible - cleaned up the initrd hook
Diffstat (limited to 'scripts/naskpass.initscript')
-rw-r--r--[-rwxr-xr-x]scripts/naskpass.initscript26
1 files changed, 21 insertions, 5 deletions
diff --git a/scripts/naskpass.initscript b/scripts/naskpass.initscript
index 1216e14..3f9be2c 100755..100644
--- a/scripts/naskpass.initscript
+++ b/scripts/naskpass.initscript
@@ -68,7 +68,7 @@ parse_options()
cryptlvm=""
cryptkeyscript=""
cryptkey="" # This is only used as an argument to an eventual keyscript
- crypttries=1
+ crypttries=3
cryptrootdev=""
cryptdiscard=""
CRYPTTAB_OPTIONS=""
@@ -101,12 +101,23 @@ parse_options()
lvm=*)
cryptlvm=${x#lvm=}
;;
+ keyscript=*)
+ cryptkeyscript=${x#keyscript=}
+ ;;
key=*)
if [ "${x#key=}" != "none" ]; then
cryptkey=${x#key=}
fi
export CRYPTTAB_KEY="$cryptkey"
;;
+ tries=*)
+ crypttries="${x#tries=}"
+ case "$crypttries" in
+ *[![:digit:].]*)
+ crypttries=3
+ ;;
+ esac
+ ;;
rootdev)
cryptrootdev="yes"
;;
@@ -262,16 +273,21 @@ setup_mapping()
cryptkeyscript="plymouth ask-for-password --prompt"
cryptkey=$(printf "$cryptkey")
else
- dmesg -n 1
cryptkeyscript="/lib/cryptsetup/naskpass"
fi
fi
if [ ! -e "$NEWROOT" ]; then
- if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \
- $cryptkeyscript "$cryptcreate" ; then
- continue;
+ if [ -x /bin/plymouth ] && plymouth --ping; then
+ message "naskpass does not work with playmouth, falling back to default askpass .."
+ if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \
+ $cryptkeyscript "$cryptkey" | $cryptcreate --key-file=- ; then
+ message "cryptsetup: cryptsetup failed, bad password or options?"
+ continue
+ fi
+ else
+ $cryptkeyscript -c "$cryptcreate"
fi
fi