diff options
-rwxr-xr-x | anaconda | 91 | ||||
-rw-r--r-- | backend.py | 2 | ||||
-rw-r--r-- | instdata.py | 77 | ||||
-rw-r--r-- | packages.py | 2 |
4 files changed, 90 insertions, 82 deletions
@@ -540,15 +540,15 @@ class Anaconda(object): exn.write(self, fo) - def writeXdriver(self, instPath="/"): + def writeXdriver(self): # this should go away at some point, but until it does, we # need to keep it around. it could go into instdata but this # isolates it a little more if self.xdriver is None: return - if not os.path.isdir("%s/etc/X11" %(instPath,)): - os.makedirs("%s/etc/X11" %(instPath,), mode=0755) - f = open("%s/etc/X11/xorg.conf" %(instPath,), 'w') + if not os.path.isdir("%s/etc/X11" %(self.rootPath,)): + os.makedirs("%s/etc/X11" %(self.rootPath,), mode=0755) + f = open("%s/etc/X11/xorg.conf" %(self.rootPath,), 'w') f.write('Section "Device"\n\tIdentifier "Videocard0"\n\tDriver "%s"\nEndSection\n' % self.xdriver) f.close() @@ -588,6 +588,89 @@ class Anaconda(object): return fail + def write(self): + self.writeXdriver() + + if self.ksdata: + for svc in self.ksdata.services.disabled: + iutil.execWithRedirect("/sbin/chkconfig", + [svc, "off"], + stdout="/dev/tty5", stderr="/dev/tty5", + root=self.rootPath) + + for svc in self.ksdata.services.enabled: + iutil.execWithRedirect("/sbin/chkconfig", + [svc, "on"], + stdout="/dev/tty5", stderr="/dev/tty5", + root=self.rootPath) + + # XXX: This is temporary until instdata goes away completely. + self.id.write() + + def writeKS(self, filename): + import urllib + from pykickstart.version import versionToString, DEVEL + + f = open(filename, "w") + + f.write("# Kickstart file automatically generated by anaconda.\n\n") + f.write("#version=%s\n" % versionToString(DEVEL)) + + if self.upgrade: + f.write("upgrade\n"); + else: + f.write("install\n"); + + m = None + + if self.methodstr: + m = self.methodstr + elif self.stage2: + m = self.stage2 + + if m: + if m.startswith("cdrom:"): + f.write("cdrom\n") + elif m.startswith("hd:"): + if m.count(":") == 3: + (part, fs, dir) = string.split(m[3:], ":") + else: + (part, dir) = string.split(m[3:], ":") + + f.write("harddrive --partition=%s --dir=%s\n" % (part, dir)) + elif m.startswith("nfs:"): + if m.count(":") == 3: + (server, opts, dir) = string.split(m[4:], ":") + f.write("nfs --server=%s --opts=%s --dir=%s" % (server, opts, dir)) + else: + (server, dir) = string.split(m[4:], ":") + f.write("nfs --server=%s --dir=%s\n" % (server, dir)) + elif m.startswith("ftp://") or m.startswith("http"): + f.write("url --url=%s\n" % urllib.unquote(m)) + + # Some kickstart commands do not correspond to any anaconda UI + # component. If this is a kickstart install, we need to make sure + # the information from the input file ends up in the output file. + if self.ksdata: + f.write(self.ksdata.user.__str__()) + f.write(self.ksdata.services.__str__()) + f.write(self.ksdata.reboot.__str__()) + + # XXX: This is temporary until instdata goes away completely. + self.id.writeKS(f) + + if self.backend: + self.backend.writeKS(f) + self.backend.writePackagesKS(f, self) + + # Also write out any scripts from the input ksfile. + if self.ksdata: + for s in self.ksdata.scripts: + f.write(s.__str__()) + + # make it so only root can read, could have password + os.chmod(filename, 0600) + if __name__ == "__main__": setupPythonPath() diff --git a/backend.py b/backend.py index 6303bda95..268225f96 100644 --- a/backend.py +++ b/backend.py @@ -310,5 +310,5 @@ def doBasePackageSelect(anaconda): def writeConfiguration(anaconda): log.info("Writing main configuration") - anaconda.id.write() + anaconda.write() anaconda.backend.writeConfiguration() diff --git a/instdata.py b/instdata.py index 79b60af16..b5f74c993 100644 --- a/instdata.py +++ b/instdata.py @@ -42,8 +42,6 @@ from constants import * from simpleconfig import SimpleConfigFile import system_config_keyboard.keyboard as keyboard -from pykickstart.version import versionToString, DEVEL - import logging log = logging.getLogger("anaconda") @@ -94,8 +92,6 @@ class InstallData: def write(self): self.instLanguage.write (self.anaconda.rootPath) - self.anaconda.writeXdriver(self.anaconda.rootPath) - if not self.anaconda.isHeadless: self.keyboard.write (self.anaconda.rootPath) @@ -129,18 +125,6 @@ class InstallData: algo=self.getPassAlgo()) if self.anaconda.ksdata: - for svc in self.anaconda.ksdata.services.disabled: - iutil.execWithRedirect("/sbin/chkconfig", - [svc, "off"], - stdout="/dev/tty5", stderr="/dev/tty5", - root=self.anaconda.rootPath) - - for svc in self.anaconda.ksdata.services.enabled: - iutil.execWithRedirect("/sbin/chkconfig", - [svc, "on"], - stdout="/dev/tty5", stderr="/dev/tty5", - root=self.anaconda.rootPath) - for gd in self.anaconda.ksdata.group.groupList: if not self.users.createGroup(name=gd.name, gid=gd.gid, @@ -161,45 +145,7 @@ class InstallData: gecos=ud.gecos): log.error("User %s already exists, not creating." % ud.name) - - def writeKS(self, filename): - f = open(filename, "w") - - f.write("# Kickstart file automatically generated by anaconda.\n\n") - f.write("#version=%s\n" % versionToString(DEVEL)) - - if self.upgrade: - f.write("upgrade\n") - else: - f.write("install\n") - - m = None - - if self.anaconda.methodstr: - m = self.anaconda.methodstr - elif self.anaconda.stage2: - m = self.anaconda.stage2 - - if m: - if m.startswith("cdrom:"): - f.write("cdrom\n") - elif m.startswith("hd:"): - if m.count(":") == 3: - (part, fs, dir) = string.split(m[3:], ":") - else: - (part, dir) = string.split(m[3:], ":") - - f.write("harddrive --partition=%s --dir=%s\n" % (part, dir)) - elif m.startswith("nfs:"): - if m.count(":") == 3: - (server, opts, dir) = string.split(m[4:], ":") - f.write("nfs --server=%s --opts=%s --dir=%s" % (server, opts, dir)) - else: - (server, dir) = string.split(m[4:], ":") - f.write("nfs --server=%s --dir=%s\n" % (server, dir)) - elif m.startswith("ftp://") or m.startswith("http"): - f.write("url --url=%s\n" % urllib.unquote(m)) - + def writeKS(self, f): self.instLanguage.writeKS(f) if not self.anaconda.isHeadless: self.keyboard.writeKS(f) @@ -215,14 +161,6 @@ class InstallData: f.write("rootpw %s\n" % args) - # Some kickstart commands do not correspond to any anaconda UI - # component. If this is a kickstart install, we need to make sure - # the information from the input file ends up in the output file. - if self.anaconda.ksdata: - f.write(self.anaconda.ksdata.user.__str__()) - f.write(self.anaconda.ksdata.services.__str__()) - f.write(self.anaconda.ksdata.reboot.__str__()) - self.firewall.writeKS(f) if self.auth.strip() != "": f.write("authconfig %s\n" % self.auth) @@ -231,19 +169,6 @@ class InstallData: self.bootloader.writeKS(f) self.storage.writeKS(f) - if self.anaconda.backend: - self.anaconda.backend.writeKS(f) - self.anaconda.backend.writePackagesKS(f, self.anaconda) - - # Also write out any scripts from the input ksfile. - if self.anaconda.ksdata: - for s in self.anaconda.ksdata.scripts: - f.write(s.__str__()) - - # make it so only root can read, could have password - os.chmod(filename, 0600) - - def __init__(self, anaconda, extraModules): self.instLanguage = language.Language(anaconda.displayMode) self.keyboard = keyboard.Keyboard() diff --git a/packages.py b/packages.py index df55909ce..5342bd196 100644 --- a/packages.py +++ b/packages.py @@ -63,7 +63,7 @@ def writeKSConfiguration(anaconda): log.info("Writing autokickstart file") fn = anaconda.rootPath + "/root/anaconda-ks.cfg" - anaconda.id.writeKS(fn) + anaconda.writeKS(fn) def copyAnacondaLogs(anaconda): log.info("Copying anaconda logs") |