diff options
author | Erik Troan <ewt@redhat.com> | 1999-08-28 18:12:37 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-08-28 18:12:37 +0000 |
commit | 4d440156c3f24acbc056dfaa2f3c412e23ef0500 (patch) | |
tree | d28feb61b3da8ed00c8b7f7253b07689be01f34f | |
parent | 8fbbbbffa52d810e4360355aecb1bb5ee5d82d1e (diff) | |
download | anaconda-4d440156c3f24acbc056dfaa2f3c412e23ef0500.tar.gz anaconda-4d440156c3f24acbc056dfaa2f3c412e23ef0500.tar.xz anaconda-4d440156c3f24acbc056dfaa2f3c412e23ef0500.zip |
first pass at install classes
-rwxr-xr-x | anaconda | 4 | ||||
-rw-r--r-- | comps.py | 3 | ||||
-rw-r--r-- | text.py | 122 | ||||
-rw-r--r-- | todo.py | 33 |
4 files changed, 112 insertions, 50 deletions
@@ -4,6 +4,7 @@ import sys, getopt, os import gettext import traceback import string +from installclass import CustomInstall setverPath = None @@ -155,7 +156,8 @@ if forceMount: try: todo = ToDo(intf, method, rootPath, installSystem = installPackages, - setupFilesystems = setupFilesystems, mouse = mouseInfo) + setupFilesystems = setupFilesystems, mouse = mouseInfo, + instClass = CustomInstall()) intf.run(todo, test = test) except: (type, value, tb) = sys.exc_info() @@ -107,6 +107,9 @@ class ComponentSet: return self.comps[key] return self.compsDict[key] + def keys(self): + return self.compsDict.keys() + def readCompsFile(self, arch, filename, packages): file = urllib.urlopen(filename) lines = file.readlines() @@ -8,6 +8,7 @@ import time import gettext import glob from newtpyfsedit import fsedit +import installclass INSTALL_OK = 0 INSTALL_BACK = -1 @@ -136,20 +137,26 @@ class KeyboardWindow: class InstallPathWindow: def __call__ (self, screen, todo, intf): - rc = ButtonChoiceWindow(screen, _("Installation Path"), - _("Would you like to install a new system " - "or upgrade a system which already contains " - "Red Hat Linux 2.0 or later?"), - buttons = [_("Install"), _("Upgrade"), _("Back")], width = 35) - - if rc == string.lower(_("Back")): + choices = [ _("Install GNOME Workstation"), + _("Install KDE Workstation"), + _("Install Server System"), + _("Install Custom System"), + _("Upgrade Existing Installation") ] + (button, choice) = ListboxChoiceWindow(screen, _("Installation Type"), + _("What type of system would you like to install?"), + choices, [(_("OK"), "ok"), (_("Back"), "back")], + width = 40) + + if button == "back": return INSTALL_BACK - if rc == string.lower(_("Upgrade")): + if (choice == 4): intf.steps = intf.commonSteps + intf.upgradeSteps todo.upgrade = 1 else: intf.steps = intf.commonSteps + intf.installSteps todo.upgrade = 0 + if (choice == 0): + todo.setClass(installclass.Workstation()) return INSTALL_OK class UpgradeExamineWindow: @@ -1016,14 +1023,14 @@ class InstallWindow: class FinishedWindow: def __call__ (self, screen): rc = ButtonChoiceWindow (screen, _("Complete"), - _("Congratulations, installation is complete.\n\n" - "Remove the boot media and " - "press return to reboot. For information on fixes which are " - "available for this release of Red Hat Linux, consult the " - "Errata available from http://www.redhat.com.\n\n" - "Information on configuring your system is available in the post " - "install chapter of the Official Red Hat Linux User's Guide."), - [ _("OK") ]) + _("Congratulations, installation is complete.\n\n" + "Remove the boot media and " + "press return to reboot. For information on fixes which are " + "available for this release of Red Hat Linux, consult the " + "Errata available from http://www.redhat.com.\n\n" + "Information on configuring your system is available in the post " + "install chapter of the Official Red Hat Linux User's Guide."), + [ _("OK") ]) return INSTALL_OK class BootdiskWindow: @@ -1032,10 +1039,10 @@ class BootdiskWindow: return INSTALL_NOOP rc = ButtonChoiceWindow (screen, _("Bootdisk"), - _("Insert a blank floppy in the first floppy drive. " - "All data on this disk will be erased during creation " - "of the boot disk."), - [ _("OK"), _("Skip") ]) + _("Insert a blank floppy in the first floppy drive. " + "All data on this disk will be erased during creation " + "of the boot disk."), + [ _("OK"), _("Skip") ]) if rc == string.lower (_("Skip")): return INSTALL_OK @@ -1044,10 +1051,10 @@ class BootdiskWindow: todo.makeBootdisk () except: rc = ButtonChoiceWindow (screen, _("Error"), - _("An error occured while making the boot disk. " - "Please make sure that there is a formatted floppy " - "in the first floppy drive."), - [ _("OK"), _("Skip")] ) + _("An error occured while making the boot disk. " + "Please make sure that there is a formatted floppy " + "in the first floppy drive."), + [ _("OK"), _("Skip")] ) if rc == string.lower (_("Skip")): break continue @@ -1297,30 +1304,40 @@ class InstallInterface: [_("Language Selection"), LanguageWindow, (self.screen, todo)], [_("Keyboard Selection"), KeyboardWindow, (self.screen, todo)], [_("Welcome"), WelcomeWindow, (self.screen,)], - [_("Installation Path"), InstallPathWindow, (self.screen, todo, self)], + [_("Installation Type"), InstallPathWindow, (self.screen, todo, self)], ] self.installSteps = [ - [_("Network Setup"), NetworkWindow, (self.screen, todo)], + [_("Network Setup"), NetworkWindow, (self.screen, todo), + "network"], [_("Time zone Setup"), TimezoneWindow, (self.screen, todo, test)], - [_("Hostname Setup"), HostnameWindow, (self.screen, todo)], + [_("Hostname Setup"), HostnameWindow, (self.screen, todo), + "hostname"], [_("Partition"), PartitionWindow, (self.screen, todo)], [_("Filesystem Formatting"), FormatWindow, (self.screen, todo)], - [_("Package Groups"), PackageGroupWindow, (self.screen, todo, self.individual)], - [_("Individual Packages"), IndividualPackageWindow, (self.screen, todo, self.individual)], + [_("Package Groups"), PackageGroupWindow, + (self.screen, todo, self.individual), "package-selection" ], + [_("Individual Packages"), IndividualPackageWindow, + (self.screen, todo, self.individual), "package-selection" ], [_("Package Dependencies"), PackageDepWindow, (self.screen, todo)], [_("Mouse Configuration"), MouseWindow, (self.screen, todo)], [_("Mouse Configuration"), MouseDeviceWindow, (self.screen, todo)], - [_("Authentication"), AuthConfigWindow, (self.screen, todo)], + [_("Authentication"), AuthConfigWindow, (self.screen, todo), + "authentication" ], [_("Root Password"), RootPasswordWindow, (self.screen, todo)], [_("User Account Setup"), UsersWindow, (self.screen, todo)], - [_("Boot Disk"), BootDiskWindow, (self.screen, todo)], - [_("LILO Configuration"), LiloWindow, (self.screen, todo)], - [_("LILO Configuration"), LiloImagesWindow, (self.screen, todo)], + [_("Boot Disk"), BootDiskWindow, (self.screen, todo), + "bootdisk" ], + [_("LILO Configuration"), LiloWindow, + (self.screen, todo), "lilo"], + [_("LILO Configuration"), LiloImagesWindow, + (self.screen, todo), "lilo"], [_("Installation Begins"), BeginInstallWindow, (self.screen, todo)], - [_("Install System"), InstallWindow, (self.screen, todo)], - [_("Bootdisk"), BootdiskWindow, (self.screen, todo)], - [_("Installation Complete"), FinishedWindow, (self.screen,)] + [_("Install System"), InstallWindow, (self.screen, todo), + "install-pause"], + [_("Bootdisk"), BootdiskWindow, (self.screen, todo), "bootdisk"], + [_("Installation Complete"), FinishedWindow, (self.screen,), + "complete" ] ] self.upgradeSteps = [ @@ -1334,18 +1351,27 @@ class InstallInterface: self.steps = self.commonSteps while self.step >= 0 and self.step < len(self.steps) and self.steps[self.step]: - # clear out the old root text by writing spaces in the blank - # area on the right side of the screen - self.screen.drawRootText (len(self.welcomeText), 0, - (self.screen.width - len(self.welcomeText)) * " ") - self.screen.drawRootText (0 - len(self.steps[self.step][0]), - 0, self.steps[self.step][0]) - rc = apply (self.steps[self.step][1](), self.steps[self.step][2]) - if rc == -1: - dir = -1 - elif rc == 0: - dir = 1 - self.step = self.step + dir + step = self.steps[self.step] + + rc = INSTALL_OK + if (len(step) == 4): + if (todo.instClass.skipStep(step[3])): + rc = INSTALL_NOOP + + if (rc != INSTALL_NOOP): + # clear out the old root text by writing spaces in the blank + # area on the right side of the screen + self.screen.drawRootText (len(self.welcomeText), 0, + (self.screen.width - len(self.welcomeText)) * " ") + self.screen.drawRootText (0 - len(step[0]), + 0, step[0]) + rc = apply (step[1](), step[2]) + + if rc == -1: + dir = -1 + elif rc == 0: + dir = 1 + self.step = self.step + dir self.screen.finish () def killSelf(screen): @@ -271,7 +271,7 @@ rpmFD = None class ToDo: def __init__(self, intf, method, rootPath, setupFilesystems = 1, - installSystem = 1, mouse = None): + installSystem = 1, mouse = None, instClass = None): self.intf = intf self.method = method self.mounts = {} @@ -296,6 +296,9 @@ class ToDo: self.lilo = LiloConfiguration() self.initrdsMade = {} self.liloImages = {} + if (not instClass): + raise TypeError, "installation class expected" + self.setClass(instClass) def umountFilesystems(self): if (not self.setupFilesystems): return @@ -586,9 +589,23 @@ class ToDo: if (self.hdList.has_key('kernel-smp') and isys.smpAvailable()): self.hdList['kernel-smp'].selected = 1 + + self.updateInstClassComps() return self.comps + def updateInstClassComps(self): + # don't load it just for this + if (not self.comps): return + group = self.instClass.getGroups() + if (group == None): return 0 + for n in self.comps.keys(): + self.comps[n].select(0) + + self.comps['Base'].select(1) + for n in group: + self.comps[n].select(1) + def writeNetworkConfig (self): # /etc/sysconfig/network-scripts/ifcfg-* for dev in self.network.netdevices.values (): @@ -765,6 +782,20 @@ class ToDo: def rpmError (todo): todo.instLog.write (rpm.errorString () + "\n") + + def setClass(todo, instClass): + todo.instClass = instClass + todo.hostname = todo.instClass.getHostname() + todo.updateInstClassComps() + ( useShadow, useMd5, useNIS, nisDomain, nisBroadcast, + nisServer) = todo.instClass.getAuthentication() + todo.auth.useShadow = useShadow + todo.auth.useMD5 = useMd5 + todo.auth.useNIS = useNIS + todo.auth.domain = nisDomain + todo.auth.useBroadcast = nisBroadcast + todo.auth.server = nisServer + todo.bootdisk = todo.instClass.getMakeBootdisk() def doInstall(self): # make sure we have the header list and comps file |