diff options
author | Jeremy Katz <katzj@redhat.com> | 2001-12-27 05:50:12 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2001-12-27 05:50:12 +0000 |
commit | ffae3d1f2a7eec8c2669bb0431ccb8bb7011a028 (patch) | |
tree | 8e0ad6bb6ec41a2612fea774bd9b7456dc9e34a7 | |
parent | 345813c57c3fd10b66b10a1b544f7bd0f3950a7a (diff) | |
download | anaconda-ffae3d1f2a7eec8c2669bb0431ccb8bb7011a028.tar.gz anaconda-ffae3d1f2a7eec8c2669bb0431ccb8bb7011a028.tar.xz anaconda-ffae3d1f2a7eec8c2669bb0431ccb8bb7011a028.zip |
files off the 390 branch
-rw-r--r-- | iw/fdasd_gui.py | 115 | ||||
-rw-r--r-- | iw/zipl_gui.py | 112 | ||||
-rw-r--r-- | textw/fdasd_text.py | 119 | ||||
-rw-r--r-- | textw/zipl_text.py | 70 |
4 files changed, 416 insertions, 0 deletions
diff --git a/iw/fdasd_gui.py b/iw/fdasd_gui.py new file mode 100644 index 000000000..db61de62c --- /dev/null +++ b/iw/fdasd_gui.py @@ -0,0 +1,115 @@ +# +# fdasd_gui.py: interface that allows the user to run util-linux fdasd. +# +# Copyright 2001 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +from gtk import * +from iw_gui import * +from gnome.zvt import * +from translate import _ +from dispatch import DISPATCH_NOOP +import partitioning +import isys +import os +import iutil + +class FDasdWindow (InstallWindow): + def __init__ (self, ics): + InstallWindow.__init__ (self, ics) + self.fdasd_name = _("fdasd") + self.selectlabel = _("Select drive to run fdasd on") + + ics.setTitle (self.fdasd_name) + ics.readHTML ("usefdasd-s390") + + def getNext(self): + # reread partitions + self.diskset.refreshDevices(self.intf) + partitioning.checkNoDisks(self.diskset, self.intf) + self.partrequests.setFromDisk(self.diskset) + + return None + + + def child_died (self, widget, button): + self.windowContainer.remove (self.windowContainer.children ()[0]) + self.windowContainer.pack_start (self.buttonBox) + button.set_state (STATE_NORMAL) + try: + os.remove ('/tmp/' + self.drive) + except: + # XXX fixme + pass + + self.ics.readHTML ("usefdasd-s390") + self.ics.setPrevEnabled (1) + self.ics.setNextEnabled (1) +# self.ics.setHelpEnabled (1) + + + def button_clicked (self, widget, drive): + zvt = ZvtTerm (80, 24) + zvt.set_del_key_swap(TRUE) + zvt.connect ("child_died", self.child_died, widget) + self.drive = drive + + + # free our fd's to the hard drive -- we have to + # fstab.rescanDrives() after this or bad things happen! + if os.access("/sbin/fdasd", os.X_OK): + path = "/sbin/fdasd" + else: + path = "/usr/sbin/fdasd" + + + isys.makeDevInode(drive, '/tmp/' + drive) + + if zvt.forkpty() == 0: + env = os.environ + os.execve (path, (path, '/tmp/' + drive), env) + zvt.show () + + self.windowContainer.remove (self.buttonBox) + self.windowContainer.pack_start (zvt) + + self.ics.readHTML ("usefdasd-s390") + self.ics.setPrevEnabled (0) + self.ics.setNextEnabled (0) + + # FdasdWindow tag="fdasd" + def getScreen (self, diskset, partrequests, intf): + self.diskset = diskset + self.partrequests = partrequests + self.intf = intf + + self.windowContainer = GtkVBox (FALSE) + self.buttonBox = GtkVBox (FALSE, 5) + self.buttonBox.set_border_width (5) + box = GtkVButtonBox () + label = GtkLabel (self.selectlabel) + + drives = self.diskset.driveList() + + # close all references we had to the diskset + self.diskset.closeDevices() + + for drive in drives: + button = GtkButton (drive) + button.connect ("clicked", self.button_clicked, drive) + box.add (button) + + self.buttonBox.pack_start (label, FALSE) + self.buttonBox.pack_start (box, FALSE) + self.windowContainer.pack_start (self.buttonBox) + + self.ics.setNextEnabled (1) + + return self.windowContainer diff --git a/iw/zipl_gui.py b/iw/zipl_gui.py new file mode 100644 index 000000000..0710aa774 --- /dev/null +++ b/iw/zipl_gui.py @@ -0,0 +1,112 @@ +# +# bootloader_gui.py: gui bootloader configuration dialog +# +# Copyright 2001 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# must replace with explcit form so update disks will work +from iw_gui import * + +from gtk import * +from gnome.ui import * +from translate import _, N_ +import gdkpixbuf +import iutil +from package_gui import queryUpgradeContinue +import gui + +class ZiplWindow (InstallWindow): + checkMark = None + checkMark_Off = None + + def __init__ (self, ics): + InstallWindow.__init__ (self, ics) + self.ics.setTitle ("z/IPL") + self.ics.readHTML ("zipl-s390") + self.ics.windowTitle = N_("z/IPL Boot Loader Configuration") + + def getPrev (self): + # avoid coming back in here if the user backs past and then tries + # to skip this screen + pass + + # XXX + # + # if doing an upgrade, offer choice of aborting upgrade. + # we can't allow them to go back in install, since we've + # started swap and mounted the systems filesystems + # if we've already started an upgrade, cannot back out + # + # if we are skipping indivual package selection, must stop it here + # very messy. + # + #if self.todo.upgrade and self.todo.instClass.skipStep("indivpackage"): + #rc = queryUpgradeContinue(self.todo.intf) + #if not rc: + #raise gui.StayOnScreen + #else: + #import sys + #print _("Aborting upgrade") + #sys.exit(0) + + def getNext (self): + self.bl.args.set(self.appendEntry.get_text()) + + + # ZiplWindow tag="zipl" + def getScreen(self, dispatch, bl, fsset, diskSet): + self.dispatch = dispatch + self.bl = bl + self.intf = dispatch.intf + + imageList = bl.images.getImages() + defaultDevice = bl.images.getDefault() + self.ignoreSignals = 0 + + box = GtkVBox(FALSE, 5) + box.set_border_width(5) + label = GtkLabel(_("The z/IPL Boot Loader will now be installed " + "on your system." + "\n" + "\n" + "The root partition will be the one you " + "selected previously in the partition setup." + "\n" + "\n" + "The kernel used to start the machine will be " + "the one to be installed by default." + "\n" + "\n" + "If you wish to make changes later after " + "the installation feel free to change the " + "/etc/zipl.conf configuration file." + "\n" + "\n" + "You can now enter any additional kernel parameters " + "which your machine or your setup may require.")) + label.set_usize(500, -1) + label.set_line_wrap(TRUE) + label.set_alignment(0.0, 0.0) + label.set_padding(50,50) + box.pack_start(label, FALSE) + + box.pack_start (GtkHSeparator (), FALSE) + + label = GtkLabel(_("Kernel Parameters") + ":") + label.set_alignment(0.0, 0.5) + self.appendEntry = GtkEntry() + if bl.args and bl.args.get(): + self.appendEntry.set_text(bl.args.get()) + hbox = GtkHBox(FALSE, 5) + hbox.pack_start(label, FALSE) + hbox.pack_start(self.appendEntry) + box.pack_start(hbox, FALSE) + + return box diff --git a/textw/fdasd_text.py b/textw/fdasd_text.py new file mode 100644 index 000000000..dac27e6ff --- /dev/null +++ b/textw/fdasd_text.py @@ -0,0 +1,119 @@ +# +# fdasd_text.py: allows the user to partition disks with fdasd utility +# in text mode +# +# Harald Hoyer <harald@redhat.de> +# Jeremy Katz <katzj@redhat.com> +# +# Copyright 2001 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +import os +import isys +import iutil +from snack import * +from translate import _, cat, N_ +from constants_text import * +import partitioning + +class fdasdPartitionWindow: + def __call__(self, screen, diskset, partrequests, intf): + choices = [] + + fdisk_name = "fdasd" + listboxtext = _("Choose a disk to run fdasd or dasdfmt on") + buttons = [ (_("OK"), "done"), (_("Edit Partitions"), "edit"), + (_("Format DASD"), "dasdfmt"), + TEXT_BACK_BUTTON ] + drives = diskset.driveList() + + drives.sort() + + for drive in drives: + choices.append("%s" %(drive)) + + # close all references we had to the diskset + diskset.closeDevices() + + button = None + + while button != "done" and button != TEXT_BACK_CHECK: + + (button, choice) = \ + ListboxChoiceWindow(screen, _("Disk Setup"), + listboxtext, choices, + buttons, width = 50, help = "fdasd-s390") + + if button == "edit": + device = choices[choice] + + if os.access("/sbin/fdasd", os.X_OK): + path = "/sbin/fdasd" + else: + path = "/usr/sbin/fdasd" + + try: + isys.makeDevInode(device, '/tmp/' + device) + except: + pass + + screen.suspend() + rc = iutil.execWithRedirect (path, [ path, "/tmp/" + device ], + ignoreTermSigs = 1) + screen.resume() + + if rc: + intf.messageWindow( _("Error"), + _("An error occured while running %s on drive %s.") % (path, device)) + + try: + os.remove('/tmp/' + device) + except: + pass + + elif button == "dasdfmt": + device = choices[choice] + + rc = intf.messageWindow(_("Warning"), + _("Running dasdfmt means the loss of \n" + "ALL DATA on drive %s.\n\n" + "Do you really want this?") + % (device,), type = "yesno") + if rc == 0: + continue + + diskset.dasdFmt(intf, device) + + elif button == "done" or button == TEXT_BACK_CHECK: + diskset.refreshDevices(intf) + partitioning.checkNoDisks(diskset, intf) + partrequests.setFromDisk(diskset) + + if len(diskset.disks.keys()) == 0: + rc = intf.messageWindow(_("No Drives Found"), + _("An error has occurred - no valid devices were " + "found on which to create new filesystems. " + "Please check your hardware for the cause " + "of this problem or use dasdfmt.\n\n" + "Back to the fdasd screen?"), type = "yesno") + + if rc: + button = "" + + + + + if button == TEXT_BACK_CHECK: + return INSTALL_BACK + + partitioning.checkNoDisks(diskset, intf) + partrequests.setFromDisk(diskset) + + return INSTALL_OK diff --git a/textw/zipl_text.py b/textw/zipl_text.py new file mode 100644 index 000000000..f8a15c574 --- /dev/null +++ b/textw/zipl_text.py @@ -0,0 +1,70 @@ +# +# zipl_text.py: text mode z/IPL setup dialog +# +# Copyright 2001 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +import iutil +from snack import * +from constants_text import * +from translate import _ + +class ZiplWindow: + def __call__(self, screen, dispatch, bl, fsset, diskSet): + t = TextboxReflowed(53, + _("The z/IPL Boot Loader will now be installed " + "on your system." + "\n" + "\n" + "The root partition will be the one you " + "selected previously in the partition setup." + "\n" + "\n" + "The kernel used to start the machine will be " + "the one to be installed by default." + "\n" + "\n" + "If you wish to make changes later after " + "the installation feel free to change the " + "/etc/zipl.conf configuration file." + "\n" + "\n" + "You can now enter any additional kernel parameters " + "which your machine or your setup may require.")) + + entry = Entry(48, scroll = 1, returnExit = 1) + + if bl.args and bl.args.get(): + entry.set(bl.args.get()) + + buttons = ButtonBar(screen, [TEXT_OK_BUTTON, + TEXT_BACK_BUTTON ] ) + + grid = GridFormHelp(screen, _("z/IPL Configuration"), + "zipl-s390", 1, 3) + grid.add(t, 0, 0) + sg = Grid(2, 1) + sg.setField(Label(_("Kernel Parameters") + ": "), 0, 0, anchorLeft=1) + sg.setField(entry, 1, 0, anchorLeft=1) + grid.add(sg, 0, 1, padding = (0, 1, 0, 1)) + grid.add(buttons, 0, 2, growx = 1) + + result = grid.runOnce () + button = buttons.buttonPressed(result) + + if button == TEXT_BACK_CHECK: + return INSTALL_BACK + + if entry.value(): + bl.args.set(string.strip(entry.value())) + else: + bl.args.set("") + + return INSTALL_OK |