Sophie

Sophie

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

dracut-038-19.mga5.src.rpm

From 6666a3e7f48c2b094eca192b959b4bd908035029 Mon Sep 17 00:00:00 2001
From: Colin Guthrie <colin@mageia.org>
Date: Thu, 23 Feb 2012 12:12:39 +0000
Subject: [PATCH 502/515] 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 37709f2..c869bb7 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -857,6 +857,23 @@ if [[ $print_cmdline ]]; then
     kmsgloglvl=0
 fi
 
+# 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.9.2