summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2007-10-19 22:22:52 +0000
committerThomas Bächler <thomas@archlinux.org>2007-10-19 22:22:52 +0000
commitbb0984ad899ab3ae85ef8bf2c0e178a2b485885c (patch)
tree635fc7243c53333b5e6d212c0fe5c75f477ee4a5
parent39a8c53bd8c2b82e824d9299a4a18d81c9e530bd (diff)
added (barely tested) improvement of ASK keyword in crypttab
-rwxr-xr-xrc.sysinit17
1 files changed, 10 insertions, 7 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 6e6c349..4ae198a 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -145,6 +145,8 @@ if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
shift 3
copts="$*"
stat_append "${cname}.."
+ # For some fun reason, the parameter ordering varies for
+ # LUKS and non-LUKS devices. Joy.
if [ "${cpass}" = "SWAP" ]; then
# This is DANGEROUS! The only possible safety check
# is to not proceed in case we find a LUKS device
@@ -158,15 +160,16 @@ if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
mkswap -L $cname /dev/mapper/$cname >/dev/null
fi
fi
- elif [ "${cpass:0:1}" != "/" ]; then
- # For some fun reason, the parameter ordering varies for
- # LUKS and non-LUKS devices. Joy.
- if [ "${cpass}" = "ASK" ]; then
- echo -ne "\nEnter passphrase for '${cname}' volume: "
- read -r -s cpass < /dev/console
- fi
+ elif [ "${cpass}" = "ASK" ]; then
+ echo -e "\nOpening '${cname}' volume:"
if $CS isLuks $csrc 2>/dev/null; then
+ $CS $copts luksOpen $csrc $cname < /dev/console
+ else
+ $CS $copts create $cname $csrc < /dev/console
+ fi
+ elif [ "${cpass:0:1}" != "/" ]; then
+ if $CS isLuks $csrc 2>/dev/null; then
echo "$cpass" | $CS $copts luksOpen $csrc $cname >/dev/null
else
echo "$cpass" | $CS $copts create $cname $csrc >/dev/null