summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/libs/lib-ui-interactive.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 2cbf2a4..5be0bb0 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -34,15 +34,23 @@ prefill_configs () {
-e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$HARDWARECLOCK\"/g" \
${var_TARGET_DIR}/etc/rc.conf
- # prepare HOOKS in mkinitcpio.conf for lvm/dm_crypt users
+ # Give initcpio the encrypt hook when / depends on an encrypted volume
+ # (other encrypted volumes, not related to / don't need the encrypt hook, afaik)
+ # If / also depends on lvm, this way the lvm2 hook will also be included in the right place
if get_anchestors_mount ';/;'
then
hooks=`echo "$ANSWER_DEVICES" | cut -d ' ' -f2 | egrep 'lvm-lv|dm_crypt' | sed -e 's/lvm-lv/lvm2/' -e 's/dm_crypt/encrypt/' | tac`
hooks=`echo $hooks`
[ -n "$hooks" ] && sed -i "/^HOOKS/ s/filesystems/$hooks filesystems/" ${var_TARGET_DIR}/etc/mkinitcpio.conf
fi
+ # The lvm2 hook however is needed for any lvm LV, no matter the involved mountpoints, so include it if we still need to
+ if grep -q lvm-lv $TMP_BLOCKDEVICES && ! grep -q '^HOOKS.*lvm2' ${var_TARGET_DIR}/etc/mkinitcpio.conf
+ then
+ sed -i "/^HOOKS/ s/filesystems/lvm2 filesystems/" ${var_TARGET_DIR}/etc/mkinitcpio.conf
+ fi
+
# if keymap/usbinput are not in mkinitcpio.conf, but encrypt is, we should probably add it
- if line=`grep ^HOOKS ${var_TARGET_DIR}/etc/mkinitcpio.conf | grep encrypt`
+ if line=`grep '^HOOKS.*encrypt' ${var_TARGET_DIR}/etc/mkinitcpio.conf`
then
if ! echo "$line" | grep -q keymap
then