aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2007-05-13 13:40:40 +0000
committerThomas Bächler <thomas@archlinux.org>2007-05-13 13:40:40 +0000
commit6852a33372052c1374248f6727e6f7755aeadd30 (patch)
tree2cd0e5d2932ec979437ae4081d42e01c0d180403
parentaca95b25037ee1085c70a2e73b609a5d8cdff44b (diff)
downloadinitscripts-2007.05.tar.xz
upgpkg: initscripts 0.8-112007.05
-rwxr-xr-xrc.sysinit20
1 files changed, 19 insertions, 1 deletions
diff --git a/rc.sysinit b/rc.sysinit
index e37c809..eaaa1cb 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -134,9 +134,27 @@ if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
shift 3
copts="$*"
stat_append "${cname}.."
- if [ "${cpass:0:1}" != "/" ]; then
+ if [ "${cpass}" = "SWAP" ]; then
+ # This is DANGEROUS! The only possible safety check
+ # is to not proceed in case we find a LUKS device
+ # This may cause dataloss if it is not used carefully
+ if $CS isLuks $csrc 2>/dev/null; then
+ false
+ else
+ $CS -d /dev/urandom $copts create $cname $csrc >/dev/null
+ if [ $? -eq 0 ]; then
+ stat_append "creating swapspace.."
+ 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
+
if $CS isLuks $csrc 2>/dev/null; then
echo "$cpass" | $CS $copts luksOpen $csrc $cname >/dev/null
else