diff options
author | Erik Troan <ewt@redhat.com> | 1999-09-09 16:09:44 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-09-09 16:09:44 +0000 |
commit | c71e2378fa050757e8142c9a44b794281ed4bff1 (patch) | |
tree | d50610c1e97479e53764ce817cbf8e73f23187c2 | |
parent | ea17a078eeb14a6b844abbc2cad58706a6bf2631 (diff) | |
download | anaconda-c71e2378fa050757e8142c9a44b794281ed4bff1.tar.gz anaconda-c71e2378fa050757e8142c9a44b794281ed4bff1.tar.xz anaconda-c71e2378fa050757e8142c9a44b794281ed4bff1.zip |
run post scripts for kickstart
-rw-r--r-- | installclass.py | 6 | ||||
-rw-r--r-- | kickstart.py | 45 | ||||
-rw-r--r-- | todo.py | 26 |
3 files changed, 65 insertions, 12 deletions
diff --git a/installclass.py b/installclass.py index ad2dc963c..b80af2e62 100644 --- a/installclass.py +++ b/installclass.py @@ -159,6 +159,10 @@ class InstallClass: def setKeyboard(self, kb): self.keyboard = kb + def setPostScript(self, postScript, inChroot = 1): + self.postScript = postScript + self.postInChroot = inChroot + def __init__(self): self.skipSteps = {} self.hostname = None @@ -186,6 +190,8 @@ class InstallClass: self.mouse = None self.x = None self.defaultRunlevel = None + self.postScript = None + self.postInChroot = 0 # custom installs are easy :-) class CustomInstall(InstallClass): diff --git a/kickstart.py b/kickstart.py index 2ef6d5998..ff9951508 100644 --- a/kickstart.py +++ b/kickstart.py @@ -241,14 +241,43 @@ class Kickstart(InstallClass): "zerombr" : self.doZeroMbr , } + where = "commands" + packages = [] + groups = [] + post = "" + postInChroot = 1 for n in open(file).readlines(): - n = n[:len(n) - 1] # chop - - args = isys.parseArgv(n) - if not args or args[0][0] == '#': continue - - cmd = args[0] - if handlers[cmd]: handlers[cmd](args[1:]) + if where == "post": + post = post + n + else: + n = n[:len(n) - 1] # chop + + args = isys.parseArgv(n) + if not args or args[0][0] == '#': continue + + if where == "commands": + cmd = args[0] + if cmd == "%packages": + where = "packages" + elif handlers[cmd]: + handlers[cmd](args[1:]) + elif where == "packages": + if n[0:5] == "%post": + args = isys.parseArgv(n) + if len(args) >= 2 and args[1] == "--nochroot": + postInChroot = 0 + where = "post" + elif n[0] == '@': + n = n[1:] + while n[0] == ' ': + n = n[1:] + groups.append(n) + else: + packages.append(n) + + self.setGroups(groups) + self.setPackages(packages) + self.setPostScript(post, postInChroot) def doClearPart(self, args): if args[0] == '--linux': @@ -292,7 +321,7 @@ class Kickstart(InstallClass): self.readKickstart(file) self.setGroups(["Base"]) - self.addToSkipList("package-selection") + #self.addToSkipList("package-selection") # need to take care of: #[ "lilo", "mouse", "network", "complete", @@ -701,7 +701,7 @@ class ToDo: # don't load it just for this if (not self.comps): return group = self.instClass.getGroups() - packages = self.instClass.getGroups() + packages = self.instClass.getPackages() if (group == None and packages == None): return 0 for n in self.comps.keys(): self.comps[n].unselect(0) @@ -711,9 +711,9 @@ class ToDo: for n in group: self.comps[n].select(1) - #if packages: - #for n in packages: - #self.selectPackage(n) + if packages: + for n in packages: + self.selectPackage(n) if self.x.server: self.selectPackage('XFree86-' + self.x.server) @@ -1160,6 +1160,24 @@ class ToDo: self.installLilo () + if self.instClass.postScript: + if self.instClass.postInChroot: + path = self.instPath + "/tmp/ks-script" + else: + path = "/tmp/ks-script" + + f = open(path, "w") + f.write("#!/bin/bash\n\n") + f.write(self.instClass.postScript) + f.close() + + if self.instClass.postInChroot: + iutil.execWithRedirect (path, [path], root = self.instPath) + else: + iutil.execWithRedirect (path, [path]) + + os.unlink(path) + del syslog w.pop () |