summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xanaconda35
-rwxr-xr-xgui.py3
-rw-r--r--harddrive.py2
-rw-r--r--isys/nfsmount.c8
-rw-r--r--iw/format.py16
-rw-r--r--iw/installpath.py29
-rw-r--r--iw/rootpartition.py42
-rw-r--r--text.py5
-rw-r--r--textw/lilo.py3
-rw-r--r--textw/partitioning.py40
-rw-r--r--todo.py267
11 files changed, 97 insertions, 353 deletions
diff --git a/anaconda b/anaconda
index 689cbc1c1..5226d04eb 100755
--- a/anaconda
+++ b/anaconda
@@ -7,6 +7,15 @@ import sys, os
#
sys.path.append('/usr/lib/anaconda')
+# For anaconda in test mode
+if (os.path.exists('rpmmodule')):
+ sys.path.append('rpmmodule')
+ sys.path.append('libfdisk')
+ sys.path.append('balkan')
+ sys.path.append('kudzu')
+ sys.path.append('gnome-map')
+ sys.path.append('isys')
+
# Python passed my path as argv[0]!
# if sys.argv[0][-7:] == "syslogd":
if len(sys.argv) > 1:
@@ -16,15 +25,6 @@ if len(sys.argv) > 1:
output = sys.argv[3]
syslog = Syslogd (root, open (output, "w+"))
-if (os.path.exists('isys')):
- sys.path.append('isys')
- sys.path.append('rpmmodule')
- sys.path.append('libfdisk')
- sys.path.append('balkan')
- sys.path.append('kudzu')
- sys.path.append('gnome-map')
-
-
import gettext
import traceback
import string
@@ -170,20 +170,6 @@ if (not reconfigOnly and not test and not localInstall and os.getpid() > 50):
print "you're running me on a live system! that's incredibly stupid."
sys.exit(1)
-if (os.path.exists('rpmmodule')):
- sys.path.append('rpmmodule')
- sys.path.append('libfdisk')
- sys.path.append('balkan')
- sys.path.append('kudzu')
- sys.path.append('gnome-map')
-#elif (display_mode == None):
-# try:
-# f = open('/dev/fb0', 'r')
-# f.close()
-# display_mode = 'g'
-# except:
-# display_mode = 't'
-
import rpm
import lilo
from todo import ToDo
@@ -296,7 +282,6 @@ if not reconfigOnly:
if reconfigOnly and method != None:
print "Conflicting options: cannot reconfig and install simultaneously!\n"
sys.exit(1)
-
intf = InstallInterface()
# set the default actions
@@ -345,7 +330,7 @@ try:
todo = ToDo(intf, method, rootPath, installSystem = installPackages,
setupFilesystems = setupFilesystems, mouse = mouseInfo,
instClass = instClass, x = x, expert = expert,
- serial = serial, reconfigOnly = reconfigOnly,
+ serial = serial, reconfigOnly = reconfigOnly, test = test,
extraModules = extraModules)
intf.run(todo, test = test)
except:
diff --git a/gui.py b/gui.py
index 2665be0bd..92d8561b4 100755
--- a/gui.py
+++ b/gui.py
@@ -10,6 +10,7 @@ from gtk import *
from gtk import _root_window
import GdkImlib
from GDK import *
+from fstab import GuiFstab
im = None
splashwindow = None
@@ -475,6 +476,8 @@ class InstallControlWindow (Thread):
Thread.__init__ (self)
self.ii = ii
self.todo = todo
+ self.todo.fstab = GuiFstab(todo.setupFilesystems, todo.serial, 0, 0,
+ todo.intf.waitWindow)
self.steps = steps
if os.environ.has_key ("LC_ALL"):
self.locale = os.environ["LC_ALL"][:2]
diff --git a/harddrive.py b/harddrive.py
index 4c31c6582..24458f94b 100644
--- a/harddrive.py
+++ b/harddrive.py
@@ -45,7 +45,7 @@ class InstallMethod:
def targetFstab(self, fstab):
self.isMounted = 0
- for (mntpoint, (device, fsystem, reformat)) in fstab.items():
+ for (mntpoint, device, fsystem, reformat, size) in self.mountList():
if (device == self.device):
self.isMounted = 1
self.tree = "/mnt/sysimage" + mntpoint + "/" + self.path
diff --git a/isys/nfsmount.c b/isys/nfsmount.c
index e4537f779..58b5fc1cc 100644
--- a/isys/nfsmount.c
+++ b/isys/nfsmount.c
@@ -82,7 +82,7 @@ die (int err, const char *fmt, ...) {
}
char *
-xstrdup (const char *s) {
+nfsxstrdup (const char *s) {
char *t;
if (s == NULL)
@@ -111,7 +111,7 @@ xstrndup (const char *s, int n) {
}
void *
-xmalloc(size_t size)
+nfsxmalloc(size_t size)
{
void *ptr = malloc(size);
if (!ptr)
@@ -258,7 +258,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
}
sprintf(new_opts, "%s%saddr=%s",
old_opts, *old_opts ? "," : "", s);
- *extra_opts = xstrdup(new_opts);
+ *extra_opts = nfsxstrdup(new_opts);
/* Set default options.
* rsize/wsize (and bsize, for ver >= 3) are left 0 in order to
@@ -551,7 +551,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
goto fail;
}
if (!running_bg) {
- prev_bg_host = xstrdup(hostname);
+ prev_bg_host = nfsxstrdup(hostname);
if (retry > 0)
retval = EX_BG;
goto fail;
diff --git a/iw/format.py b/iw/format.py
index 153bf310e..332f7da48 100644
--- a/iw/format.py
+++ b/iw/format.py
@@ -15,28 +15,24 @@ class FormatWindow (InstallWindow):
ics.readHTML ("format")
def getScreen (self):
- def toggled (widget, (todo, mount)):
+ def toggled (widget, (todo, dev)):
if widget.get_active ():
- (dev, fstype, format) = todo.mounts[mount]
- todo.mounts[mount] = (dev, fstype, 1)
+ todo.fstab.setFormatFilesystem(dev, 1)
else:
- (dev, fstype, format) = todo.mounts[mount]
- todo.mounts[mount] = (dev, fstype, 0)
+ todo.fstab.setFormatFilesystem(dev, 0)
def check (widget, todo):
todo.badBlockCheck = widget.get_active ()
box = GtkVBox (FALSE, 10)
- mounts = self.todo.mounts.keys ()
- mounts.sort ()
+ mounts = self.todo.fstab.mountList()
- for mount in mounts:
- (dev, fstype, format) = self.todo.mounts[mount]
+ for (mount, dev, fstype, format, size) in mounts:
if fstype == "ext2":
checkButton = GtkCheckButton ("/dev/%s %s" % (dev, mount))
checkButton.set_active (format)
- checkButton.connect ("toggled", toggled, (self.todo, mount))
+ checkButton.connect ("toggled", toggled, (self.todo, dev))
box.pack_start (checkButton)
vbox = GtkVBox (FALSE, 10)
diff --git a/iw/installpath.py b/iw/installpath.py
index 2f2caed67..4be55f634 100644
--- a/iw/installpath.py
+++ b/iw/installpath.py
@@ -207,24 +207,21 @@ class InstallPathWindow (InstallWindow):
box.pack_start(table, FALSE)
- if self.todo.expert:
- hbox = GtkHBox (FALSE)
- if not InstallPathWindow.__dict__.has_key("fdisk"):
- fdiskState = 0
- else:
- fdiskState = InstallPathWindow.fdisk.get_active()
+ hbox = GtkHBox (FALSE)
+ if not InstallPathWindow.__dict__.has_key("fdisk"):
+ fdiskState = 0
+ else:
+ fdiskState = InstallPathWindow.fdisk.get_active()
- InstallPathWindow.fdisk = GtkCheckButton (_("Use fdisk"))
- InstallPathWindow.fdisk.set_active(fdiskState)
+ InstallPathWindow.fdisk = GtkCheckButton (_("Use fdisk"))
+ InstallPathWindow.fdisk.set_active(fdiskState)
- align = GtkAlignment ()
- align.add (InstallPathWindow.fdisk)
- align.set (0.0, 0.0, 0.0, 0.0)
- hbox.pack_start (box, TRUE)
- hbox.pack_start (align, FALSE)
- box = hbox
- else:
- InstallPathWindow.fdisk = None
+ align = GtkAlignment ()
+ align.add (InstallPathWindow.fdisk)
+ align.set (0.0, 0.0, 0.0, 0.0)
+ hbox.pack_start (box, TRUE)
+ hbox.pack_start (align, FALSE)
+ box = hbox
self.toggled (installButton, INSTALL)
self.toggled (self.upgradeButton, UPGRADE)
diff --git a/iw/rootpartition.py b/iw/rootpartition.py
index 5b9b33093..4618a0f1b 100644
--- a/iw/rootpartition.py
+++ b/iw/rootpartition.py
@@ -51,7 +51,7 @@ class PartitionWindow (InstallWindow):
return 0
self.todo.ddruid.save ()
- self.todo.makeFilesystems (createFs = 0)
+ self.fstab.turnOnSwap(self.intf.waitWindow)
self.todo.ddruidAlreadySaved = 1
PartitionWindow.swapon = 1
@@ -60,7 +60,7 @@ class PartitionWindow (InstallWindow):
return 1
def getNext (self):
- self.todo.ddruid.next ()
+ self.todo.fstab.runDruidFinished()
if not self.skippedScreen:
win = self.todo.ddruid.getConfirm ()
@@ -74,47 +74,15 @@ class PartitionWindow (InstallWindow):
bootPartition = None
rootPartition = None
- fstab = self.todo.ddruid.getFstab ()
- self.todo.resetMounts()
- for (partition, mount, fsystem, size) in fstab:
- self.todo.addMount(partition, mount, fsystem)
- if mount == "/":
- rootPartition = partition
- elif mount == "/boot":
- bootPartition = partition
-
- (drives, raid) = self.todo.ddruid.partitionList()
-
- liloBoot = None
-
if not self.checkSwap ():
return PartitionWindow
- for (mount, device, fstype, raidType, start, size, makeup) in raid:
- self.todo.addMount(device, mount, fstype)
-
- if mount == "/":
- rootPartition = device
- elif mount == "/boot":
- bootPartition = device
-
- if (bootPartition):
- liloBoot = bootPartition
- else:
- liloBoot = rootPartition
-
- if liloBoot and len (liloBoot) >= 2 and liloBoot[0:2] == "md":
- self.todo.setLiloLocation(("raid", liloBoot))
- self.todo.instClass.addToSkipList("lilo")
-
return None
def enableCallback (self, value):
self.ics.setNextEnabled (value)
def getScreen (self):
- self.todo.ddruid.setCallback (self.enableCallback)
-
if self.todo.getSkipPartitioning():
self.skippedScreen = 1
fstab = self.todo.ddruid.getFstab ()
@@ -129,10 +97,8 @@ class PartitionWindow (InstallWindow):
return AutoPartitionWindow
return None
- self.bin = GtkFrame (None, _obj = self.todo.ddruid.getWindow ())
- self.bin.set_shadow_type (SHADOW_NONE)
- self.todo.ddruid.edit ()
-
+ return self.todo.fstab.runDruid(self.enableCallback)
+
return self.bin
class AutoPartitionWindow(InstallWindow):
diff --git a/text.py b/text.py
index 1dc1a34a7..18ffa0893 100644
--- a/text.py
+++ b/text.py
@@ -8,6 +8,7 @@ import rpm
import time
import gettext_rh
import glob
+from fstab import NewtFstab
cat = gettext_rh.Catalog ("anaconda", "/usr/share/locale")
@@ -1018,7 +1019,7 @@ class InstallInterface:
self.screen.pushHelpLine (_(" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"))
# uncomment this line to make the installer quit on <Ctrl+Z>
# handy for quick debugging.
-# self.screen.suspendCallback(killSelf, self.screen)
+ self.screen.suspendCallback(killSelf, self.screen)
# uncomment this line to drop into the python debugger on <Ctrl+Z>
# --VERY handy--
# self.screen.suspendCallback(debugSelf, self.screen)
@@ -1032,6 +1033,8 @@ class InstallInterface:
def run(self, todo, test = 0):
if todo.serial:
self.screen.suspendCallback(spawnShell, self.screen)
+ todo.fstab = NewtFstab(todo.setupFilesystems, todo.serial, 0, 0,
+ self.waitWindow)
if todo.reconfigOnly:
self.commonSteps = [
diff --git a/textw/lilo.py b/textw/lilo.py
index 648bfe62d..d86996c1d 100644
--- a/textw/lilo.py
+++ b/textw/lilo.py
@@ -54,7 +54,8 @@ class LiloAppendWindow:
class LiloWindow:
def __call__(self, screen, todo):
- if '/' not in todo.mounts.keys (): return INSTALL_NOOP
+ (mount, dev, fstype, format, size) = todo.fstab.mountList()[0]
+ if mount != '/': return INSTALL_NOOP
if todo.skipLilo: return INSTALL_NOOP
(bootpart, boothd) = todo.getLiloOptions()
diff --git a/textw/partitioning.py b/textw/partitioning.py
index 91d29dcdc..cfca7ddcc 100644
--- a/textw/partitioning.py
+++ b/textw/partitioning.py
@@ -8,7 +8,7 @@ from text import _
class PartitionMethod:
def __call__(self, screen, todo):
- if not todo.expert or todo.instClass.partitions:
+ if todo.instClass.partitions:
todo.skipFdisk = 1
return INSTALL_NOOP
@@ -106,6 +106,7 @@ class ManualPartitionWindow:
class AutoPartitionWindow:
def __call__(self, screen, todo):
+ return
from newtpyfsedit import fsedit
fstab = []
@@ -143,11 +144,7 @@ class PartitionWindow:
def __call__(self, screen, todo):
dir = INSTALL_NOOP
if not todo.getSkipPartitioning():
- dir = todo.ddruid.edit ()
-
- todo.resetMounts()
- for partition, mount, fstype, size in todo.ddruid.getFstab ():
- todo.addMount(partition, mount, fstype)
+ dir = todo.fstab.runDruid()
return dir
@@ -171,7 +168,7 @@ class TurnOnSwapWindow:
return INSTALL_BACK
todo.ddruid.save ()
- todo.makeFilesystems (createFs = 0)
+ self.fstab.turnOnSwap(self.intf.waitWindow)
todo.ddruidAlreadySaved = 1
self.beenTurnedOn = 1
@@ -188,40 +185,35 @@ class FormatWindow:
"already been configured during a "
"previous install."))
- height = min (screen.height - 12, len (todo.mounts.items()))
+ mounts = todo.fstab.mountList()
+ height = min (screen.height - 12, len (mounts))
ct = CheckboxTree(height = height)
- mounts = todo.mounts.keys ()
- mounts.sort ()
-
- for mount in mounts:
- (dev, fstype, format) = todo.mounts[mount]
+ for (mount, dev, fstype, format, size) in mounts:
if fstype == "ext2":
- ct.append("/dev/%s %s" % (dev, mount), mount, format)
+ ct.append("/dev/%s %s" % (dev, mount), dev, format)
- cb = Checkbox (_("Check for bad blocks during format"))
+ cb = Checkbox (_("Check for bad blocks during format"),
+ todo.fstab.getBadBlockCheck())
bb = ButtonBar (screen, ((_("OK"), "ok"), (_("Back"), "back")))
g = GridForm (screen, _("Choose Partitions to Format"), 1, 4)
g.add (tb, 0, 0, (0, 0, 0, 1))
g.add (ct, 0, 1)
- g.add (cb, 0, 2, (0, 0, 0, 1))
+ g.add (cb, 0, 2, (0, 1, 0, 1))
g.add (bb, 0, 3, growx = 1)
result = g.runOnce()
- for mount in todo.mounts.keys ():
- (dev, fstype, format) = todo.mounts[mount]
- if fstype == "ext2":
- todo.mounts[mount] = (dev, fstype, 0)
+ for (mount, dev, fstype, format, size) in mounts:
+ todo.fstab.setFormatFilesystem(dev, 0)
- for mount in ct.getSelection():
- (dev, fstype, format) = todo.mounts[mount]
- todo.mounts[mount] = (dev, fstype, 1)
+ for dev in ct.getSelection():
+ todo.fstab.setFormatFilesystem(dev, 1)
- todo.badBlockCheck = cb.selected ()
+ todo.fstab.setBadBlockCheck(cb.selected ())
rc = bb.buttonPressed (result)
diff --git a/todo.py b/todo.py
index be3da4bf6..383e73e4b 100644
--- a/todo.py
+++ b/todo.py
@@ -38,12 +38,13 @@ class FakeDDruid:
self.partitions = []
class LogFile:
- def __init__ (self, serial, reconfigOnly):
+ def __init__ (self, serial, reconfigOnly, test):
if serial or reconfigOnly:
- if serial:
- self.logFile = open("/tmp/install.log", "w")
- else:
- self.logFile = open("/tmp/reconfig.log", "w")
+ self.logFile = open("/tmp/install.log", "w")
+ elif reconfigOnly:
+ self.logFile = open("/tmp/reconfig.log", "w")
+ elif test:
+ self.logFile = open("anaconda-debug.log", "w")
else:
self.logFile = open("/dev/tty3", "w")
@@ -271,10 +272,10 @@ class InstSyslog:
class ToDo:
def __init__(self, intf, method, rootPath, setupFilesystems = 1,
installSystem = 1, mouse = None, instClass = None, x = None,
- expert = 0, serial = 0, reconfigOnly = 0, extraModules = []):
+ expert = 0, serial = 0, reconfigOnly = 0, test = 0,
+ extraModules = []):
self.intf = intf
self.method = method
- self.mounts = {}
self.hdList = None
self.comps = None
self.instPath = rootPath
@@ -282,8 +283,9 @@ class ToDo:
self.installSystem = installSystem
self.language = Language ()
self.serial = serial
+ self.fstab = None
self.reconfigOnly = reconfigOnly
- self.log = LogFile (serial, reconfigOnly)
+ self.log = LogFile (serial, reconfigOnly, test)
self.network = Network ()
self.rootpassword = Password ()
self.extraModules = extraModules
@@ -294,7 +296,6 @@ class ToDo:
self.keyboard = Keyboard ()
self.auth = Authentication ()
self.desktop = Desktop ()
- self.ddruid = None
self.ddruidReadOnly = 0
self.drives = Drives ()
self.badBlockCheck = 0
@@ -350,25 +351,6 @@ class ToDo:
else:
f.close()
- def umountFilesystems(self):
- if (not self.setupFilesystems): return
-
- isys.umount(self.instPath + '/proc')
-
- keys = self.mounts.keys ()
- keys.sort()
- keys.reverse()
- for n in keys:
- (device, fsystem, format) = self.mounts[n]
- if fsystem != "swap":
- try:
- mntPoint = self.instPath + n
- self.log("unmounting " + mntPoint)
- isys.umount(mntPoint)
- except SystemError, (errno, msg):
- self.intf.messageWindow(_("Error"),
- _("Error unmounting %s: %s") % (device, msg))
-
def writeTimezone(self):
if (self.timezone):
(timezone, asUtc, asArc) = self.timezone
@@ -399,10 +381,15 @@ class ToDo:
self.timezone = (timezone, asUtc, asArc)
def getLiloOptions(self):
- if self.mounts.has_key ('/boot'):
- bootpart = self.mounts['/boot'][0]
+ mountPoints = {}
+ for (mntpoint, device, fsystem, doFormat, size) in \
+ self.fstab.mountList():
+ mountPoints[mntpoint] = device
+
+ if mountPoints.has_key ('/boot'):
+ bootpart = mountPoints['/boot']
else:
- bootpart = self.mounts['/'][0]
+ bootpart = mountPoints['/']
i = len (bootpart) - 1
while i < 0 and bootpart[i] in digits:
i = i - 1
@@ -416,16 +403,16 @@ class ToDo:
self.liloImages = images
def getLiloImages(self):
- if not self.ddruid:
- raise RuntimeError, "No disk druid object"
+ if not self.__dict__.has_key('fstab'):
+ raise RuntimeError, "No fstab object"
- (drives, raid) = self.ddruid.partitionList()
+ (drives, raid) = self.fstab.partitionList()
# rearrange the fstab so it's indexed by device
mountsByDev = {}
- for loc in self.mounts.keys():
- (device, fsystem, reformat) = self.mounts[loc]
- mountsByDev[device] = loc
+ for (mntpoint, device, fsystem, doFormat, size) in \
+ self.fstab.mountList():
+ mountsByDev[device] = mntpoint
oldImages = {}
for dev in self.liloImages.keys():
@@ -457,157 +444,6 @@ class ToDo:
return self.liloImages
- def createRaidTab(self, file, devPrefix, createDevices = 0):
- (devices, raid) = self.ddruid.partitionList()
- if not raid: return
-
- deviceDict = {}
- for (device, name, type, start, size) in devices:
- deviceDict[name] = device
-
- rt = open(file, "w")
- for (mntpoint, device, fstype, raidType, start, size, makeup) in raid:
-
- if createDevices:
- isys.makeDevInode(device, devPrefix + '/' + device)
-
- rt.write("raiddev %s/%s\n" % (devPrefix, device,))
- rt.write("raid-level %d\n" % (raidType,))
- rt.write("nr-raid-disks %d\n" % (len(makeup),))
- rt.write("chunk-size 64k\n")
- rt.write("persistent-superblock 1\n");
- rt.write("#nr-spare-disks 0\n")
- i = 0
- for subDevName in makeup:
- isys.makeDevInode(deviceDict[subDevName], '%s/%s' %
- (devPrefix, deviceDict[subDevName]))
- rt.write(" device %s/%s\n" %
- (devPrefix, deviceDict[subDevName],))
- rt.write(" raid-disk %d\n" % (i,))
- i = i + 1
-
- rt.write("\n")
- rt.close()
-
- def mountFilesystems(self):
- if (not self.setupFilesystems): return
-
- keys = self.mounts.keys ()
- keys.sort()
- for mntpoint in keys:
- (device, fsystem, format) = self.mounts[mntpoint]
- if fsystem == "swap":
- continue
- elif fsystem == "ext2":
- try:
- iutil.mkdirChain(self.instPath + mntpoint)
- isys.makeDevInode(device, '/tmp/' + device)
- isys.mount('/tmp/' + device,
- self.instPath + mntpoint)
- os.remove( '/tmp/' + device);
- except SystemError, (errno, msg):
- self.intf.messageWindow(_("Error"),
- _("Error mounting %s: %s") % (device, msg))
-
- try:
- os.mkdir (self.instPath + '/proc')
- except:
- pass
-
- isys.mount('/proc', self.instPath + '/proc', 'proc')
-
- def makeFilesystems(self, createSwap = 1, createFs = 1):
- if not self.setupFilesystems: return
-
- # let's make the RAID devices first -- the fstab will then proceed
- # naturally
- (devices, raid) = self.ddruid.partitionList()
-
- if raid:
- self.createRaidTab("/tmp/raidtab", "/tmp", createDevices = 1)
-
- w = self.intf.waitWindow(_("Creating"),
- _("Creating RAID devices..."))
-
- for (mntpoint, device, fsType, raidType, start, size, makeup) in raid:
- iutil.execWithRedirect ("/usr/sbin/mkraid",
- [ 'mkraid', '--really-force', '--configfile',
- '/tmp/raidtab', '/tmp/' + device ])
-
- w.pop()
-
- # XXX remove extraneous inodes here
-
- keys = self.mounts.keys ()
-
- keys.sort()
-
- arch = iutil.getArch ()
-
- if arch == "alpha":
- if '/boot' in keys:
- kernelPart = '/boot'
- else:
- kernelPart = '/'
-
- for mntpoint in keys:
- (device, fsystem, format) = self.mounts[mntpoint]
- if not format: continue
- isys.makeDevInode(device, '/tmp/' + device)
- if fsystem == "ext2" and createFs:
- args = [ "mke2fs", '/tmp/' + device ]
- # FORCE the partition that MILO has to read
- # to have 1024 block size. It's the only
- # thing that our milo seems to read.
- if arch == "alpha" and mntpoint == kernelPart:
- args = args + ["-b", "1024"]
- # set up raid options for md devices.
- if device[:2] == 'md':
- for (rmnt, rdevice, fsType, raidType, start, size, makeup) in raid:
- if rdevice == device:
- rtype = raidType
- rdisks = len (makeup)
- if rtype == 5:
- rdisks = rdisks - 1
- args = args + [ '-R', 'stride=%d' % (rdisks * 16) ]
- elif rtype == 0:
- args = args + [ '-R', 'stride=%d' % (rdisks * 16) ]
-
- if self.badBlockCheck:
- args.append ("-c")
-
- w = self.intf.waitWindow(_("Formatting"),
- _("Formatting %s filesystem...") % (mntpoint,))
-
- if self.serial:
- messages = "/tmp/mke2fs.log"
- else:
- messages = "/dev/tty5"
- iutil.execWithRedirect ("/usr/sbin/mke2fs",
- args,
- stdout = messages, stderr = messages,
- searchPath = 1)
- w.pop()
- elif fsystem == "swap" and createSwap:
- w = self.intf.waitWindow(_("Formatting"),
- _("Formatting %s filesystem...") % (mntpoint,))
-
- rc = iutil.execWithRedirect ("/usr/sbin/mkswap",
- [ "mkswap", '-v1', '/tmp/' + device ],
- stdout = None, stderr = None,
- searchPath = 1)
- if rc:
- raise RuntimeError, "error making swap on " + device
- isys.swapon ('/tmp/' + device)
- w.pop()
- else:
- pass
-
- os.remove('/tmp/' + device)
-
- if createSwap:
- self.swapCreated = 1
-
def addMount(self, device, location, fsystem, reformat = 1):
if fsystem == "swap":
ufs = 0
@@ -624,38 +460,6 @@ class ToDo:
reformat = 1
self.mounts[location] = (device, fsystem, reformat)
- def resetMounts(self):
- self.mounts = {}
-
- def writeFstab(self):
- format = "%-23s %-23s %-7s %-15s %d %d\n";
-
- f = open (self.instPath + "/etc/fstab", "w")
- keys = self.mounts.keys ()
- keys.sort ()
- self.setFdDevice ()
- for mntpoint in keys:
- (dev, fs, reformat) = self.mounts[mntpoint]
- iutil.mkdirChain(self.instPath + mntpoint)
- if (mntpoint == '/'):
- f.write (format % ( '/dev/' + dev, mntpoint, fs, 'defaults', 1, 1))
- else:
- if (fs == "ext2"):
- f.write (format % ( '/dev/' + dev, mntpoint, fs, 'defaults', 1, 2))
- elif fs == "iso9660":
- f.write (format % ( '/dev/' + dev, mntpoint, fs, 'noauto,owner,ro', 0, 0))
- else:
- f.write (format % ( '/dev/' + dev, mntpoint, fs, 'defaults', 0, 0))
- f.write (format % (self.fdDevice, "/mnt/floppy", 'ext2', 'noauto,owner', 0, 0))
- f.write (format % ("none", "/proc", 'proc', 'defaults', 0, 0))
- f.write (format % ("none", "/dev/pts", 'devpts', 'gid=5,mode=620', 0, 0))
- f.close ()
- # touch mtab
- open (self.instPath + "/etc/mtab", "w+")
- f.close ()
-
- self.createRaidTab("/mnt/sysimage/etc/raidtab", "/dev")
-
def readFstab (self, path):
f = open (path, "r")
lines = f.readlines ()
@@ -783,9 +587,9 @@ class ToDo:
"up in lilo")
smpInstalled = 0
- if self.mounts.has_key ('/'):
- (dev, fstype, format) = self.mounts['/']
- rootDev = dev
+ (mntpoint, device, fsystem, doFormat, size) = self.fstab.mountList()[0]
+ if mntpoint == "/":
+ rootDev = device
else:
raise RuntimeError, "Installing lilo, but there is no root device"
@@ -1168,10 +972,6 @@ class ToDo:
for (mntpoint, (dev, fstype, reformat)) in todo.instClass.fstab:
todo.addMount(dev, mntpoint, fstype, reformat)
- if todo.ddruid:
- todo.ddruid = None
- todo.mounts = {}
-
todo.users = []
if todo.instClass.rootPassword:
todo.rootpassword.set(todo.instClass.rootPassword)
@@ -1404,14 +1204,15 @@ class ToDo:
if self.setupFilesystems:
if not self.upgrade:
if (self.ddruidAlreadySaved):
- self.makeFilesystems (createSwap = 0)
+ self.makeFilesystems ()
else:
- self.ddruid.save ()
- self.makeFilesystems (createSwap = (not self.swapCreated))
+ self.fstab.savePartitions ()
+ self.fstab.turnOnSwap()
+ self.fstab.makeFilesystems ()
else:
(drives, raid) = self.ddruid.partitionList()
- self.mountFilesystems ()
+ self.fstab.mountFilesystems (self.instPath)
if self.upgrade:
w = self.intf.waitWindow(_("Rebuilding"),
@@ -1425,7 +1226,7 @@ class ToDo:
# XXX do something sane here.
raise RuntimeError, "panic"
- self.method.targetFstab (self.mounts)
+ self.method.targetFstab (self.fstab)
if not self.installSystem:
return
@@ -1518,7 +1319,7 @@ class ToDo:
del syslog
if self.setupFilesystems:
- self.umountFilesystems ()
+ self.umountFilesystems (self.intf.messageWindow)
return 1