From 5c198114640db1191e4b501d828622e6b9bc90d6 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sat, 7 Aug 1999 03:06:33 +0000 Subject: writes changes to disks --- anaconda | 1 + gui.py | 6 ++- isys/isys.c | 11 ++++- isys/isys.py | 13 +++++- isys/testprobe | 11 +++-- iw/rootpartition.py | 81 +++++++++++++++++--------------- po/anaconda-text.pot | 128 ++++++++++++++++++++++++++++----------------------- text.py | 27 +++++------ todo.py | 25 +++++++--- 9 files changed, 183 insertions(+), 120 deletions(-) diff --git a/anaconda b/anaconda index c9a812815..bc3699263 100755 --- a/anaconda +++ b/anaconda @@ -54,6 +54,7 @@ if (os.path.exists('rpmmodule')): sys.path.append('balkan') sys.path.append('rpmmodule') sys.path.append('isys') + sys.path.append('libfdisk') #elif (mode == None): # try: # f = open('/dev/fb0', 'r') diff --git a/gui.py b/gui.py index 746ab2b2b..be44214a9 100755 --- a/gui.py +++ b/gui.py @@ -13,6 +13,7 @@ from iw.mouse import * from iw.keyboard import * import sys import GdkImlib +from gnomepyfsedit import fsedit import isys import sys @@ -93,6 +94,9 @@ class InstallInterface: import traceback traceback.print_exception (type, value, tb) + def getDDruid (self, drives): + return fsedit (1, drives) + def run (self, todo): start_new_thread (GtkMainThread ().run, ()) @@ -101,7 +105,7 @@ class InstallInterface: windows = [WelcomeWindow, LanguageWindow, MouseWindow, KeyboardWindow, NetworkWindow, PartitionWindow, PackageSelectionWindow, AuthWindow, AccountWindow, IndividualPackageSelectionWindow, - InstallProgressWindow] + InstallProgressWindow, ConfirmPartitionWindow] icw = InstallControlWindow (self, steps, windows, todo) diff --git a/isys/isys.c b/isys/isys.c index 89f5e6aa8..e9bdd33cc 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -56,7 +56,7 @@ static PyObject * probedListNet(probedListObject * s, PyObject * args); static PyObject * probedListScsi(probedListObject * s, PyObject * args); static PyObject * probedListIde(probedListObject * s, PyObject * args); static int probedListLength(PyObject * o); -static PyObject * probedListSubscript(PyObject * o, int item); +static PyObject * probedListSubscript(probedListObject * o, int item); static PyMethodDef probedListObjectMethods[] = { { "updateNet", (PyCFunction) probedListNet, METH_VARARGS, NULL }, @@ -413,11 +413,18 @@ static int probedListLength(PyObject * o) { return ((probedListObject *) o)->list.numKnown; } -static PyObject * probedListSubscript(PyObject * o, int item) { +static PyObject *indexerr; + +static PyObject * probedListSubscript(probedListObject * o, int item) { probedListObject * po = (probedListObject *) o; char * model = ""; char * class; + if (item > o->list.numKnown - 1) { + indexerr = PyString_FromString("list index out of range"); + PyErr_SetObject(PyExc_IndexError, indexerr); + return NULL; + } if (po->list.known[item].model) model = po->list.known[item].model; switch (po->list.known[item].class) { diff --git a/isys/isys.py b/isys/isys.py index ea85d5d84..0387a58df 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -10,7 +10,7 @@ def umount(what): def smpAvailable(): return _isys.smpavailable() -def probeDevices(): +def probePciDevices(): # probes all probeable buses and returns a list of # ( driver, major, minor, description, args ) tuples, where args is a # list of (argName, argDescrip) tuples @@ -26,6 +26,17 @@ def probeDevices(): return result +def hardDriveList (): + p = _isys.ProbedList() + p.updateIde() + p.updateScsi() + + dict = {} + for (klass, dev, descr) in p: + if (klass == "disk"): + dict[dev] = descr + return dict + def moduleListByType(type): return _isys.modulelist(type) diff --git a/isys/testprobe b/isys/testprobe index 4064d458e..f0b1573a5 100755 --- a/isys/testprobe +++ b/isys/testprobe @@ -9,6 +9,11 @@ p.updateScsi() i = 0 print "found devices:" -while (i < len(p)): - print "\t", p[i] - i = i + 1 +#while (i < len(p)): +# print "\t", p[i] +# i = i + 1 + +print len (p) + +for i in p: + print "\t", i diff --git a/iw/rootpartition.py b/iw/rootpartition.py index 9598abeed..7c03cd20e 100644 --- a/iw/rootpartition.py +++ b/iw/rootpartition.py @@ -1,10 +1,26 @@ from gtk import * from iw import * +from thread import * import isys import _balkan -class PartitionWindow (InstallWindow): +class ConfirmPartitionWindow (InstallWindow): + def __init__ (self, ics): + InstallWindow.__init__ (self, ics) + + self.todo = ics.getToDo () + ics.setTitle ("Confirm Partitioning Selection") + ics.setHTML ("Select a root partition" + "") + ics.setNextEnabled (TRUE) + + def getScreen (self): + return self.window + def getPrev (self): + return PartitionWindow + +class PartitionWindow (InstallWindow): def __init__ (self, ics): InstallWindow.__init__ (self, ics) @@ -15,43 +31,34 @@ class PartitionWindow (InstallWindow): ics.setNextEnabled (TRUE) def getNext (self): - for i in self.buttons.keys (): - if self.buttons[i].active: - rootpart = "%s%d" % (self.device, i + 1) - + print "calling self.ddruid.next ()" + self.todo.ddruid.next () + print "done calling self.ddruid.next ()" + + win = self.todo.ddruid.getConfirm () + if win: + print "confirm" + bin = GtkFrame (None, _obj = win) + bin.set_shadow_type (SHADOW_NONE) + window = ConfirmPartitionWindow + window.window = bin + return window + self.todo.addMount(rootpart, '/') return None + def enableCallback (self, value): + self.ics.setNextEnabled (value) + def getScreen (self): - label = GtkLabel("What partition would you like to use for your root " - "partition?") - label.set_line_wrap (TRUE) - - hbox = GtkVBox (FALSE, 10) - - self.device = 'hda' - - self.buttons = {} - self.buttons[0] = None - numext2 = 0 - - try: - isys.makeDevInode(self.device, '/tmp/' + self.device) - table = _balkan.readTable('/tmp/' + self.device) - if len(table) - 1 > 0: - partbox = GtkVBox (FALSE, 5) - for i in range(0, len(table) - 1): - (type, start, size) = table[i] - if (type == 0x83 and size): - button = GtkRadioButton(self.buttons[0], - '/dev/%s%d' % (self.device, i + 1)) - self.buttons[i] = button - partbox.pack_start(button, FALSE, FALSE, 0) - hbox.pack_start(label, FALSE, FALSE, 0) - hbox.pack_start(partbox, FALSE, FALSE, 0) - except: - label = GtkLabel("Unable to read partition information") - hbox.pack_start(label, TRUE, TRUE, 0) - print "unable to read partitions" - - return hbox + from gnomepyfsedit import fsedit + + if not self.todo.ddruid: + self.todo.ddruid = fsedit(1, ['hda'], []) + self.todo.ddruid.setCallback (self.enableCallback, self) + + self.bin = GtkFrame (None, _obj = self.todo.ddruid.getWindow ()) + self.bin.set_shadow_type (SHADOW_NONE) + self.todo.ddruid.edit () + + return self.bin diff --git a/po/anaconda-text.pot b/po/anaconda-text.pot index 9a33da289..3558f9d85 100644 --- a/po/anaconda-text.pot +++ b/po/anaconda-text.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-08-03 14:18-0400\n" +"POT-Creation-Date: 1999-08-06 23:05-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -14,68 +14,78 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: ../text.py:24 ../text.py:545 +#: ../text.py:26 ../text.py:568 msgid "Language Selection" msgstr "" -#: ../text.py:25 +#: ../text.py:27 msgid "What language would you like to use during the installation process?" msgstr "" -#: ../text.py:27 ../text.py:95 ../text.py:345 ../text.py:513 +#: ../text.py:29 ../text.py:48 ../text.py:115 ../text.py:353 ../text.py:368 +#: ../text.py:536 msgid "Ok" msgstr "" -#: ../text.py:39 ../text.py:549 +#: ../text.py:46 ../text.py:569 +msgid "Keyboard Selection" +msgstr "" + +#: ../text.py:47 +msgid "Which model keyboard is attached to this computer?" +msgstr "" + +#: ../text.py:48 ../text.py:51 ../text.py:76 ../text.py:115 ../text.py:117 +#: ../text.py:196 ../text.py:256 ../text.py:320 ../text.py:353 ../text.py:356 +#: ../text.py:368 ../text.py:369 +msgid "Back" +msgstr "" + +#: ../text.py:59 ../text.py:576 msgid "Root Password" msgstr "" -#: ../text.py:41 +#: ../text.py:61 msgid "" "Pick a root password. You must type it twice to ensure you know what it is " "and didn't make a mistake in typing. Remember that the root password is a " "critical part of system security!" msgstr "" -#: ../text.py:50 +#: ../text.py:70 msgid "Password:" msgstr "" -#: ../text.py:51 +#: ../text.py:71 msgid "Password (again):" msgstr "" -#: ../text.py:56 ../text.py:72 ../text.py:77 ../text.py:176 ../text.py:230 -#: ../text.py:252 ../text.py:316 +#: ../text.py:76 ../text.py:92 ../text.py:97 ../text.py:196 ../text.py:256 +#: ../text.py:320 msgid "OK" msgstr "" -#: ../text.py:56 ../text.py:95 ../text.py:97 ../text.py:176 ../text.py:230 -#: ../text.py:232 ../text.py:252 ../text.py:316 ../text.py:345 ../text.py:346 -msgid "Back" -msgstr "" - -#: ../text.py:69 +#: ../text.py:89 msgid "Password Length" msgstr "" -#: ../text.py:70 +#: ../text.py:90 msgid "The root password must be at least 6 characters long." msgstr "" -#: ../text.py:74 +#: ../text.py:94 msgid "Password Mismatch" msgstr "" -#: ../text.py:75 +#: ../text.py:95 msgid "The passwords you entered were different. Please try again." msgstr "" -#: ../text.py:86 +#: ../text.py:106 msgid "Red Hat Linux" msgstr "" -#: ../text.py:87 +#: ../text.py:107 msgid "" "Welcome to Red Hat Linux!\n" "\n" @@ -87,134 +97,138 @@ msgid "" "purchase through our web site, http://www.redhat.com/." msgstr "" -#: ../text.py:148 +#: ../text.py:168 msgid "Use bootp/dhcp" msgstr "" -#: ../text.py:153 +#: ../text.py:173 msgid "IP address:" msgstr "" -#: ../text.py:154 +#: ../text.py:174 msgid "Netmask:" msgstr "" -#: ../text.py:155 +#: ../text.py:175 msgid "Default gateway (IP):" msgstr "" -#: ../text.py:156 +#: ../text.py:176 msgid "Primary nameserver:" msgstr "" -#: ../text.py:178 +#: ../text.py:198 msgid "Network Configuration" msgstr "" -#: ../text.py:227 -msgid "Root Partition" +#: ../text.py:254 +msgid "Select individual packages" msgstr "" -#: ../text.py:228 -msgid "What partition would you like to use for your root partition?" +#: ../text.py:258 ../text.py:322 +msgid "Package Group Selection" msgstr "" -#: ../text.py:250 -msgid "Select individual packages" +#: ../text.py:351 +msgid "Mouse Selection" msgstr "" -#: ../text.py:254 ../text.py:318 -msgid "Package Group Selection" +#: ../text.py:352 +msgid "Which model mouse is attached to this computer?" msgstr "" -#: ../text.py:341 +#: ../text.py:364 msgid "Installation to begin" msgstr "" -#: ../text.py:342 +#: ../text.py:365 msgid "" "A complete log of your installation will be in /tmp/install.log after " "rebooting your system. You may want to keep this file for later reference." msgstr "" -#: ../text.py:399 ../text.py:400 ../text.py:406 ../text.py:407 +#: ../text.py:422 ../text.py:423 ../text.py:429 ../text.py:430 msgid "Package Installation" msgstr "" -#: ../text.py:409 +#: ../text.py:432 msgid "Name : " msgstr "" -#: ../text.py:410 +#: ../text.py:433 msgid "Size : " msgstr "" -#: ../text.py:411 +#: ../text.py:434 msgid "Summary: " msgstr "" -#: ../text.py:437 +#: ../text.py:460 msgid " Packages" msgstr "" -#: ../text.py:438 +#: ../text.py:461 msgid " Bytes" msgstr "" -#: ../text.py:439 +#: ../text.py:462 msgid " Time" msgstr "" -#: ../text.py:441 +#: ../text.py:464 msgid "Total :" msgstr "" -#: ../text.py:448 +#: ../text.py:471 msgid "Completed: " msgstr "" -#: ../text.py:458 +#: ../text.py:481 msgid "Remaining: " msgstr "" -#: ../text.py:527 +#: ../text.py:550 msgid "Exception occured" msgstr "" -#: ../text.py:528 +#: ../text.py:551 msgid "Exit" msgstr "" -#: ../text.py:534 +#: ../text.py:557 msgid "Red Hat Linux (C) 1999 Red Hat, Inc." msgstr "" -#: ../text.py:536 +#: ../text.py:559 msgid "" " / between elements | selects | next " "screen" msgstr "" -#: ../text.py:546 +#: ../text.py:570 msgid "Welcome" msgstr "" -#: ../text.py:547 +#: ../text.py:571 msgid "Partition" msgstr "" -#: ../text.py:548 +#: ../text.py:572 msgid "Network Setup" msgstr "" -#: ../text.py:550 +#: ../text.py:573 msgid "Package Groups" msgstr "" -#: ../text.py:551 +#: ../text.py:574 msgid "Individual Packages" msgstr "" -#: ../text.py:552 +#: ../text.py:575 +msgid "Mouse Configuration" +msgstr "" + +#: ../text.py:577 msgid "Installation Begins" msgstr "" diff --git a/text.py b/text.py index a2183dab5..0e3070474 100644 --- a/text.py +++ b/text.py @@ -18,13 +18,15 @@ _ = cat.gettext class LanguageWindow: def run(self, screen, todo): languages = todo.language.available () - current = todo.language.get () + descriptions = languages.keys () + locales = languages.values () + default = locales.index (todo.language.get ()) (button, choice) = \ ListboxChoiceWindow(screen, _("Language Selection"), _("What language would you like to use during the " - "installation process?"), languages.keys (), - buttons = [_("Ok")], width = 30) + "installation process?"), descriptions, + buttons = [_("Ok")], width = 30, default = default) langs = gettext.getlangs () langs = [languages [languages.keys()[choice]]] + langs gettext.setlangs (langs) @@ -38,12 +40,13 @@ class KeyboardWindow: def run(self, screen, todo): keyboards = todo.keyboard.available () keyboards.sort () - current = todo.keyboard.get () + default = keyboards.index (todo.keyboard.get ()) (button, choice) = \ ListboxChoiceWindow(screen, _("Keyboard Selection"), _("Which model keyboard is attached to this computer?"), keyboards, - buttons = [_("Ok"), _("Back")], width = 30, scroll = 1, height = 8) + buttons = [_("Ok"), _("Back")], width = 30, scroll = 1, height = 8, + default = default) if button == string.lower (_("Back")): return INSTALL_BACK @@ -223,17 +226,15 @@ class NetworkWindow: class PartitionWindow: def run(self, screen, todo): - if (not todo.setupFilesystems): return INSTALL_NOOP - - sys.path.append('libfdisk') +# if (not todo.setupFilesystems): return INSTALL_NOOP from newtpyfsedit import fsedit fstab = [] for (dev, dir, reformat) in todo.mounts: fstab.append ((dev, dir)) - (dir, res) = fsedit(1, ['hda'], fstab) - + ddruid = fsedit(0, todo.drives.available ().keys (), fstab) + (dir, res) = ddruid.edit () for (partition, mount, size) in res: todo.addMount(partition, mount) @@ -344,12 +345,13 @@ class MouseWindow: def run(self, screen, todo): mice = todo.mouse.available () mice.sort () - current = todo.mouse.get () + default = mice.index (todo.mouse.get ()) (button, choice) = \ ListboxChoiceWindow(screen, _("Mouse Selection"), _("Which model mouse is attached to this computer?"), mice, - buttons = [_("Ok"), _("Back")], width = 30, scroll = 1, height = 8) + buttons = [_("Ok"), _("Back")], width = 30, scroll = 1, height = 8, + default = default) if button == string.lower (_("Back")): return INSTALL_BACK @@ -357,7 +359,6 @@ class MouseWindow: return INSTALL_OK - class BeginInstallWindow: def run(self, screen, todo): rc = ButtonChoiceWindow(screen, _("Installation to begin"), diff --git a/todo.py b/todo.py index 97d875d1d..78c4616ef 100644 --- a/todo.py +++ b/todo.py @@ -132,13 +132,16 @@ class Language (SimpleConfigFile): return self.langs def set (self, lang): - self.lang = lang + self.lang = self.langs[lang] self.info["LANG"] = self.langs[lang] self.info["LINGUAS"] = self.langs[lang] self.info["LC_ALL"] = self.langs[lang] def get (self): - return self.lang + if self.lang: + return self.lang + else: + return "C" class Mouse (SimpleConfigFile): # XXX fixme - externalize @@ -210,7 +213,9 @@ class Mouse (SimpleConfigFile): def get (self): if self.info.has_key ("FULLNAME"): - return self.info ("FULLNAME") + return self.info ["FULLNAME"] + else: + return "PS/2" def set (self, mouse): (gpm, x11, dev) = self.mice[mouse] @@ -313,7 +318,8 @@ class Keyboard (SimpleConfigFile): def get (self): if self.info.has_key ("KEYTABLE"): return self.info["KEYTABLE"] - + else: + return "us" class Authentication: def __init__ (self): @@ -323,6 +329,10 @@ class Authentication: self.useNis = 0 self.useShadow = 1 self.useMD5 = 1 + +class Drives: + def available (self): + return isys.hardDriveList () class ToDo: def __init__(self, intf, method, rootPath, setupFilesystems = 1, @@ -341,6 +351,8 @@ class ToDo: self.mouse = Mouse () self.keyboard = Keyboard () self.auth = Authentication () + self.ddruid = None; + self.drives = Drives () def umountFilesystems(self): if (not self.setupFilesystems): return @@ -534,8 +546,9 @@ class ToDo: if comp.selected: comp.select(1) - self.makeFilesystems() - self.mountFilesystems() + self.ddruid.save () + self.makeFilesystems () + self.mountFilesystems () if not self.installSystem: return -- cgit