summaryrefslogtreecommitdiffstats
path: root/fstab.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-01-18 18:06:20 +0000
committerMatt Wilson <msw@redhat.com>2000-01-18 18:06:20 +0000
commit4f2126d16aaef69417dc68e37443c5a89b53d29e (patch)
treebca18fbf9efc61fb7bd8402e769536b42ccadf89 /fstab.py
parent671e3d84213ca17f9dbb6845c0b0801481b951cc (diff)
downloadanaconda-4f2126d16aaef69417dc68e37443c5a89b53d29e.tar.gz
anaconda-4f2126d16aaef69417dc68e37443c5a89b53d29e.tar.xz
anaconda-4f2126d16aaef69417dc68e37443c5a89b53d29e.zip
turn off swap when upgrades are backed up
Diffstat (limited to 'fstab.py')
-rw-r--r--fstab.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/fstab.py b/fstab.py
index 6c170467a..555420877 100644
--- a/fstab.py
+++ b/fstab.py
@@ -181,31 +181,42 @@ class Fstab:
return fstab
- def turnOnSwap(self):
+ def turnOffSwap(self):
+ if not self.swapOn: return
+ self.swapOn = 0
+ for (device, doFormat) in self.swapList():
+ file = '/tmp/swap/' + device
+ isys.swapoff(file)
+
+ def turnOnSwap(self, formatSwap = 1):
# we could be smarter about this
if self.swapOn: return
self.swapOn = 1
- for (device, doFormat) in self.swapList():
- w = self.waitWindow(_("Formatting"),
- _("Formatting swap space on /dev/%s...") % (device,))
+ iutil.mkdirChain('/tmp/swap')
- file = '/tmp/' + device
+ for (device, doFormat) in self.swapList():
+ file = '/tmp/swap/' + device
isys.makeDevInode(device, file)
- rc = iutil.execWithRedirect ("/usr/sbin/mkswap",
+ if formatSwap:
+ w = self.waitWindow(_("Formatting"),
+ _("Formatting swap space on /dev/%s...") %
+ (device,))
+
+ rc = iutil.execWithRedirect ("/usr/sbin/mkswap",
[ "mkswap", '-v1', '/tmp/' + device ],
stdout = None, stderr = None,
searchPath = 1)
- w.pop()
+ w.pop()
- if rc:
- self.messageWindow(_("Error"), _("Error creating swap on device ") + device)
+ if rc:
+ self.messageWindow(_("Error"), _("Error creating swap on device ") + device)
+ else:
+ isys.swapon (file)
else:
isys.swapon (file)
- os.unlink(file)
-
def addNewRaidDevice(self, mountPoint, raidDevice, fileSystem,
raidLevel, deviceList):
self.supplementalRaid.append((mountPoint, raidDevice, fileSystem,