[PATCH] parse-kickstart: add proc_cmdline (fix init_logger())

Will Woods wwoods at redhat.com
Thu Aug 16 20:50:31 UTC 2012


commit c1da5cd was originally part of an attempt to fix something else,
but the other patch (which introduced proc_cmdline) was rejected on
review.

This adds proc_cmdline so init_logger() won't traceback.
---
 dracut/parse-kickstart | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index e5c9770..3c3a1ff 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -32,6 +32,22 @@ def readsysfile(f):
         val = ""
     return val
 
+def read_cmdline(f):
+    '''Returns an OrderedDict containing key-value pairs from a file with
+    boot arguments (e.g. /proc/cmdline).'''
+    args = OrderedDict()
+    try:
+        lines = open(f).readlines()
+    except IOError:
+        lines = []
+    for line in lines:
+        for arg in line.split():
+            k,e,v = arg.partition("=")
+            args[k] = v
+    return args
+
+proc_cmdline = read_cmdline("/proc/cmdline")
+
 # Here are the kickstart commands we care about:
 
 class Method(commands.method.F14_Method):
-- 
1.7.11.2



More information about the anaconda-patches mailing list