Re: [PATCH 3/4] Write dracut rd_NO_foo options to grub.conf

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

 



Hi,

On 12/23/2009 06:45 PM, David Lehman wrote:
On Tue, 2009-12-22 at 21:43 +0100, Hans de Goede wrote:
When we don't specify any MD / LVM / DM / LUKS to activate dracut will
activate all found by default, so when we don't specify any write
RD_NO_foo to the kernel cmdline in grub.

The idea is fine, but...

---
  booty/bootloaderInfo.py |   13 ++++++++++++-
  1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index 6e6d403..3d77254 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -88,16 +88,27 @@ class KernelArguments:

      def getDracutStorageArgs(self):
          args = []
+        types = {}
          root = self.id.storage.rootDevice
          for d in self.id.storage.devices:
              if not root.dependsOn(d):
                  continue

-            args.append(d.dracutSetupString())
+            s = d.dracutSetupString()
+            types[s.split("=")[0]] = True
+            args.append(s)
+
              import storage
              if isinstance(d, storage.devices.NetworkStorageDevice):
                  args.append(self.id.network.dracutSetupString(d))

+        for i in [ [ "rd_LUKS_UUID", "rd_NO_LUKS" ],
+                   [ "rd_LVM_VG", "rd_NO_LVM" ],
+                   [ "rd_MD_UUID", "rd_NO_MD" ],
+                   [ "rd_DM_UUID", "rd_NO_DM" ] ]:
+            if not types.has_key(i[0]):
+                args.append(i[1])
+
          return args

      def get(self):

It would be a bit more straightforward for types to be a list. Then you
can just do:

   types.append(s.split("=")[0])

and, later,

   if i[0] not in types:


Please scrap my previous reply about agreeing to change this to a list,
I remember now why I made it a dict, as I want every type to only be
in there once. I know your approach will work as well, but the idea behind
the types dict, is to have a data structure which tracks which types of
storage have activation commands in the dracut cmdline's, and such the
struct should only have each type once (or not at all). Making a dict
more appropriate for tracking this.

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux