aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2005-11-29 01:26:11 +0000
committerJudd Vinet <judd@archlinux.org>2005-11-29 01:26:11 +0000
commit78365fe57d61645c1b8282784d863a0cd8537eb5 (patch)
treeca14ac45463e6c1d8ac92b550dfb79ad9c4d98dd /rc.sysinit
parent0d7cb77c48fc6232a8342fba9056a1896898b066 (diff)
downloadinitscripts-78365fe57d61645c1b8282784d863a0cd8537eb5.tar.xz
finished crypttab work, fixed a bug in hwdetect related to custom kernels
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit18
1 files changed, 15 insertions, 3 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 80fb625..09a1e2a 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -65,7 +65,7 @@ if [ -f /etc/crypttab ]; then
while read line; do
[ "$line" = "" ] && continue
[ "`echo $line | grep ^#`" ] && continue
- # remove redundant whitespace
+ # remove redundant whitespace and split up tokens
line=`echo $line | awk '{print $0}'`
cname=`echo $line | cut -d' ' -f1`
csrc=`echo $line | cut -d' ' -f2`
@@ -76,9 +76,21 @@ if [ -f /etc/crypttab ]; then
$CS isLuks $csrc 2>/dev/null && action=luksOpen
if [ "`echo $cpass | grep \\\"`" ]; then
- echo "echo $cpass | $CS $action $cname $csrc"
+ # Trim off the quotes around the password string
+ cpass2=`echo $cpass | sed -e 's|^"||' -e 's|"$||'`
+ # For some fun reason, the parameter ordering varies for
+ # LUKS and non-LUKS devices. Joy.
+ if `$CS isLuks $csrc 2>/dev/null`; then
+ echo "$cpass2" | $CS luksOpen $csrc $cname >/dev/null
+ else
+ echo "$cpass2" | $CS create $cname $csrc >/dev/null
+ fi
else
- echo "$CS -d $cpass $action $cname $csrc"
+ if `$CS isLuks $csrc 2>/dev/null`; then
+ $CS -d $cpass luksOpen $csrc $cname >/dev/null
+ else
+ $CS -d $cpass create $cname $csrc >/dev/null
+ fi
fi
done </etc/crypttab
fi