diff options
author | dlehman <dlehman> | 2007-02-22 00:06:15 +0000 |
---|---|---|
committer | dlehman <dlehman> | 2007-02-22 00:06:15 +0000 |
commit | 2c5edecc9801488063b93da903cc98f02be7135d (patch) | |
tree | f135f77f7dea2199b358c6f2a891e5ca96088a79 /packages.py | |
parent | 27c231de0fe23d95150e9baa6639e9d258dbc677 (diff) | |
download | anaconda-2c5edecc9801488063b93da903cc98f02be7135d.tar.gz anaconda-2c5edecc9801488063b93da903cc98f02be7135d.tar.xz anaconda-2c5edecc9801488063b93da903cc98f02be7135d.zip |
* partedUtils.py (openDevices): don't relabel disks that contain
protected partitions (#220331)
* autopart.py (doClearPartAction): clear all non-protected partitions
from disks that contain a protected partition IFF initAll is set
* partedUtils.py (hasProtectedPartitions): new method to check if a
drive contains protected partitions
* packages.py (writeRegKey): method to write out regkey
* dispatch.py: add writeregkey step
* installclass.py (BaseInstallClass): add regkey fields and step
* instdata.py: include regkey settings in anaconda-ks.cfg
* packages.py (regKeyScreen): allow access to regkey screen while
moving backwards (#219361)
* installclasses/rhel.py: add support for real regkeys (via instnum)
Diffstat (limited to 'packages.py')
-rw-r--r-- | packages.py | 77 |
1 files changed, 58 insertions, 19 deletions
diff --git a/packages.py b/packages.py index 0838f176a..623834c1e 100644 --- a/packages.py +++ b/packages.py @@ -53,6 +53,12 @@ def firstbootConfiguration(anaconda): return +def writeRegKey(anaconda): + if anaconda.id.instClass.installkey and os.path.exists(anaconda.rootPath + "/etc/sysconfig/rhn"): + f = open(anaconda.rootPath + "/etc/sysconfig/rhn/install-num", "w+") + f.write("%s\n" %(anaconda.id.instClass.installkey,)) + f.close() + os.chmod(anaconda.rootPath + "/etc/sysconfig/rhn/install-num", 0600) def writeKSConfiguration(anaconda): log.info("Writing autokickstart file") @@ -233,28 +239,61 @@ def recreateInitrd (kernelTag, instRoot): searchPath = 1, root = instRoot) def regKeyScreen(anaconda): - if anaconda.dir == DISPATCH_BACK: - return DISPATCH_NOOP - - while 1: - if anaconda.id.instClass.regkeydesc is None: - desc = _("Please enter the registration key for your version of %s.") %(productName,) - else: - desc = anaconda.id.instClass.regkeydesc - - rc = anaconda.intf.entryWindow(_("Enter Registration Key"), - desc, _("Key:")) - + def checkRegKey(anaconda, key, quiet=0): + rc = True try: - anaconda.id.instClass.handleRegKey(rc, anaconda.intf) + anaconda.id.instClass.handleRegKey(key, anaconda.intf, + not anaconda.isKickstart) except Exception, e: - log.info("exception handling regkey: %s" %(e,)) + if not quiet: + log.info("exception handling installation key: %s" %(e,)) + + (type, value, tb) = sys.exc_info() + list = traceback.format_exception(type, value, tb) + for l in list: + log.debug(l) + anaconda.intf.messageWindow(_("Invalid Key"), + _("The key you entered is invalid."), + type="warning") + rc = False + + return rc + + key = anaconda.id.instClass.installkey or "" + + # handle existing key if we're headed forward + if key and not anaconda.id.instClass.skipkey and \ + anaconda.dir == DISPATCH_FORWARD and checkRegKey(anaconda, key): + return DISPATCH_FORWARD + + # if we're backing up we should allow them to reconsider skipping the key + if anaconda.dir == DISPATCH_BACK and anaconda.id.instClass.skipkey: + anaconda.id.instClass.skipkey = False + + while not anaconda.id.instClass.skipkey: + rc = anaconda.intf.getInstallKey(anaconda, key) + if rc is None and anaconda.dispatch.canGoBack(): + return DISPATCH_BACK + elif rc is None: continue - break - - # FIXME: currently, we only allow this screen to ever be hit _once_ - anaconda.dispatch.skipStep("regkey", permanent = 1) - return + elif rc == SKIP_KEY: + if anaconda.id.instClass.skipkeytext: + rc = anaconda.intf.messageWindow(_("Skip"), + _(anaconda.id.instClass.skipkeytext), + type="custom", custom_icon="question", + custom_buttons=[_("_Back"), _("_Skip")]) + if not rc: + continue + # unset the key and associated data + checkRegKey(anaconda, None, quiet=1) + anaconda.id.instClass.skipkey = True + break + + key = rc + if checkRegKey(anaconda, key): + break + + return DISPATCH_FORWARD def betaNagScreen(anaconda): publicBetas = { "Red Hat Linux": "Red Hat Linux Public Beta", |