Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 5c1bb304a26349fad0d8eaf2d0262d83 > files > 11

dracut-025-8.mga3.src.rpm

From f429365ed03b09601ad8527996c9133812f89a79 Mon Sep 17 00:00:00 2001
From: Colin Guthrie <colin@mageia.org>
Date: Thu, 23 Feb 2012 12:12:39 +0000
Subject: [PATCH 503/511] Handle upgrades better.

When upgrading from mga1 to mga2, many users would boot from a non-dracut
based initrd and thus not have the necessary data in the udev database
for proper hostonly checks for certain file system layouts (e.g. LVM).

So to be safe, we will only allow hostonly mode when the folder /run/initramfs
exists. This should be an indicator that dracut was used for the boot and
thus all should be well for hostonly mode detection.
---
 dracut.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dracut.sh b/dracut.sh
index dfd6228..9941caa 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -598,6 +598,23 @@ readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
 export DRACUT_KERNEL_LAZY="1"
 export DRACUT_RESOLVE_LAZY="1"
 
+# Mageia upgrade hack.
+##
+## hostonly mode is generally recommended as it creates a nice small initrd.
+## However when running during an upgrade from mga1, the relevant information
+## regargind LVM volumes will not be present in the udevadm database and thus
+## LVM will not be included leading to a broken boot.
+## To test for this we check to see if /run is a mountpoint. If it is we're
+## running something newer than mga1 and thus we should use allow whatever
+## the hostonly setting says.
+[[ $hostonly ]] && [[ ! -d /run/initramfs ]] && [[ "$DRACUT_SKIP_FORCED_NON_HOSTONLY" != "1" ]] && {
+    echo "WARNING: Activating non-hostonly initrd due to distro upgrade." >&2
+    echo "         Your initrd will be larger than needed for compatibility." >&2
+    echo "" >&2
+    echo "         You can disable this by setting DRACUT_SKIP_FORCED_NON_HOSTONLY=1" >&2
+    unset hostonly
+}
+
 if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
     . $dracutbasedir/dracut-functions.sh
 else
-- 
1.8.1