diff options
author | Matt Wilson <msw@redhat.com> | 1999-09-14 21:53:21 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-09-14 21:53:21 +0000 |
commit | 4468c7a95669feb2c25b87af9780493091a59d60 (patch) | |
tree | 4232e1f809a7decea45200b4541155cbbf40f4a9 | |
parent | 1b01c048aeaf42c820f1a45983d33ad994343b78 (diff) | |
download | anaconda-4468c7a95669feb2c25b87af9780493091a59d60.tar.gz anaconda-4468c7a95669feb2c25b87af9780493091a59d60.tar.xz anaconda-4468c7a95669feb2c25b87af9780493091a59d60.zip |
fix or lilo
-rw-r--r-- | todo.py | 242 |
1 files changed, 6 insertions, 236 deletions
@@ -24,7 +24,7 @@ class FakeDDruid: for i in range (len (table)): (type, sector, size) = table[i] if size and type != -1: - self.partitions.append ((name + str (i)), + self.partitions.append ((name + str (i + 1)), "Existing000" + str(len (self.partitions)), type) def __init__ (self): @@ -443,6 +443,10 @@ class ToDo: # 1) they're / # 2) they're not mounted + # only list dos and ext2 partitions + if type != 1 and type != 2: + continue + if (mountsByDev.has_key(dev)): if mountsByDev[dev] == '/': self.liloImages[dev] = ("linux", 2) @@ -1066,238 +1070,4 @@ class ToDo: if (todo.instClass.x): todo.x = todo.instClass.x - def getSkipPartitioning(self): - return self.instClass.skipPartitioning - - def getPartitionWarningText(self): - return self.instClass.clearPartText - - def manuallyPartition(self): - self.instClass.skipPartitioning = 0 - self.instClass.clearPartText = None - self.instClass.removeFromSkipList("partition") - self.instClass.removeFromSkipList("format") - - # List of (accountName, fullName, password) tupes - def setUserList(todo, users): - todo.users = users - - def getUserList(todo): - return todo.users - - def createAccounts(todo): - if not todo.users: return - - for (account, name, password) in todo.users: - devnull = os.open("/dev/null", os.O_RDWR) - - argv = [ "/usr/sbin/useradd", account ] - iutil.execWithRedirect(argv[0], argv, root = todo.instPath, - stdout = devnull) - - argv = [ "/usr/bin/chfn", "-f", name, account] - iutil.execWithRedirect(argv[0], argv, root = todo.instPath, - stdout = devnull) - - argv = [ "/usr/bin/passwd", "--stdin", account ] - p = os.pipe() - os.write(p[1], password + "\n") - iutil.execWithRedirect(argv[0], argv, root = todo.instPath, - stdin = p[0], stdout = devnull) - os.close(p[0]) - os.close(p[1]) - os.close(devnull) - - def createCdrom(self): - list = isys.cdromList() - count = 0 - for device in list: - (device, descript) = device - cdname = "cdrom" - if (count): - cdname = "%s%d" % (cdname, count) - count = count + 1 - - os.symlink(device, self.instPath + "/dev/" + cdname) - mntpoint = "/mnt/" + cdname - self.mounts[mntpoint] = (cdname, "iso9660", 0) - - def setDefaultRunlevel (self): - inittab = open (self.instPath + '/etc/inittab', 'r') - lines = inittab.readlines () - inittab.close () - inittab = open (self.instPath + '/etc/inittab', 'w') - for line in lines: - if len (line) > 3 and line[:3] == "id:": - fields = string.split (line, ':') - fields[1] = str (self.initlevel) - line = string.join (fields, ':') - inittab.write (line) - inittab.close () - - def doInstall(self): - # make sure we have the header list and comps file - self.getHeaderList() - self.getCompsList() - - if self.x.server: - self.selectPackage ('XFree86-' + self.x.server) - - # make sure that all comps that include other comps are - # selected (i.e. - recurse down the selected comps and turn - # on the children - if self.setupFilesystems: - if not self.upgrade: - if (self.ddruidAlreadySaved): - self.makeFilesystems (createSwap = 0) - else: - self.ddruid.save () - self.makeFilesystems () - else: - (drives, raid) = self.ddruid.partitionList() - - self.mountFilesystems () - - if self.upgrade: - w = self.intf.waitWindow(_("Rebuilding"), - _("Rebuilding RPM database...")) - rc = rpm.rebuilddb (self.instPath) - w.pop () - if rc: - intf.messageWindow (_("Error"), - _("Rebuild of RPM " - "database failed. You may be out of disk space?")); - # XXX do something sane here. - raise RuntimeError, "panic" - - self.method.targetFstab (self.mounts) - - if not self.installSystem: - return - - for i in [ '/var', '/var/lib', '/var/lib/rpm', '/tmp', '/dev' ]: - try: - os.mkdir(self.instPath + i) - except os.error, (errno, msg): - # self.intf.messageWindow("Error", "Error making directory %s: %s" % (i, msg)) - pass - - db = rpm.opendb(1, self.instPath) - ts = rpm.TransactionSet(self.instPath, db) - - total = 0 - totalSize = 0 - - if self.upgrade: - how = "u" - else: - how = "i" - - for p in self.hdList.selected(): - ts.add(p.h, (p.h, self), how) - total = total + 1 - totalSize = totalSize + p.h[rpm.RPMTAG_SIZE] - - ts.order() - - if self.upgrade: - logname = '/tmp/upgrade.log' - else: - logname = '/tmp/install.log' - - self.instLog = open(self.instPath + logname, "w+") - syslog = Syslogd(root = self.instPath, output = self.instLog) - - ts.scriptFd = self.instLog.fileno () - # the transaction set dup()s the file descriptor and will close the - # dup'd when we go out of scope - - p = self.intf.packageProgressWindow(total, totalSize) - - if self.upgrade: - self.modeText = _("Upgrading %s.\n") - else: - self.modeText = _("Installing %s.\n") - - def instCallback(what, amount, total, key, intf): - if (what == rpm.RPMCALLBACK_INST_OPEN_FILE): - (h, self) = key - intf.setPackage(h) - intf.setPackageScale(0, 1) - self.instLog.write (self.modeText % (h[rpm.RPMTAG_NAME],)) - self.instLog.flush () - fn = self.method.getFilename(h) - self.rpmFD = os.open(fn, os.O_RDONLY) - fn = self.method.unlinkFilename(fn) - return self.rpmFD - elif (what == rpm.RPMCALLBACK_INST_PROGRESS): - intf.setPackageScale(amount, total) - elif (what == rpm.RPMCALLBACK_INST_CLOSE_FILE): - (h, self) = key - os.close (self.rpmFD) - intf.completePackage(h) - else: - pass - - rpm.errorSetCallback (self.rpmError) - - # XXX FIXME FIXME: -1 IGNORES all problems - ts.run(0, -1, instCallback, p) - - self.method.filesDone () - - del p - - self.instLog.close () - - w = self.intf.waitWindow(_("Post Install"), - _("Performing post install configuration...")) - - if not self.upgrade: - self.createCdrom() - self.writeFstab () - self.writeLanguage () - self.writeMouse () - self.writeKeyboard () - self.writeNetworkConfig () - self.writeRootPassword () - self.setupAuthentication () - self.createAccounts () - self.writeTimezone() - if (self.instClass.defaultRunlevel): - self.initlevel = self.instClass.defaultRunlevel - self.setDefaultRunlevel () - pcmcia.createPcmciaConfig(self.instPath + "/etc/sysconfig/pcmcia") - self.copyConfModules () - if not self.x.skip and self.x.server: - self.x.write (self.instPath + "/etc/X11/XF86Config") - os.symlink ("../../usr/X11R6/bin/XF86_" + self.x.server, - self.instPath + "/etc/X11/X") - self.setDefaultRunlevel () - - 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/sh\n\n") - f.write(self.instClass.postScript) - f.close() - - if self.instClass.postInChroot: - iutil.execWithRedirect ("/bin/sh", ["/bin/sh", - "/tmp/ks-script" ], root = self.instPath) - else: - iutil.execWithRedirect ("/bin/sh", ["/bin/sh", - "/tmp/ks-script"]) - - os.unlink(path) - - del syslog - - w.pop () - + |