[PATCH 8/8] Add option combining and filtering support to booty (#526354).

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

 



When gathering kernel boot options via dracutSetupData() method calls,
combine options that have combine=True.  If filters exist for option
values we are combining, run the list of values through each filter
specified.
---
 booty/bootloaderInfo.py |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index b78ec96..437fee4 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -91,6 +91,9 @@ class KernelArguments:
         root = self.id.storage.rootDevice
         params = []
         newargs = []
+        combine = {}
+        delimiters = {}
+        filters = {}
 
         for d in self.id.storage.devices:
             if root.dependsOn(d) or d.forceDracut:
@@ -113,11 +116,43 @@ class KernelArguments:
             if not param.has_key('option') or not param.has_key('value'):
                 continue
 
-            if not param['value']:
+            option = param['option']
+
+            if param.has_key('combine') and param['combine']:
+                if not combine.has_key(option):
+                    combine[option] = []
+
+                if not param['value']:
+                    continue
+
+                combine[option].append(param['value'])
+
+                if not delimiters.has_key(option):
+                    delimiters[option].add(param['delimiter'])
+
+                if param.has_key('filter'):
+                    if not filters.has_key(option):
+                        filters[option] = set()
+
+                    filters[option].add(param['filter'])
+            elif not param['value']:
                 newargs.append(param['option'])
             else:
                 newargs.append("%s=%s" % (param['option'], param['value'],))
 
+        for option in combine.keys():
+            delims = list(delimiters[arg])
+            if len(delims) != 1:
+                raise ValueError, "too many delimiters for option %s" % (option,)
+
+            if filters.has_key(option):
+                for filter in list(filters[option]):
+                    combine[option] = filter(combine[option])
+
+            delimiter = delims[0]
+            newargs.append({'option': option,
+                            'value': delimiter.join(combine[option])})
+
         if args:
             args += " " + " ".join(newargs)
         else:
-- 
1.6.2.5

_______________________________________________
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