[arch-commits] Commit in cryptsetup/trunk (encrypt_hook)
Christian Hesse
eworm at archlinux.org
Sat Nov 4 22:19:31 UTC 2017
Date: Saturday, November 4, 2017 @ 22:19:29
Author: eworm
Revision: 308917
succeed without action if crypt device exists
Third party hooks can do the crypt setup for us. Do not complain or loop
forever but return with success. (FS#56161)
Modified:
cryptsetup/trunk/encrypt_hook
--------------+
encrypt_hook | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
Modified: encrypt_hook
===================================================================
--- encrypt_hook 2017-11-04 21:57:48 UTC (rev 308916)
+++ encrypt_hook 2017-11-04 22:19:29 UTC (rev 308917)
@@ -44,6 +44,12 @@
cryptname="root"
fi
+ # This may happen if third party hooks do the crypt setup
+ if [ -b "/dev/mapper/${cryptname}" ]; then
+ echo "Device ${cryptname} already exists, not doing any crypt setup."
+ return 0
+ fi
+
warn_deprecated() {
echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
@@ -88,7 +94,7 @@
fi
else
err "Password succeeded, but ${cryptname} creation failed, aborting..."
- exit 1
+ return 1
fi
elif [ -n "${crypto}" ]; then
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
@@ -118,7 +124,7 @@
if [ $? -ne 0 ]; then
err "Non-LUKS device decryption failed. verify format: "
err " crypto=hash:cipher:keysize:offset:skip"
- exit 1
+ return 1
fi
if [ -e "/dev/mapper/${cryptname}" ]; then
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
@@ -126,7 +132,7 @@
fi
else
err "Password succeeded, but ${cryptname} creation failed, aborting..."
- exit 1
+ return 1
fi
else
err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
More information about the arch-commits
mailing list