On Wed, 2011-10-26 at 09:59 -0400, David Cantrell wrote: > I second wwoods' comments and add my own. Likewise. Will was correct. I just have a couple of minor comments. > > On 10/25/11 16:48, Mark Hamzy wrote: > > Here is a proposed patch that updates a PowerPC's BIOS to boot from the > > newly installed hard disk rather than back to the installer. > > > > --- > > pyanaconda/bootloader.py | 11 +++++++ > > pyanaconda/platform.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 87 insertions(+) > > > > diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py > > index ca43868..e156be9 100644 > > --- a/pyanaconda/bootloader.py > > +++ b/pyanaconda/bootloader.py > > @@ -1832,6 +1832,17 @@ class IPSeriesYaboot(Yaboot): > > config.write("nonvram\n") # only on pSeries? > > config.write("fstype=raw\n") > > > > + # > > + # installation > > + # > > + > > + def install(self, install_root=""): > > + import platform > > + > > + platform.updatePowerPCBootList(self.storage) > > + > > + super(IPSeriesYaboot, self).install(install_root=install_root) > > + > > > > class MacYaboot(Yaboot): > > prog = "mkofboot" > > diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py > > index 82b4b55..779cb01 100644 > > --- a/pyanaconda/platform.py > > +++ b/pyanaconda/platform.py > > @@ -32,6 +32,9 @@ import gettext > > _ = lambda x: gettext.ldgettext("anaconda", x) > > N_ = lambda x: x > > > > +import logging > > +log = logging.getLogger("storage") > > + > > class Platform(object): > > """Platform > > > > @@ -322,3 +325,76 @@ def getPlatform(anaconda): > > return X86(anaconda) > > else: > > raise SystemError, "Could not determine system architecture." > > + > > +def updatePowerPCBootList(storage): > > + if not iutil.isPPC(): > > + # This function is only for PowerPC machines! > > + return > > + > > + # ofpathname relies on bc being installed! > > + rc = iutil.execWithRedirect("which", ["bc"], > > + stdout="/dev/null", stderr="/dev/hvc1", > > + root="/") > > + > > + if rc: > > + log.error ("FAIL: bc is not installed!") > > And this depends on 'which' in the installer environment, which is > entirely unnecessary. If bc is required for a successful ofpathname > run, we just need to ensure it's in the installer environment. > ofpathname can report bc not existing (it should if it doesn't). David is correct, but as a point of information we also have iutil.find_program_in_path("bc") which will return either the full path to the executable or None if it isn't present. > > > + > > + return > > + > > + buf = iutil.execWithCapture("nvram", > > + ["--print-config=boot-device"], > > + stderr="/dev/hvc1", > > + root="/") > > + > > + if len(buf) == 0: > > + log.error ("FAIL: nvram --print-config=boot-device") > > + > > + return > > + > > + boot_list = buf.strip ().split () > > + > > + log.debug ("updatePowerPCBootList: boot_list = %s" % boot_list) > > + > > + import parted > > + > > + prep_locations = [] > > + > > + for partition in storage.partitions: > > + if partition.getFlag(parted.PARTITION_PREP): > > + log.debug ("updatePowerPCBootList: %s partition is a prep partition" % > > partition.path) > > + > > + buf = iutil.execWithCapture("ofpathname", > > + [partition.path], > > + stderr="/dev/hvc1",\ > > + root="/") > > + > > + if len(buf) > 0: > > + of_location = buf.strip () > > + prep_locations += [of_location] > > + > > + else: > > + log.error ("FAIL: ofpathname %s" % partition.path) > > + > > + log.debug ("updatePowerPCBootList: prep_locations = %s" % prep_locations) > > + > > + # Right now, booting to a machine with only one PReP partition is easy. > > + # If there are two or more, then we would need a new dialog > > + if len(prep_locations) == 1: > > + boot_disk = prep_locations[0] > > + > > + # Place the disk containing the PReP partition first. > > + # Remove all other occurances of it. > > + boot_list = [boot_disk] + filter (lambda x: x != boot_disk, boot_list) > > + > > + log.debug ("updatePowerPCBootList: boot_list = %s" % boot_list) > > + > > + update_value = "boot-device=%s" % (" ".join (boot_list),) > > + > > + rc = iutil.execWithRedirect("nvram", ["--update-config", update_value], > > + stdout="/dev/hvc1", stderr="/dev/hvc1", > > + root="/") > > + if rc: > > + log.error ("FAIL: nvram --update-config %s" % update_value) > > + > > + else: > > + log.info ("Updated PPC boot list with the command: nvram > > --update-config %s" % update_value) > Normally we only alter the PReP partition that we're using to boot from, which is BootLoader.stage1_device. Dave _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list