Re: booty - bootloaderInfo.py changes

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

 



Here's the -u diff.

On Tue, 2007-08-07 at 17:55 -0700, Shandy Brown wrote:
> Here's my first patch.
> 
> This one basically gets rid of "str" as a variable name.  Also, I took
> the opportunity to make the salt construction more concise, and pointed
> out a bug that I don't know how to fix.
> 
> Shandy
--- orig_booty/bootloaderInfo.py	2007-08-07 08:53:23.000000000 -0700
+++ booty/bootloaderInfo.py	2007-08-07 17:52:23.000000000 -0700
@@ -94,29 +94,31 @@
         
 
     def __init__(self):
-        str = ""
+        newArgs = []
+        cfgFilename = "/tmp/install.cfg"
 
         if rhpl.getArch() == "s390":
             self.cargs = []
-            f = open("/tmp/install.cfg")
-            lines = f.readlines()
-            for line in lines:
+            f = open(cfgFilename)
+            for line in f:
                 try:
                     (vname,vparm) = line.split('=', 1)
                     vname = vname.strip()
                     vparm = vparm.replace('"','')
                     vparm = vparm.strip()
                     if vname == "DASD":
-                        str = str + "dasd=" + vparm
+                        newArgs.append( "dasd=" + vparm )
                     if vname == "CHANDEV":
                         self.cargs.append(vparm)
                     if vname == "QETHPARM":
                         self.cargs.append(vparm)
                 except Exception, e:
-                    pass
+                    log("exception parsing %s: %s" % (cfgFilename, e))
+            f.close()
 
         # look for kernel arguments we know should be preserved and add them
-        ourargs = ["speakup_synth=", "apic", "noapic", "apm=", "ide=nodma", "noht", "acpi=", "video=", "pci=", "nodmraid", "nompath"]
+        ourargs = ["speakup_synth=", "apic", "noapic", "apm=", "ide=nodma", 
+                   "noht", "acpi=", "video=", "pci=", "nodmraid", "nompath"]
         f = open("/proc/cmdline")
         cmdline = f.read()[:-1]
         f.close()
@@ -124,10 +126,10 @@
         for arg in cmdlineargs:
             for check in ourargs:
                 if arg.startswith(check):
-                    if str: str = str + " "
-                    str = str + arg
+                    newArgs.append( arg )
+
+        self.args = " ".join( newArgs )
 
-        self.args = str
 
 class BootImages:
     # returns dictionary of (label, longlabel, devtype) pairs indexed by device
@@ -585,7 +587,7 @@
     def write(self, instRoot, fsset, bl, langs, kernelList, chainList,
             defaultDev, justConfig, intf):
         if len(kernelList) >= 1:
-            str = self.writeLilo(instRoot, fsset, bl, langs, kernelList, 
+            out = self.writeLilo(instRoot, fsset, bl, langs, kernelList, 
                                  chainList, defaultDev, justConfig)
         else:
             self.noKernelsWarn(intf)
@@ -645,9 +647,9 @@
             salt = "$1$"
             saltLen = 8
 
+            saltPot = string.letters + string.digits +'./'
             for i in range(saltLen):
-                salt = salt + random.choice (string.letters +
-                                             string.digits + './')
+                salt += random.choice( saltPot )
 
             self.password = crypt.crypt (val, salt)
             self.pure = val
@@ -1194,7 +1196,7 @@
         if len(kernelList) < 1:
             self.noKernelsWarn(intf)
 
-        str = self.writeGrub(instRoot, fsset, bl, langs, kernelList, 
+        out = self.writeGrub(instRoot, fsset, bl, langs, kernelList, 
                              chainList, defaultDev,
                              justConfig | (not self.useGrubVal))
         # XXX move the lilo.conf out of the way if they're using GRUB
@@ -1390,10 +1392,10 @@
 
     def write(self, instRoot, fsset, bl, langs, kernelList, chainList,
             defaultDev, justConfig, intf):
-        str = self.writeZipl(instRoot, fsset, bl, langs, kernelList, 
+        out = self.writeZipl(instRoot, fsset, bl, langs, kernelList, 
                              chainList, defaultDev,
                              justConfig | (not self.useZiplVal))
-        str = self.writeChandevConf(bl, instRoot)
+        out = self.writeChandevConf(bl, instRoot)
     
     def __init__(self):
         bootloaderInfo.__init__(self)
@@ -1736,7 +1738,7 @@
     def write(self, instRoot, fsset, bl, langs, kernelList, chainList,
             defaultDev, justConfig, intf):
         if len(kernelList) >= 1:
-            str = self.writeYaboot(instRoot, fsset, bl, langs, kernelList, 
+            out = self.writeYaboot(instRoot, fsset, bl, langs, kernelList, 
                                  chainList, defaultDev, justConfig)
         else:
             self.noKernelsWarn(intf)
@@ -1989,6 +1991,8 @@
 
         backup = "%s/backup.b" % (cfPath,)
         sbinargs = ["/sbin/silo", "-f", "-C", cf, "-S", backup]
+        # TODO!!!  FIXME!!!  XXX!!!
+        # butil is not defined!!!  - assume this is in rhpl now?
         if butil.getSparcMachine() == "sun4u":
             sbinargs += ["-u"]
         else:

[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