summaryrefslogtreecommitdiffstats
path: root/packages.py
diff options
context:
space:
mode:
authordlehman <dlehman>2006-12-18 18:49:01 +0000
committerdlehman <dlehman>2006-12-18 18:49:01 +0000
commit704b9948111d317f698cd737db7937a10c03863b (patch)
tree564d1b4f00b16aede1fad40d1ee68075b6b9928f /packages.py
parent14937c746a6d329b0585e9f397de28d34d0fabeb (diff)
downloadanaconda-704b9948111d317f698cd737db7937a10c03863b.tar.gz
anaconda-704b9948111d317f698cd737db7937a10c03863b.tar.xz
anaconda-704b9948111d317f698cd737db7937a10c03863b.zip
* installclasses/rhel.py: do not accept reg keys whose product does
not match the installation media (#219823) allow users to go back and change reg key selections (#219361) * packages.py (regKeyScreen): allow access to the screen when moving backwards * installclasses/rhel.py (InstallClass.handleRegKey): reinitialize installkey, repopaths, and tasks every time handleRegKey is called make kickstart 'regkey --skip' permanently skip the step (#219544) * installclass.py (BaseInstallClass): add skipkey member * kickstart.py (AnacondaKSHandlers.doKey): set instClass.skipkey appropriately and unset instClass.installkey as needed make sure reg keys get written out on upgrade (#219791) * packages.py: add writeRegKey method * dispatch.py: add writeregkey step * upgradeclass.py: include writeregkey step * installclass.py: include writeregkey step * instdata.py (InstallData.write): remove code to write the reg key
Diffstat (limited to 'packages.py')
-rw-r--r--packages.py49
1 files changed, 35 insertions, 14 deletions
diff --git a/packages.py b/packages.py
index b87f4ca77..7ad45200a 100644
--- a/packages.py
+++ b/packages.py
@@ -52,7 +52,13 @@ def firstbootConfiguration(anaconda):
f.close()
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,22 +239,33 @@ def recreateInitrd (kernelTag, instRoot):
searchPath = 1, root = instRoot)
def regKeyScreen(anaconda):
- if anaconda.dir == DISPATCH_BACK:
- return DISPATCH_NOOP
-
- key = anaconda.id.instClass.installkey or ""
- while 1:
- if len(key) > 0:
- try:
- anaconda.id.instClass.handleRegKey(key, anaconda.intf,
- not anaconda.isKickstart)
- break
- except Exception, e:
+ def checkRegKey(anaconda, key, quiet=0):
+ rc = True
+ try:
+ anaconda.id.instClass.handleRegKey(key, anaconda.intf,
+ not anaconda.isKickstart)
+ except Exception, e:
+ if not quiet:
log.info("exception handling installation key: %s" %(e,))
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
@@ -262,10 +279,14 @@ def regKeyScreen(anaconda):
custom_buttons=[_("_Back"), _("_Skip")])
if not rc:
continue
- return
+ # 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