diff options
author | Matt Wilson <msw@redhat.com> | 1999-08-09 18:01:12 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-08-09 18:01:12 +0000 |
commit | a14ffd86b426ad1cd9b1514face96339a8a9395b (patch) | |
tree | a3987594de24bade5806488e7f5c0ec4fa0475bf | |
parent | 5f8472d54d8c1f47fd85b994f5bb89b7c6aa1ab1 (diff) | |
download | anaconda-a14ffd86b426ad1cd9b1514face96339a8a9395b.tar.gz anaconda-a14ffd86b426ad1cd9b1514face96339a8a9395b.tar.xz anaconda-a14ffd86b426ad1cd9b1514face96339a8a9395b.zip |
authconfig almost done.
-rw-r--r-- | isys/isys.c | 29 | ||||
-rw-r--r-- | isys/isys.py | 3 | ||||
-rw-r--r-- | iutil.py | 4 | ||||
-rw-r--r-- | iw/network.py | 130 | ||||
-rw-r--r-- | po/anaconda-text.pot | 118 | ||||
-rw-r--r-- | text.py | 69 | ||||
-rw-r--r-- | todo.py | 36 |
7 files changed, 268 insertions, 121 deletions
diff --git a/isys/isys.c b/isys/isys.c index 73454f55b..4fe42d873 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -29,6 +29,7 @@ static PyObject * smpAvailable(PyObject * s, PyObject * args); static PyObject * doConfigNetDevice(PyObject * s, PyObject * args); #endif static PyObject * createProbedList(PyObject * s, PyObject * args); +static PyObject * doChroot(PyObject * s, PyObject * args); static PyMethodDef isysModuleMethods[] = { { "findmoduleinfo", (PyCFunction) doFindModInfo, METH_VARARGS, NULL }, @@ -45,6 +46,7 @@ static PyMethodDef isysModuleMethods[] = { #if 0 { "confignetdevice", (PyCFunction) doConfigNetDevice, METH_VARARGS, NULL }, #endif + { "chroot", (PyCFunction) doChroot, METH_VARARGS, NULL }, { NULL } } ; @@ -69,13 +71,13 @@ static PyMethodDef probedListObjectMethods[] = { }; static PySequenceMethods probedListAsSequence = { - probedListLength, /* length */ - 0, /* concat */ - 0, /* repeat */ - probedListSubscript, /* item */ - 0, /* slice */ - 0, /* assign item */ - 0, /* assign slice */ + probedListLength, /* length */ + 0, /* concat */ + 0, /* repeat */ + (intargfunc) probedListSubscript, /* item */ + 0, /* slice */ + 0, /* assign item */ + 0, /* assign slice */ }; static PyTypeObject probedListType = { @@ -322,6 +324,19 @@ static PyObject * doMount(PyObject * s, PyObject * args) { return Py_None; } +static PyObject * doChroot(PyObject * s, PyObject * args) { + char * path; + + if (!PyArg_ParseTuple(args, "s", &path)) return NULL; + + if (chroot (path)) { + PyErr_SetFromErrno(PyExc_SystemError); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + static PyObject * smpAvailable(PyObject * s, PyObject * args) { int result; diff --git a/isys/isys.py b/isys/isys.py index 0387a58df..3cc167bc4 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -10,6 +10,9 @@ def umount(what): def smpAvailable(): return _isys.smpavailable() +def chroot (path): + return _isys.chroot (path) + def probePciDevices(): # probes all probeable buses and returns a list of # ( driver, major, minor, description, args ) tuples, where args is a @@ -1,5 +1,5 @@ -import types, os, sys +import types, os, sys, isys def getfd(filespec, readOnly = 0): if type(filespec) == types.IntType: @@ -20,7 +20,7 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2, childpid = os.fork() if (not childpid): - os.chroot (root) + isys.chroot (root) if stdin != 0: os.dup2(stdin, 0) os.close(stdin) diff --git a/iw/network.py b/iw/network.py index 7ec9371f7..458e6dd1b 100644 --- a/iw/network.py +++ b/iw/network.py @@ -29,22 +29,23 @@ class NetworkWindow (InstallWindow): def setupTODO (self): - if self.DHCPcb.get_active (): - self.dev.set (("bootproto", "dhcp")) - self.dev.unset ("ipaddr", "netmask", "network", "broadcast") - else: - try: - network, broadcast = inet_calcNetBroad (self.ip.get_text (), self.nm.get_text ()) - self.dev.set (("bootproto", "static")) - self.dev.set (("ipaddr", self.ip.get_text ()), ("netmask", self.nm.get_text ()), - ("network", network), ("broadcast", broadcast)) - self.todo.network.gateway = self.gw.get_text () - self.todo.network.primaryNS = self.dns1.get_text () - self.todo.network.guessHostnames () - except: - pass + if self.devs: + if self.DHCPcb.get_active (): + self.dev.set (("bootproto", "dhcp")) + self.dev.unset ("ipaddr", "netmask", "network", "broadcast") + else: + try: + network, broadcast = inet_calcNetBroad (self.ip.get_text (), self.nm.get_text ()) + self.dev.set (("bootproto", "static")) + self.dev.set (("ipaddr", self.ip.get_text ()), ("netmask", self.nm.get_text ()), + ("network", network), ("broadcast", broadcast)) + self.todo.network.gateway = self.gw.get_text () + self.todo.network.primaryNS = self.dns1.get_text () + self.todo.network.guessHostnames () + except: + pass - self.dev.set (("onboot", "yes")) + self.dev.set (("onboot", "yes")) def calcNetmask (self, *args): @@ -80,56 +81,57 @@ class NetworkWindow (InstallWindow): devLine.pack_start (devLabel) menu = GtkMenu () self.devs = self.todo.network.available () - self.devs.keys ().sort () - self.dev = self.devs[self.devs.keys()[0]] - for i in self.devs.keys (): - menu_item = GtkMenuItem (i) - menu_item.connect ("activate", self.devSelected, i) - menu.append (menu_item) - devMenu = GtkOptionMenu () - devMenu.set_menu (menu) - devLine.pack_start (devMenu) - box.pack_start (devLine, FALSE) - - self.DHCPcb = GtkCheckButton ("Configure using DHCP") - self.DHCPcb.set_active (TRUE) - - box.pack_start (self.DHCPcb, FALSE) - box.pack_start (GtkHSeparator (), FALSE, padding=3) - - ipTable = GtkTable (2, 2) - self.ipTable = ipTable - ipTable.attach (GtkLabel ("IP Address:"), 0, 1, 0, 1) - ipTable.attach (GtkLabel ("Netmask:"), 0, 1, 1, 2) - self.ip = GtkEntry (15) - self.ip.connect ("focus_in_event", self.focusInIP) - self.ip.connect ("focus_out_event", self.focusOutIP) - self.ip.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) - self.nm = GtkEntry (15) - self.nm.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) - ipTable.attach (self.ip, 1, 2, 0, 1) - ipTable.attach (self.nm, 1, 2, 1, 2) - box.pack_start (ipTable, FALSE) - - box.pack_start (GtkHSeparator (), FALSE, padding=3) + if self.devs: + self.devs.keys ().sort () + self.dev = self.devs[self.devs.keys()[0]] + for i in self.devs.keys (): + menu_item = GtkMenuItem (i) + menu_item.connect ("activate", self.devSelected, i) + menu.append (menu_item) + devMenu = GtkOptionMenu () + devMenu.set_menu (menu) + devLine.pack_start (devMenu) + box.pack_start (devLine, FALSE) + + self.DHCPcb = GtkCheckButton ("Configure using DHCP") + self.DHCPcb.set_active (TRUE) + + box.pack_start (self.DHCPcb, FALSE) + box.pack_start (GtkHSeparator (), FALSE, padding=3) + + ipTable = GtkTable (2, 2) + self.ipTable = ipTable + ipTable.attach (GtkLabel ("IP Address:"), 0, 1, 0, 1) + ipTable.attach (GtkLabel ("Netmask:"), 0, 1, 1, 2) + self.ip = GtkEntry (15) + self.ip.connect ("focus_in_event", self.focusInIP) + self.ip.connect ("focus_out_event", self.focusOutIP) + self.ip.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) + self.nm = GtkEntry (15) + self.nm.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) + ipTable.attach (self.ip, 1, 2, 0, 1) + ipTable.attach (self.nm, 1, 2, 1, 2) + box.pack_start (ipTable, FALSE) + + box.pack_start (GtkHSeparator (), FALSE, padding=3) - ipTable = GtkTable (5, 2) - ipTable.attach (GtkLabel ("Gateway: "), 0, 1, 0, 1) - ipTable.attach (GtkLabel ("Primary DNS: "), 0, 1, 2, 3) - ipTable.attach (GtkLabel ("Secondary DNS: "), 0, 1, 3, 4) - ipTable.attach (GtkLabel ("Ternary DNS: "), 0, 1, 4, 5) - self.gw = GtkEntry (15) - self.gw.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) - self.dns1 = GtkEntry (15) - self.dns1.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) - self.dns2 = GtkEntry (15) - self.dns2.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) - self.dns3 = GtkEntry (15) - ipTable.attach (self.gw, 1, 2, 0, 1) - ipTable.attach (self.dns1, 1, 2, 2, 3) - ipTable.attach (self.dns2, 1, 2, 3, 4) - ipTable.attach (self.dns3, 1, 2, 4, 5) - box.pack_start (ipTable, FALSE) + ipTable = GtkTable (5, 2) + ipTable.attach (GtkLabel ("Gateway: "), 0, 1, 0, 1) + ipTable.attach (GtkLabel ("Primary DNS: "), 0, 1, 2, 3) + ipTable.attach (GtkLabel ("Secondary DNS: "), 0, 1, 3, 4) + ipTable.attach (GtkLabel ("Ternary DNS: "), 0, 1, 4, 5) + self.gw = GtkEntry (15) + self.gw.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) + self.dns1 = GtkEntry (15) + self.dns1.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) + self.dns2 = GtkEntry (15) + self.dns2.connect ("activate", lambda widget, box=box: box.focus (DIR_TAB_FORWARD)) + self.dns3 = GtkEntry (15) + ipTable.attach (self.gw, 1, 2, 0, 1) + ipTable.attach (self.dns1, 1, 2, 2, 3) + ipTable.attach (self.dns2, 1, 2, 3, 4) + ipTable.attach (self.dns3, 1, 2, 4, 5) + box.pack_start (ipTable, FALSE) return box diff --git a/po/anaconda-text.pot b/po/anaconda-text.pot index 681e614a6..957004cc8 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-07 13:14-0400\n" +"POT-Creation-Date: 1999-08-08 18:23-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: ../text.py:26 ../text.py:561 +#: ../text.py:26 ../text.py:630 msgid "Language Selection" msgstr "" @@ -22,12 +22,12 @@ msgstr "" msgid "What language would you like to use during the installation process?" msgstr "" -#: ../text.py:29 ../text.py:48 ../text.py:115 ../text.py:355 ../text.py:370 -#: ../text.py:538 +#: ../text.py:29 ../text.py:48 ../text.py:115 ../text.py:424 ../text.py:439 +#: ../text.py:607 msgid "Ok" msgstr "" -#: ../text.py:46 ../text.py:562 +#: ../text.py:46 ../text.py:631 msgid "Keyboard Selection" msgstr "" @@ -36,12 +36,12 @@ 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:258 ../text.py:322 ../text.py:355 ../text.py:358 -#: ../text.py:370 ../text.py:371 +#: ../text.py:137 ../text.py:264 ../text.py:327 ../text.py:391 ../text.py:424 +#: ../text.py:427 ../text.py:439 ../text.py:440 msgid "Back" msgstr "" -#: ../text.py:59 ../text.py:569 +#: ../text.py:59 ../text.py:639 msgid "Root Password" msgstr "" @@ -60,8 +60,8 @@ msgstr "" msgid "Password (again):" msgstr "" -#: ../text.py:76 ../text.py:92 ../text.py:97 ../text.py:196 ../text.py:258 -#: ../text.py:322 +#: ../text.py:76 ../text.py:92 ../text.py:97 ../text.py:137 ../text.py:264 +#: ../text.py:327 ../text.py:391 msgid "OK" msgstr "" @@ -97,130 +97,166 @@ msgid "" "purchase through our web site, http://www.redhat.com/." msgstr "" -#: ../text.py:168 +#: ../text.py:139 +msgid "Authentication Configuration" +msgstr "" + +#: ../text.py:140 +msgid "Use Shadow Passwords" +msgstr "" + +#: ../text.py:142 +msgid "Enable MD5 Passwords" +msgstr "" + +#: ../text.py:144 +msgid "Enable NIS" +msgstr "" + +#: ../text.py:149 +msgid "NIS Domain:" +msgstr "" + +#: ../text.py:151 +msgid "NIS Server:" +msgstr "" + +#: ../text.py:153 +msgid "or use:" +msgstr "" + +#: ../text.py:156 +msgid "Request server via broadcast" +msgstr "" + +#: ../text.py:236 msgid "Use bootp/dhcp" msgstr "" -#: ../text.py:173 +#: ../text.py:241 msgid "IP address:" msgstr "" -#: ../text.py:174 +#: ../text.py:242 msgid "Netmask:" msgstr "" -#: ../text.py:175 +#: ../text.py:243 msgid "Default gateway (IP):" msgstr "" -#: ../text.py:176 +#: ../text.py:244 msgid "Primary nameserver:" msgstr "" -#: ../text.py:198 +#: ../text.py:266 msgid "Network Configuration" msgstr "" -#: ../text.py:256 +#: ../text.py:325 msgid "Select individual packages" msgstr "" -#: ../text.py:260 ../text.py:324 +#: ../text.py:329 ../text.py:393 msgid "Package Group Selection" msgstr "" -#: ../text.py:353 +#: ../text.py:422 msgid "Mouse Selection" msgstr "" -#: ../text.py:354 +#: ../text.py:423 msgid "Which model mouse is attached to this computer?" msgstr "" -#: ../text.py:366 +#: ../text.py:435 msgid "Installation to begin" msgstr "" -#: ../text.py:367 +#: ../text.py:436 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:424 ../text.py:425 ../text.py:431 ../text.py:432 +#: ../text.py:493 ../text.py:494 ../text.py:500 ../text.py:501 msgid "Package Installation" msgstr "" -#: ../text.py:434 +#: ../text.py:503 msgid "Name : " msgstr "" -#: ../text.py:435 +#: ../text.py:504 msgid "Size : " msgstr "" -#: ../text.py:436 +#: ../text.py:505 msgid "Summary: " msgstr "" -#: ../text.py:462 +#: ../text.py:531 msgid " Packages" msgstr "" -#: ../text.py:463 +#: ../text.py:532 msgid " Bytes" msgstr "" -#: ../text.py:464 +#: ../text.py:533 msgid " Time" msgstr "" -#: ../text.py:466 +#: ../text.py:535 msgid "Total :" msgstr "" -#: ../text.py:473 +#: ../text.py:542 msgid "Completed: " msgstr "" -#: ../text.py:483 +#: ../text.py:552 msgid "Remaining: " msgstr "" -#: ../text.py:550 +#: ../text.py:619 msgid "Red Hat Linux (C) 1999 Red Hat, Inc." msgstr "" -#: ../text.py:552 +#: ../text.py:621 msgid "" " <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next " "screen" msgstr "" -#: ../text.py:563 +#: ../text.py:632 msgid "Welcome" msgstr "" -#: ../text.py:564 +#: ../text.py:633 msgid "Partition" msgstr "" -#: ../text.py:565 +#: ../text.py:634 msgid "Network Setup" msgstr "" -#: ../text.py:566 +#: ../text.py:635 msgid "Package Groups" msgstr "" -#: ../text.py:567 +#: ../text.py:636 msgid "Individual Packages" msgstr "" -#: ../text.py:568 +#: ../text.py:637 msgid "Mouse Configuration" msgstr "" -#: ../text.py:570 +#: ../text.py:638 +msgid "Authentication" +msgstr "" + +#: ../text.py:640 msgid "Installation Begins" msgstr "" @@ -119,6 +119,72 @@ class WelcomeWindow: return INSTALL_OK +class AuthConfigWindow: + def run(self, screen, todo): + def setsensitive (self): + server = FLAGS_RESET + flag = FLAGS_RESET + if self.broadcast.selected (): + server = FLAGS_SET + if not self.nis.selected (): + flag = FLAGS_SET + server = FLAGS_SET + + self.domain.setFlags (FLAG_DISABLED, flag) + self.broadcast.setFlags (FLAG_DISABLED, flag) + self.server.setFlags (FLAG_DISABLED, server) + + bb = ButtonBar (screen, ((_("OK"), "ok"), (_("Back"), "back"))) + + toplevel = GridForm (screen, _("Authentication Configuration"), 1, 5) + self.shadow = Checkbox (_("Use Shadow Passwords"), todo.auth.useShadow) + toplevel.add (self.shadow, 0, 0, (0, 0, 0, 1), anchorLeft = 1) + self.md5 = Checkbox (_("Enable MD5 Passwords"), todo.auth.useMD5) + toplevel.add (self.md5, 0, 1, (0, 0, 0, 1), anchorLeft = 1) + self.nis = Checkbox (_("Enable NIS"), todo.auth.useNIS) + toplevel.add (self.nis, 0, 2, anchorLeft = 1) + + subgrid = Grid (2, 3) + + subgrid.setField (Label (_("NIS Domain:")), + 0, 0, (0, 0, 1, 0), anchorRight = 1) + subgrid.setField (Label (_("NIS Server:")), + 0, 1, (0, 0, 1, 0), anchorRight = 1) + subgrid.setField (Label (_("or use:")), + 0, 2, (0, 0, 1, 0), anchorRight = 1) + + text = _("Request server via broadcast") + self.domain = Entry (len (text) + 4) + self.domain.set (todo.auth.domain) + self.broadcast = Checkbox (text, todo.auth.useBroadcast) + self.server = Entry (len (text) + 4) + self.server.set (todo.auth.server) + subgrid.setField (self.domain, 1, 0, anchorLeft = 1) + subgrid.setField (self.broadcast, 1, 1, anchorLeft = 1) + subgrid.setField (self.server, 1, 2, anchorLeft = 1) + toplevel.add (subgrid, 0, 3, (2, 0, 0, 1)) + toplevel.add (bb, 0, 4, growx = 1) + + self.nis.setCallback (setsensitive, self) + self.broadcast.setCallback (setsensitive, self) + + setsensitive (self) + + result = toplevel.runOnce () + + todo.auth.useMD5 = self.md5.value () + todo.auth.shadow = self.shadow.value () + todo.auth.useNIS = self.nis.selected () + todo.auth.domain = self.domain.value () + todo.auth.useBroadcast = self.broadcast.selected () + todo.auth.server = self.server.value () + + rc = bb.buttonPressed (result) + + if rc == "back": + return INSTALL_BACK + return INSTALL_OK + class NetworkWindow: def run(self, screen, todo): @@ -158,6 +224,8 @@ class NetworkWindow: self.ns.set (ns) devices = todo.network.available () + if not devices.items () == 0: + return INSTALL_NOOP dev = devices[devices.keys ()[0]] firstg = Grid (1, 1) @@ -567,6 +635,7 @@ class InstallInterface: [_("Package Groups"), PackageGroupWindow, (self.screen, todo, individual)], [_("Individual Packages"), IndividualPackageWindow, (self.screen, todo, individual)], [_("Mouse Configuration"), MouseWindow, (self.screen, todo)], + [_("Authentication"), AuthConfigWindow, (self.screen, todo)], [_("Root Password"), RootPasswordWindow, (self.screen, todo)], [_("Installation Begins"), BeginInstallWindow, (self.screen, todo)], ] @@ -352,12 +352,12 @@ class Keyboard (SimpleConfigFile): class Authentication: def __init__ (self): - self.domain = "" - self.useBroadcast = 0 - self.server = "" - self.useNis = 0 self.useShadow = 1 self.useMD5 = 1 + self.useNIS = 0 + self.domain = "" + self.useBroadcast = 1 + self.server = "" class Drives: def available (self): @@ -478,7 +478,7 @@ class ToDo: kernelVersion = str(self.kernelPackage[rpm.RPMTAG_VERSION]) + \ str(self.kernelPackage[rpm.RPMTAG_RELEASE]) - util.execWithRedirect("/sbin/mkinitrd", [ kernelversion ], + util.execWithRedirect("/sbin/mkinitrd", [ kernelVersion ], stdout = None, stderr = None, searchPath = 1, root = self.instPath) @@ -492,6 +492,8 @@ class ToDo: sl = LiloConfiguration() sl.addEntry("label", "linux") + if not self.mounts.has_key ('/'): + return (dev, type, size) = self.mounts['/'] sl.addEntry("root", '/dev/' + dev) sl.addEntry("read-only") @@ -581,13 +583,32 @@ class ToDo: f.writelines (lines) f.close () + def setupAuthentication (self): + args = [ "--kickstart" ] + if self.auth.useShadow: + args.append ("--useshadow") + if self.auth.useMD5: + args.append ("--enablemd5") + if self.auth.useNIS: + args.append ("--enablenis") + args.append ("--nisdomain") + args.append (self.auth.domain) + if not self.auth.useBroadcast: + args.append ("--nisserver") + args.append (self.auth.server) + util.execWithRedirect("/usr/sbin/authconfig", + args, + stdout = None, stderr = None, searchPath = 1, + root = self.instPath) + def copyConfModules (self): try: inf = open ("/tmp/conf.modules", "r") except: pass - out = open (self.instPath + "/etc/conf.modules", "w") - out.write (inf.read ()) + else: + out = open (self.instPath + "/etc/conf.modules", "w") + out.write (inf.read ()) def doInstall(self, intf): # make sure we have the header list and comps file @@ -672,6 +693,7 @@ class ToDo: self.writeKeyboard () self.writeNetworkConfig () self.writeRootPassword () + self.setupAuthentication () self.copyConfModules () self.installLilo () |