[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] handle root_device from ks.cfg in upgrade.py



Good evening,
this is the final patch that will handle the new --root-device option of the
upgrade command. The patch compares raw device name, uuid or label and adds that
to the list of available devices.

Thanks Chris for reminding me that patches were not complete.

Regards,
Alexander.
 upgrade.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/upgrade.py b/upgrade.py
index 43b66f6..3833575 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -128,9 +128,17 @@ def findRootParts(anaconda):
     if anaconda.id.rootParts is None:
         anaconda.id.rootParts = findExistingRoots(anaconda)
 
+    root_device = None
+    # ks.cfg can pass device as raw device, label or uuid. no quotes allowed
+    if (anaconda.id.ksdata is not None) and anaconda.id.ksdata.upgrade and (anaconda.id.ksdata.upgrade.root_device is not None):
+        root_device=anaconda.id.ksdata.upgrade.root_device
+
     anaconda.id.upgradeRoot = []
     for (dev, fs, meta, label, uuid) in anaconda.id.rootParts:
-        anaconda.id.upgradeRoot.append( (dev, fs) )
+        if (root_device is not None) and ((dev == root_device) or (("UUID=%s" % uuid) == root_device) or (("LABEL=%s" % label) == root_device)):
+            anaconda.id.upgradeRoot.append( (dev, fs) )
+        else:
+            anaconda.id.upgradeRoot.append( (dev, fs) )
 
     if anaconda.id.rootParts is not None and len(anaconda.id.rootParts) > 0:
         anaconda.dispatch.skipStep("findinstall", skip = 0)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]