summaryrefslogtreecommitdiffstats
path: root/hooks/encrypt
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-04-28 01:00:37 +0200
committerAaron Griffin <aaron@archlinux.org>2006-04-28 01:00:37 +0200
commit188acd6f8e4f7339e399ab50ca0e2656658a529c (patch)
tree537807df5e0dad2423c30655578adddab1dbf663 /hooks/encrypt
parent8f52a54411b636c0041e4cd25b4af6233b8d016d (diff)
downloadmkinitcpio-188acd6f8e4f7339e399ab50ca0e2656658a529c.tar.gz
mkinitcpio-188acd6f8e4f7339e399ab50ca0e2656658a529c.tar.xz
fixes
git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@30 880c04e9-e011-0410-abf7-b926e227c9cd
Diffstat (limited to 'hooks/encrypt')
-rw-r--r--hooks/encrypt49
1 files changed, 26 insertions, 23 deletions
diff --git a/hooks/encrypt b/hooks/encrypt
index 741fba7..0c52375 100644
--- a/hooks/encrypt
+++ b/hooks/encrypt
@@ -27,34 +27,37 @@ run_hook ()
exit 1
fi
fi
- else
+ elif [ "x${crypto}" != "x" ]; then
do_oldcrypto ()
{
- exe="/bin/cryptsetup create root ${root}"
- [ "x${1}" != "x" ] && exe="$exe --hash \"${1}\""
- [ "x${2}" != "x" ] && exe="$exe --cipher \"${2}\""
- [ "x${3}" != "x" ] && exe="$exe --key-size \"${3}\""
- [ "x${4}" != "x" ] && exe="$exe --offset \"${4}\""
- [ "x${5}" != "x" ] && exe="$exe --skip \"${5}\""
- echo ""
- echo "A password is required to access the root filesystem:"
- echo -n "password: "
- eval "${exe}"
+ if [ $# -ne 5 ]; then
+ err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
+ err "Non-LUKS decryption not attempted..."
+ else
+ exe="/bin/cryptsetup create root ${root}"
+ [ "x${1}" != "x" ] && exe="$exe --hash \"${1}\""
+ [ "x${2}" != "x" ] && exe="$exe --cipher \"${2}\""
+ [ "x${3}" != "x" ] && exe="$exe --key-size \"${3}\""
+ [ "x${4}" != "x" ] && exe="$exe --offset \"${4}\""
+ [ "x${5}" != "x" ] && exe="$exe --skip \"${5}\""
+ echo ""
+ echo "A password is required to access the root filesystem:"
+ echo -n "password: "
+ eval "${exe}"
+ fi
}
msg "Non-LUKS encrypted device found..."
- if [ "x${crypto}" != "x" ]; then
- do_oldcrypt ${crypto}
- if [ $? -ne 0 ]; then
- err "Password verification failed, aborting..."
- err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
- exit 1
+ do_oldcrypt ${crypto}
+ if [ $? -ne 0 ]; then
+ err "Password verification failed, aborting..."
+ err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
+ exit 1
+ else
+ if [ -e "/dev/mapper/root" ]; then
+ export root="/dev/mapper/root"
else
- if [ -e "/dev/mapper/root" ]; then
- export root="/dev/mapper/root"
- else
- err "Password succeeded, but root creation failed, aborting..."
- exit 1
- fi
+ err "Password succeeded, but root creation failed, aborting..."
+ exit 1
fi
fi
fi