diff options
author | Peter Jones <pjones@redhat.com> | 2007-01-16 20:02:04 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2007-01-16 20:02:04 +0000 |
commit | cf1d6d605c5db8173786720cfd2f0ad6df032878 (patch) | |
tree | 563804e297e912ba8b22eb539468ad1119d43444 | |
parent | 3e1cb15b411ba0fd11bff575bd9f5fe2675f3f3c (diff) | |
download | anaconda-cf1d6d605c5db8173786720cfd2f0ad6df032878.tar.gz anaconda-cf1d6d605c5db8173786720cfd2f0ad6df032878.tar.xz anaconda-cf1d6d605c5db8173786720cfd2f0ad6df032878.zip |
- label /boot/efi on install and upgrade (#218957)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | fsset.py | 94 | ||||
-rw-r--r-- | partRequests.py | 4 |
3 files changed, 100 insertions, 5 deletions
@@ -1,3 +1,10 @@ +2007-01-16 Peter Jones <pjones@redhat.com> + + * fsset.py: label /boot/efi on ia64 on both install and upgrade. Also + update fstab (#218957) + + * partRequests.py: set migrate bits for /boot/efi + 2007-01-16 Dave Lehman <dlehman@redhat.com> * yuminstall.py (doPostSelection): remove packages added to solve @@ -853,11 +853,13 @@ class FATFileSystem(FileSystemType): FileSystemType.__init__(self) self.partedFileSystemType = parted.file_system_type_get("fat32") self.formattable = 1 + self.supported = 1 self.checked = 0 self.maxSizeMB = 1024 * 1024 self.name = "vfat" self.packages = [ "dosfstools" ] self.maxLabelChars = 11 + self.migratetofs = ['vfat'] def formatDevice(self, entry, progress, chroot='/'): devicePath = entry.device.setupDevice(chroot) @@ -872,19 +874,94 @@ class FATFileSystem(FileSystemType): raise SystemError def labelDevice(self, entry, chroot): - if False and not rhpl.getArch() == 'ia64': + if not rhpl.getArch() == 'ia64': return devicePath = entry.device.setupDevice(chroot) label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars, kslabel = entry.label) - rc = iutil.execWithRedirect("/sbin/dosfslabel", [devicePath, label], + rc = iutil.execWithRedirect("dosfslabel", + [devicePath, label], stdout = "/dev/tty5", - stderr = "/dev/tty5") - if rc: - raise SystemError + stderr = "/dev/tty5", + searchPath = 1) + newLabel = iutil.execWithCapture("dosfslabel", [devicePath], + stderr = "/dev/tty5") + newLabel = newLabel.strip() + if label != newLabel: + raise SystemError, "dosfslabel failed on device %s" % (devicePath,) entry.setLabel(label) + def _readFstab(self, path): + f = open (path, "r") + lines = f.readlines () + f.close() + + fstab = [] + for line in lines: + fields = string.split(line) + + if not fields: + fstab.append(line) + continue + + if line[0] == "#": + fstab.append(line) + # skip all comments + continue + + # all valid fstab entries have 6 fields; if the last two are + # missing they are assumed to be zero per fstab(5) + if len(fields) < 4: + fstab.append(line) + continue + elif len(fields) == 4: + fields.append(0) + fields.append(0) + elif len(fields) == 5: + fields.append(0) + elif len(fields) > 6: + fstab.append(line) + continue + fstab.append(fields) + + return fstab + + def migrateFileSystem(self, entry, message, chroot='/'): + devicePath = entry.device.setupDevice(chroot) + + if not entry.fsystem or not entry.origfsystem: + raise RuntimeError, ("Trying to migrate fs w/o fsystem or " + "origfsystem set") + if entry.fsystem.getName() != "vfat": + raise RuntimeError, ("Trying to migrate vfat to something other " + "than vfat") + + self.labelDevice(entry, chroot) + + if not entry.label: + return + + mounts = self._readFstab(chroot + "/etc/fstab") + + changed = False + for mount in mounts: + if type(mount) == types.ListType: + if mount[0] == "/dev/%s" % (entry.device.getDevice(),): + mount[0] = "LABEL=%s" % (entry.label,) + changed = True + + if changed: + os.rename(chroot + "/etc/fstab", chroot + "/etc/fstab.anaconda") + f = open (chroot + "/etc/fstab", "w") + for mount in mounts: + if type(mount) == types.ListType: + mount = string.join(mount, "\t") + if mount[:-1] != "\n": + mount += "\n" + f.write(mount) + f.close() + fileSystemTypeRegister(FATFileSystem()) class NTFSFileSystem(FileSystemType): @@ -1657,6 +1734,8 @@ MAILADDR root try: self.labelEntry(entry, chroot) except SystemError: + devicePath = entry.device.setupDevice(chroot) + log.debug("failed to label device %s" % (devicePath,)) # should be OK, we'll still use the device name to mount. pass @@ -1687,6 +1766,11 @@ MAILADDR root if not entry.origfsystem: continue + if rhpl.getArch() == 'ia64' \ + and entry.getMountPoint() == "/boot/efi" \ + and isinstance(entry.origfsystem, FATFileSystem): + entry.setMigrate(1) + if not entry.origfsystem.isMigratable() or not entry.getMigrate(): continue try: diff --git a/partRequests.py b/partRequests.py index 70045c32b..61d032579 100644 --- a/partRequests.py +++ b/partRequests.py @@ -207,6 +207,10 @@ class RequestSpec: if self.migrate: entry.setMigrate(self.migrate) + elif rhpl.getArch() == "ia64" \ + and entry.getMountPoint() == "/boot/efi" \ + and isinstance(self.origfstype, fsset.FATFileSystem): + entry.setMigrate(1) if self.badblocks: entry.setBadblocks(self.badblocks) |