--- anaconda | 3 +- backend.py | 22 ++---- bootloader.py | 18 ++---- flags.py | 1 - iw/upgrade_swap_gui.py | 3 +- packages.py | 185 ++++++++++++++++++++++++------------------------ storage/__init__.py | 3 +- textw/upgrade_text.py | 3 +- upgrade.py | 156 ++++++++++++++++++---------------------- yuminstall.py | 61 ++++++++-------- 10 files changed, 208 insertions(+), 247 deletions(-) diff --git a/anaconda b/anaconda index 4aa002a..e1e9770 100755 --- a/anaconda +++ b/anaconda @@ -71,8 +71,7 @@ def startMiniWM(root='/'): def doStartupX11Actions(runres="800x600"): global miniwm_pid - if flags.setupFilesystems: - setupGraphicalLinks() + setupGraphicalLinks() # now start up mini-wm try: diff --git a/backend.py b/backend.py index 08e3ce7..5c4232a 100644 --- a/backend.py +++ b/backend.py @@ -107,8 +107,7 @@ class AnacondaBackend: storage.writeEscrowPackets(anaconda) sys.stdout.flush() - if flags.setupFilesystems: - syslog.stop() + syslog.stop() def doInstall(self, anaconda): log.warning("doInstall not implemented for backend!") @@ -133,16 +132,12 @@ class AnacondaBackend: self.instLog = open(instLogName, "w+") - # dont start syslogd if we arent creating filesystems - if flags.setupFilesystems: - syslogname = "%s%s.syslog" % (instPath, logname) - try: - shutil.rmtree (syslogname) - except OSError: - pass - syslog.start (instPath, syslogname) - else: - syslogname = None + syslogname = "%s%s.syslog" % (instPath, logname) + try: + shutil.rmtree (syslogname) + except OSError: + pass + syslog.start (instPath, syslogname) if upgrade: self.modeText = _("Upgrading %s\n") @@ -150,9 +145,6 @@ class AnacondaBackend: self.modeText = _("Installing %s\n") def mountInstallImage(self, anaconda, installimg): - if not flags.setupFilesystems: - return - if self._loopbackFile and os.path.exists(self._loopbackFile): return diff --git a/bootloader.py b/bootloader.py index 729fe2c..5ef6729 100644 --- a/bootloader.py +++ b/bootloader.py @@ -139,8 +139,6 @@ def writeBootloader(anaconda): isys.sync() isys.sync() - justConfigFile = not flags.setupFilesystems - if anaconda.id.bootloader.defaultDevice == -1: return @@ -157,9 +155,7 @@ def writeBootloader(anaconda): else: anaconda.id.bootloader.doUpgradeOnly = 0 - # We don't need to let the user know if we're just doing the bootloader. - if not justConfigFile: - w = anaconda.intf.waitWindow(_("Bootloader"), _("Installing bootloader.")) + w = anaconda.intf.waitWindow(_("Bootloader"), _("Installing bootloader.")) kernelList = [] otherList = [] @@ -185,8 +181,7 @@ def writeBootloader(anaconda): if kernelLabel is None: log.error("unable to find default image, bailing") - if not justConfigFile: - w.pop() + w.pop() return plainLabelUsed = 0 @@ -219,18 +214,15 @@ def writeBootloader(anaconda): dosync() try: rc = anaconda.id.bootloader.write(anaconda.rootPath, anaconda.id.bootloader, - kernelList, otherList, defaultDev, - justConfigFile) - if not justConfigFile: - w.pop() + kernelList, otherList, defaultDev) + w.pop() if rc and anaconda.intf: anaconda.intf.messageWindow(_("Warning"), _("There was an error installing the bootloader. " "The system may not be bootable.")) except booty.BootyNoKernelWarning: - if not justConfigFile: - w.pop() + w.pop() if anaconda.intf: anaconda.intf.messageWindow(_("Warning"), _("No kernel packages were installed on the " diff --git a/flags.py b/flags.py index 1aabe8e..17bc2e0 100644 --- a/flags.py +++ b/flags.py @@ -72,7 +72,6 @@ class Flags: self.__dict__['flags']['ibft'] = 1 self.__dict__['flags']['iscsi'] = 0 self.__dict__['flags']['serial'] = 0 - self.__dict__['flags']['setupFilesystems'] = 1 self.__dict__['flags']['autostep'] = 0 self.__dict__['flags']['autoscreenshot'] = 0 self.__dict__['flags']['usevnc'] = 0 diff --git a/iw/upgrade_swap_gui.py b/iw/upgrade_swap_gui.py index 247137b..2dee9ba 100644 --- a/iw/upgrade_swap_gui.py +++ b/iw/upgrade_swap_gui.py @@ -65,8 +65,7 @@ class UpgradeSwapWindow (InstallWindow): raise gui.StayOnScreen else: - if flags.setupFilesystems: - self.storage.createSwapFile(dev, val) + self.storage.createSwapFile(dev, val) self.dispatch.skipStep("addswap", 1) return None diff --git a/packages.py b/packages.py index a298b55..36fab07 100644 --- a/packages.py +++ b/packages.py @@ -87,100 +87,99 @@ def turnOnFilesystems(anaconda): anaconda.id.storage.umountFilesystems() return DISPATCH_NOOP - if flags.setupFilesystems: - if not anaconda.id.upgrade: - if not anaconda.id.storage.fsset.active: - # turn off any swaps that we didn't turn on - # needed for live installs - iutil.execWithRedirect("swapoff", ["-a"], - stdout = "/dev/tty5", stderr="/dev/tty5", - searchPath = 1) - anaconda.id.storage.devicetree.teardownAll() - - upgrade_migrate = False - if anaconda.id.upgrade: - for d in anaconda.id.storage.migratableDevices: - if d.format.migrate: - upgrade_migrate = True - - title = None - message = None - details = None + if not anaconda.id.upgrade: + if not anaconda.id.storage.fsset.active: + # turn off any swaps that we didn't turn on + # needed for live installs + iutil.execWithRedirect("swapoff", ["-a"], + stdout = "/dev/tty5", stderr="/dev/tty5", + searchPath = 1) + anaconda.id.storage.devicetree.teardownAll() + + upgrade_migrate = False + if anaconda.id.upgrade: + for d in anaconda.id.storage.migratableDevices: + if d.format.migrate: + upgrade_migrate = True + + title = None + message = None + details = None - try: - anaconda.id.storage.doIt() - except DeviceResizeError as (msg, device): - # XXX does this make any sense? do we support resize of - # devices other than partitions? - title = _("Device Resize Failed") - message = _("An error was encountered while " - "resizing device %s.") % (device,) - details = msg - except DeviceCreateError as (msg, device): - title = _("Device Creation Failed") - message = _("An error was encountered while " - "creating device %s.") % (device,) - details = msg - except DeviceDestroyError as (msg, device): - title = _("Device Removal Failed") - message = _("An error was encountered while " - "removing device %s.") % (device,) - details = msg - except DeviceError as (msg, device): - title = _("Device Setup Failed") - message = _("An error was encountered while " - "setting up device %s.") % (device,) - details = msg - except FSResizeError as (msg, device): - title = _("Resizing Failed") - message = _("There was an error encountered while " - "resizing the device %s.") % (device,) - - if os.path.exists("/tmp/resize.out"): - details = open("/tmp/resize.out", "r").read() - else: - details = "%s" %(msg,) - except FSMigrateError as (msg, device): - title = _("Migration Failed") - message = _("An error was encountered while " - "migrating filesystem on device %s.") % (device,) - details = msg - except FormatCreateError as (msg, device): - title = _("Formatting Failed") - message = _("An error was encountered while " - "formatting device %s.") % (device,) - details = msg - except Exception as e: - # catch-all - title = _("Storage Activation Failed") - message = _("An error was encountered while " - "activating your storage configuration.") - details = str(e) - - if title: - rc = anaconda.intf.detailedMessageWindow(title, message, details, - type = "custom", - custom_buttons = [_("_File Bug"), _("_Exit installer")]) - - if rc == 0: - raise - elif rc == 1: - sys.exit(1) - - if not anaconda.id.upgrade: - anaconda.id.storage.turnOnSwap() - anaconda.id.storage.mountFilesystems(raiseErrors=False, - readOnly=False, - skipRoot=anaconda.backend.skipFormatRoot) + try: + anaconda.id.storage.doIt() + except DeviceResizeError as (msg, device): + # XXX does this make any sense? do we support resize of + # devices other than partitions? + title = _("Device Resize Failed") + message = _("An error was encountered while " + "resizing device %s.") % (device,) + details = msg + except DeviceCreateError as (msg, device): + title = _("Device Creation Failed") + message = _("An error was encountered while " + "creating device %s.") % (device,) + details = msg + except DeviceDestroyError as (msg, device): + title = _("Device Removal Failed") + message = _("An error was encountered while " + "removing device %s.") % (device,) + details = msg + except DeviceError as (msg, device): + title = _("Device Setup Failed") + message = _("An error was encountered while " + "setting up device %s.") % (device,) + details = msg + except FSResizeError as (msg, device): + title = _("Resizing Failed") + message = _("There was an error encountered while " + "resizing the device %s.") % (device,) + + if os.path.exists("/tmp/resize.out"): + details = open("/tmp/resize.out", "r").read() else: - if upgrade_migrate: - # we should write out a new fstab with the migrated fstype - shutil.copyfile("%s/etc/fstab" % anaconda.rootPath, - "%s/etc/fstab.anaconda" % anaconda.rootPath) - anaconda.id.storage.fsset.write(anaconda.rootPath) - - # and make sure /dev is mounted so we can read the bootloader - bindMountDevDirectory(anaconda.rootPath) + details = "%s" %(msg,) + except FSMigrateError as (msg, device): + title = _("Migration Failed") + message = _("An error was encountered while " + "migrating filesystem on device %s.") % (device,) + details = msg + except FormatCreateError as (msg, device): + title = _("Formatting Failed") + message = _("An error was encountered while " + "formatting device %s.") % (device,) + details = msg + except Exception as e: + # catch-all + title = _("Storage Activation Failed") + message = _("An error was encountered while " + "activating your storage configuration.") + details = str(e) + + if title: + rc = anaconda.intf.detailedMessageWindow(title, message, details, + type = "custom", + custom_buttons = [_("_File Bug"), _("_Exit installer")]) + + if rc == 0: + raise + elif rc == 1: + sys.exit(1) + + if not anaconda.id.upgrade: + anaconda.id.storage.turnOnSwap() + anaconda.id.storage.mountFilesystems(raiseErrors=False, + readOnly=False, + skipRoot=anaconda.backend.skipFormatRoot) + else: + if upgrade_migrate: + # we should write out a new fstab with the migrated fstype + shutil.copyfile("%s/etc/fstab" % anaconda.rootPath, + "%s/etc/fstab.anaconda" % anaconda.rootPath) + anaconda.id.storage.fsset.write(anaconda.rootPath) + + # and make sure /dev is mounted so we can read the bootloader + bindMountDevDirectory(anaconda.rootPath) def setupTimezone(anaconda): diff --git a/storage/__init__.py b/storage/__init__.py index ea89633..6a24de1 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -1242,8 +1242,7 @@ def mountExistingSystem(anaconda, rootEnt, if rc == 0: return -1 - if flags.setupFilesystems: - fsset.mountFilesystems(anaconda, readOnly=readOnly, skipRoot=True) + fsset.mountFilesystems(anaconda, readOnly=readOnly, skipRoot=True) class BlkidTab(object): diff --git a/textw/upgrade_text.py b/textw/upgrade_text.py index 0d2fc03..f944c72 100644 --- a/textw/upgrade_text.py +++ b/textw/upgrade_text.py @@ -189,8 +189,7 @@ class UpgradeSwapWindow: "and 2000 MB in size.")) else: screen.popWindow() - if flags.setupFilesystems: - anaconda.id.storage.createSwapFile(dev, val) + anaconda.id.storage.createSwapFile(dev, val) anaconda.dispatch.skipStep("addswap", 1) return INSTALL_OK diff --git a/upgrade.py b/upgrade.py index c751533..b56c062 100644 --- a/upgrade.py +++ b/upgrade.py @@ -91,12 +91,6 @@ def findRootParts(anaconda): anaconda.dispatch.skipStep("installtype", skip = 0) def findExistingRoots(anaconda, upgradeany=False): - if not flags.setupFilesystems: - (prod, ver) = getReleaseString (anaconda.rootPath) - if flags.cmdline.has_key("upgradeany") or upgradeany or anaconda.id.instClass.productUpgradable(prod, ver): - return [(anaconda.rootPath, "")] - return [] - rootparts = findExistingRootDevices(anaconda, upgradeany=upgradeany) return rootparts @@ -150,7 +144,7 @@ def upgradeSwapSuggestion(anaconda): if not device.format: continue if device.format.mountable and device.format.linuxNative: - if flags.setupFilesystems and not device.format.status: + if not device.format.status: continue space = isys.pathSpaceAvailable(anaconda.rootPath + device.format.mountpoint) if space > 16: @@ -174,90 +168,80 @@ def upgradeSwapSuggestion(anaconda): def upgradeMountFilesystems(anaconda): # mount everything and turn on swap - if flags.setupFilesystems: - try: - mountExistingSystem(anaconda, - anaconda.id.upgradeRoot[0], - allowDirty = 0) - except ValueError as e: - log.error("Error mounting filesystem: %s" % e) - anaconda.intf.messageWindow(_("Mount failed"), - _("The following error occurred when mounting the file " - "systems listed in /etc/fstab. Please fix this problem " - "and try to upgrade again.\n%s" % e)) - sys.exit(0) - except IndexError as e: - # The upgrade root is search earlier but we give the message here. - log.debug("No upgrade root was found.") - if anaconda.isKickstart and anaconda.id.ksdata.upgrade.upgrade: - anaconda.intf.messageWindow(_("Upgrade root not found"), + try: + mountExistingSystem(anaconda, + anaconda.id.upgradeRoot[0], + allowDirty = 0) + except ValueError as e: + log.error("Error mounting filesystem: %s" % e) + anaconda.intf.messageWindow(_("Mount failed"), + _("The following error occurred when mounting the file " + "systems listed in /etc/fstab. Please fix this problem " + "and try to upgrade again.\n%s" % e)) + sys.exit(0) + except IndexError as e: + # The upgrade root is search earlier but we give the message here. + log.debug("No upgrade root was found.") + if anaconda.isKickstart and anaconda.id.ksdata.upgrade.upgrade: + anaconda.intf.messageWindow(_("Upgrade root not found"), + _("The root for the previously installed system was not " + "found."), type="custom", + custom_icon="info", + custom_buttons=[_("Exit installer")]) + sys.exit(0) + else: + rc = anaconda.intf.messageWindow(_("Upgrade root not found"), _("The root for the previously installed system was not " - "found."), type="custom", - custom_icon="info", - custom_buttons=[_("Exit installer")]) + "found. You can exit installer or backtrack to choose " + "installation instead of upgrade."), + type="custom", + custom_buttons = [ _("_Back"), + _("_Exit installer") ], + custom_icon="question") + if rc == 0: + return DISPATCH_BACK + elif rc == 1: sys.exit(0) - else: - rc = anaconda.intf.messageWindow(_("Upgrade root not found"), - _("The root for the previously installed system was not " - "found. You can exit installer or backtrack to choose " - "installation instead of upgrade."), - type="custom", - custom_buttons = [ _("_Back"), - _("_Exit installer") ], - custom_icon="question") - if rc == 0: - return DISPATCH_BACK - elif rc == 1: - sys.exit(0) - - checkLinks = ( '/etc', '/var', '/var/lib', '/var/lib/rpm', - '/boot', '/tmp', '/var/tmp', '/root', - '/bin/sh', '/usr/tmp') - badLinks = [] - for n in checkLinks: - if not os.path.islink(anaconda.rootPath + n): continue - l = os.readlink(anaconda.rootPath + n) - if l[0] == '/': - badLinks.append(n) - - if badLinks: - message = _("The following files are absolute symbolic " - "links, which we do not support during an " - "upgrade. Please change them to relative " - "symbolic links and restart the upgrade.\n\n") - for n in badLinks: - message = message + '\t' + n + '\n' - anaconda.intf.messageWindow(_("Absolute Symlinks"), message) - sys.exit(0) - - # fix for 80446 - badLinks = [] - mustBeLinks = ( '/usr/tmp', ) - for n in mustBeLinks: - if not os.path.islink(anaconda.rootPath + n): - badLinks.append(n) - - if badLinks: - message = _("The following are directories which should instead " - "be symbolic links, which will cause problems with the " - "upgrade. Please return them to their original state " - "as symbolic links and restart the upgrade.\n\n") - for n in badLinks: - message = message + '\t' + n + '\n' - anaconda.intf.messageWindow(_("Invalid Directories"), message) - sys.exit(0) - else: - if not os.access (anaconda.rootPath + "/etc/fstab", os.R_OK): - anaconda.intf.messageWindow(_("Warning"), - _("%s not found") - % (anaconda.rootPath + "/etc/fstab",), - type="ok") - return DISPATCH_BACK - - anaconda.id.storage.parseFSTab() - if flags.setupFilesystems: - anaconda.id.storage.turnOnSwap(upgrading=True) - anaconda.id.storage.mkDevRoot() + + checkLinks = ( '/etc', '/var', '/var/lib', '/var/lib/rpm', + '/boot', '/tmp', '/var/tmp', '/root', + '/bin/sh', '/usr/tmp') + badLinks = [] + for n in checkLinks: + if not os.path.islink(anaconda.rootPath + n): continue + l = os.readlink(anaconda.rootPath + n) + if l[0] == '/': + badLinks.append(n) + + if badLinks: + message = _("The following files are absolute symbolic " + "links, which we do not support during an " + "upgrade. Please change them to relative " + "symbolic links and restart the upgrade.\n\n") + for n in badLinks: + message = message + '\t' + n + '\n' + anaconda.intf.messageWindow(_("Absolute Symlinks"), message) + sys.exit(0) + + # fix for 80446 + badLinks = [] + mustBeLinks = ( '/usr/tmp', ) + for n in mustBeLinks: + if not os.path.islink(anaconda.rootPath + n): + badLinks.append(n) + + if badLinks: + message = _("The following are directories which should instead " + "be symbolic links, which will cause problems with the " + "upgrade. Please return them to their original state " + "as symbolic links and restart the upgrade.\n\n") + for n in badLinks: + message = message + '\t' + n + '\n' + anaconda.intf.messageWindow(_("Invalid Directories"), message) + sys.exit(0) + + anaconda.id.storage.turnOnSwap(upgrading=True) + anaconda.id.storage.mkDevRoot() # Move /etc/rpm/platform out of the way. if os.path.exists(anaconda.rootPath + "/etc/rpm/platform"): diff --git a/yuminstall.py b/yuminstall.py index 101a046..c6ea136 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1514,42 +1514,41 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon self.initLog(anaconda.id, anaconda.rootPath) - if flags.setupFilesystems: - # setup /etc/rpm/ for the post-install environment - iutil.writeRpmPlatform(anaconda.rootPath) + # setup /etc/rpm/ for the post-install environment + iutil.writeRpmPlatform(anaconda.rootPath) + try: + # FIXME: making the /var/lib/rpm symlink here is a hack to + # workaround db->close() errors from rpm + iutil.mkdirChain("/var/lib") + for path in ("/var/tmp", "/var/lib/rpm"): + if os.path.exists(path) and not os.path.islink(path): + shutil.rmtree(path) + if not os.path.islink(path): + os.symlink("%s/%s" %(anaconda.rootPath, path), "%s" %(path,)) + else: + log.warning("%s already exists as a symlink to %s" %(path, os.readlink(path),)) + except Exception, e: + # how this could happen isn't entirely clear; log it in case + # it does and causes problems later + log.error("error creating symlink, continuing anyway: %s" %(e,)) + + # SELinux hackery (#121369) + if flags.selinux: try: - # FIXME: making the /var/lib/rpm symlink here is a hack to - # workaround db->close() errors from rpm - iutil.mkdirChain("/var/lib") - for path in ("/var/tmp", "/var/lib/rpm"): - if os.path.exists(path) and not os.path.islink(path): - shutil.rmtree(path) - if not os.path.islink(path): - os.symlink("%s/%s" %(anaconda.rootPath, path), "%s" %(path,)) - else: - log.warning("%s already exists as a symlink to %s" %(path, os.readlink(path),)) + os.mkdir(anaconda.rootPath + "/selinux") except Exception, e: - # how this could happen isn't entirely clear; log it in case - # it does and causes problems later - log.error("error creating symlink, continuing anyway: %s" %(e,)) - - # SELinux hackery (#121369) - if flags.selinux: - try: - os.mkdir(anaconda.rootPath + "/selinux") - except Exception, e: - pass - try: - isys.mount("/selinux", anaconda.rootPath + "/selinux", "selinuxfs") - except Exception, e: - log.error("error mounting selinuxfs: %s" %(e,)) - - # For usbfs + pass try: - isys.mount("/proc/bus/usb", anaconda.rootPath + "/proc/bus/usb", "usbfs") + isys.mount("/selinux", anaconda.rootPath + "/selinux", "selinuxfs") except Exception, e: - log.error("error mounting usbfs: %s" %(e,)) + log.error("error mounting selinuxfs: %s" %(e,)) + + # For usbfs + try: + isys.mount("/proc/bus/usb", anaconda.rootPath + "/proc/bus/usb", "usbfs") + except Exception, e: + log.error("error mounting usbfs: %s" %(e,)) # write out the fstab if not upgrade: -- 1.6.5.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list