summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-software.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2010-12-31 16:46:41 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2010-12-31 16:46:41 +0100
commitdbbf5ccabc342f6cedd975378209b0c4af20e5c6 (patch)
treee0845797b2c5369b40ebcb62217444a6249bdb41 /src/core/libs/lib-software.sh
parentbffae93369818a82f0cbbcbff81939c104699550 (diff)
Inform user more in detail which pre/post-configure step went wrong
* Move all pre/post-configure logic to separate functions (initcpio config, time setting, mirrorlist) * other steps will continue to be run, even if previous one(s) failed * at the end of the pre/post-configure step you will be warned which steps failed, if needed.
Diffstat (limited to 'src/core/libs/lib-software.sh')
-rw-r--r--src/core/libs/lib-software.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh
index 4e32a63..aecbb39 100644
--- a/src/core/libs/lib-software.sh
+++ b/src/core/libs/lib-software.sh
@@ -78,3 +78,44 @@ target_locale-gen ()
inform "Generating glibc base locales..."
chroot ${var_TARGET_DIR} locale-gen >/dev/null
}
+
+target_configure_initcpio () {
+ local ret=0
+ # 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` # $hooks is now a space separated, correctly ordered list of needed hooks
+ if [ -n "$hooks" ]
+ then
+ # for each hook we're about to add, remove it first if it's already in
+ for hook in $hooks
+ do
+ sed -i "/^HOOKS/ s/$hook //" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ done
+ # now add the correctly ordered string
+ sed -i "/^HOOKS/ s/filesystems/$hooks filesystems/" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ fi
+ 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 || ret=$?
+ fi
+
+ # if keymap/usbinput are not in mkinitcpio.conf, but encrypt is, we should probably add it
+ if line=`grep '^HOOKS.*encrypt' ${var_TARGET_DIR}/etc/mkinitcpio.conf`
+ then
+ if ! echo "$line" | grep -q keymap
+ then
+ sed -i '/^HOOKS/ s/encrypt/keymap encrypt/' ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ fi
+ if ! echo "$line" | grep -q usbinput
+ then
+ sed -i '/^HOOKS/ s/keymap/usbinput keymap/' ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ fi
+ fi
+ return $ret
+}