summaryrefslogtreecommitdiffstats
path: root/anaconda
diff options
context:
space:
mode:
Diffstat (limited to 'anaconda')
-rwxr-xr-xanaconda91
1 files changed, 87 insertions, 4 deletions
diff --git a/anaconda b/anaconda
index 66ac24eaa..2ee3f9225 100755
--- a/anaconda
+++ b/anaconda
@@ -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()