From 2ee11ef334983fc68352364025ba5a97d795b95e Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 7 Dec 2010 13:48:22 +0100 Subject: also add lvm2 hook in target mkinitcpio.conf for non-root logical volumes --- src/core/libs/lib-ui-interactive.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3-54-g00ecf