diff options
-rw-r--r-- | installclass.py | 4 | ||||
-rw-r--r-- | kickstart.py | 66 | ||||
-rw-r--r-- | packages.py | 6 |
3 files changed, 61 insertions, 15 deletions
diff --git a/installclass.py b/installclass.py index 46a5ea08c..675b784c5 100644 --- a/installclass.py +++ b/installclass.py @@ -162,13 +162,13 @@ class BaseInstallClass: dispatch.skipStep("fdasd", permanent = 1) # This is called after the hdlist is read in. - def setPackageSelection(self, hdlist): + def setPackageSelection(self, hdlist, intf): pass # This is called after the comps is read in (after setPackageSelection()). # It can both select groups, change the default selection for groups, and # change which groups are hidden. - def setGroupSelection(self, comps): + def setGroupSelection(self, comps, intf): pass # this is a utility function designed to be called from setGroupSelection() diff --git a/kickstart.py b/kickstart.py index 1539dc00f..42df57249 100644 --- a/kickstart.py +++ b/kickstart.py @@ -25,6 +25,11 @@ import raid import string import partRequests +from rhpl.translate import _ + +KS_MISSING_PROMPT = 0 +KS_MISSING_IGNORE = 1 + class Script: def __repr__(self): str = ("(s: '%s' i: %s c: %d)") % \ @@ -623,10 +628,13 @@ class KickstartBase(BaseInstallClass): continue if len(args) > 1: - if args[1] == "--resolvedeps": - id.handleDeps = RESOLVE_DEPS - elif args[1] == "--ignoredeps": - id.handleDeps = IGNORE_DEPS + for arg in args[1:]: + if arg == "--resolvedeps": + id.handleDeps = RESOLVE_DEPS + elif arg == "--ignoredeps": + id.handleDeps = IGNORE_DEPS + elif arg == "--ignoremissing": + self.handleMissing = KS_MISSING_IGNORE where = "packages" self.skipSteps.append("package-selection") @@ -1119,20 +1127,56 @@ class KickstartBase(BaseInstallClass): # Note that this assumes setGroupSelection() is called after # setPackageSelection() - def setPackageSelection(self, hdlist): + def setPackageSelection(self, hdlist, intf): for pkg in hdlist.keys(): hdlist[pkg].setState((0, 0)) for n in self.packageList: - hdlist[n].select() + if hdlist.has_key(n): + hdlist[n].select() + elif self.handleMissing == KS_MISSING_IGNORE: + log("package %s doesn't exist, ignoring" %(n,)) + else: + rc = intf.messageWindow(_("Missing Package"), + _("You have specified that the " + "package '%s' should be installed. " + "This package does not exist. " + "Would you like to continue or " + "abort your installation?") %(n,), + type="custom", + custom_buttons=[_("_Abort"), + _("_Continue")]) + if rc == 0: + sys.exit(1) + else: + pass + - def setGroupSelection(self, comps): + def setGroupSelection(self, comps, intf): for comp in comps: comp.unselect() comps['Base'].select() for n in self.groupList: - comps[n].select() + if comps.has_key(n): + comps[n].select() + elif self.handleMissing == KS_MISSING_IGNORE: + log("group %s doesn't exist, ignoring" %(n,)) + else: + rc = intf.messageWindow(_("Missing Group"), + _("You have specified that the " + "group '%s' should be installed. " + "This package does not exist. " + "Would you like to continue or " + "abort your installation?") %(n,), + type="custom", + custom_buttons=[_("_Abort"), + _("_Continue")]) + if rc == 0: + sys.exit(1) + else: + pass + for n in self.excludedList: if comps.packages.has_key(n): @@ -1153,7 +1197,11 @@ class KickstartBase(BaseInstallClass): self.ksPVMapping = {} self.ksVGMapping = {} # XXX hack to give us a starting point for RAID, LVM, etc unique IDs. - self.ksID = 100000 + self.ksID = 100000 + + # how to handle missing packages + self.handleMissing = KS_MISSING_PROMPT + BaseInstallClass.__init__(self, 0) def Kickstart(file, serial): diff --git a/packages.py b/packages.py index 0c7232928..14b7caac9 100644 --- a/packages.py +++ b/packages.py @@ -133,7 +133,7 @@ def readPackages(intf, method, id): continue w.pop() - id.instClass.setPackageSelection(id.hdList) + id.instClass.setPackageSelection(id.hdList, intf) while id.comps is None: try: @@ -145,10 +145,8 @@ def readPackages(intf, method, id): "due to a missing file or bad media. " "Press <return> to try again.")) continue - id.instClass.setGroupSelection(id.comps) + id.instClass.setGroupSelection(id.comps, intf) - # XXX - #updateInstClassComps () else: # re-evaluate all the expressions for packages with qualifiers. |