[PATCH] Format PReP partition

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

 



This fixes two bugs.  The first is that the PReP partition is not created
during a text mode install.  The second is that the PReP partition needs
to be zeroed out before grub is run.  Grub verifies that no data exists
on the partition before installation.

---
 pyanaconda/storage/formats/prepboot.py |   28 ++++++++++++++++++++++++++++
 pyanaconda/storage/partitioning.py     |    3 ++-
 2 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/pyanaconda/storage/formats/prepboot.py b/pyanaconda/storage/formats/prepboot.py
index b7d1c60..b8d8490 100644
--- a/pyanaconda/storage/formats/prepboot.py
+++ b/pyanaconda/storage/formats/prepboot.py
@@ -23,6 +23,9 @@
 from ..errors import *
 from . import DeviceFormat, register_device_format
 from parted import PARTITION_PREP
+import os
+import logging
+log = logging.getLogger("storage")
 
 class PPCPRePBoot(DeviceFormat):
     """ Generic device format. """
@@ -46,6 +49,31 @@ class PPCPRePBoot(DeviceFormat):
         """
         DeviceFormat.__init__(self, *args, **kwargs)
 
+    def create(self, *args, **kwargs):
+        if self.exists:
+            raise FSError("filesystem already exists")
+
+        DeviceFormat.create(self, *args, **kwargs)
+
+        try:
+            fd = os.open(self.device, os.O_RDWR)
+            length = os.lseek(fd, 0, os.SEEK_END)
+            os.lseek(fd, 0, os.SEEK_SET)
+            buf = '\0' * 1024 * 1024
+            while length > 0:
+                if length >= len(buf):
+                     os.write(fd, buf)
+                     length -= len(buf)
+                else:
+                     buf = '0' * length
+                     os.write(fd, buf)
+                     length = 0
+            os.close(fd)
+        except Exception as e:
+            log.error("error zeroing out %s: %s" % (self.device, e))
+            if fd:
+                os.close(fd)
+
     @property
     def status(self):
         return False
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 49faa78..c380b0c 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -120,7 +120,8 @@ def _schedulePartitions(storage, disks):
 
         if request.fstype is None:
             request.fstype = storage.defaultFSType
-        elif request.fstype == "prepboot" and storage.bootLoaderDevice:
+        elif request.fstype == "prepboot" and storage.bootLoaderDevice and \
+             storage.bootLoaderDevice != storage.bootDevice:
             # there should never be a need for more than one of these
             # partitions, so skip them.
             log.info("skipping unneeded stage1 prepboot request")
-- 
1.7.7.6

_______________________________________________
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