summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2000-05-16 16:56:11 +0000
committerErik Troan <ewt@redhat.com>2000-05-16 16:56:11 +0000
commit6262ef48189f6716b2448d0584c38f02c695eb6c (patch)
treede9afb779ddb5fcc016fa00fa51f6cc0ba6d2649
parentfdf77eb2b998edad8620fb639e426329172ed6a3 (diff)
downloadanaconda-6262ef48189f6716b2448d0584c38f02c695eb6c.tar.gz
anaconda-6262ef48189f6716b2448d0584c38f02c695eb6c.tar.xz
anaconda-6262ef48189f6716b2448d0584c38f02c695eb6c.zip
reworked mount semantics
-rw-r--r--fstab.py16
-rw-r--r--harddrive.py4
-rw-r--r--image.py3
-rw-r--r--isys/isys.py44
-rw-r--r--todo.py14
5 files changed, 52 insertions, 29 deletions
diff --git a/fstab.py b/fstab.py
index 0a6bd48db..23a0af5da 100644
--- a/fstab.py
+++ b/fstab.py
@@ -363,7 +363,7 @@ class Fstab:
def umountFilesystems(self, instPath, ignoreErrors = 0):
if (not self.setupFilesystems): return
- isys.umount(instPath + '/proc')
+ isys.umount(instPath + '/proc', removeDir = 0)
mounts = self.mountList()
mounts.reverse()
@@ -371,7 +371,7 @@ class Fstab:
if fsystem != "swap":
try:
mntPoint = instPath + n
- isys.umount(mntPoint)
+ isys.umount(mntPoint, removeDir = 0)
except SystemError, (errno, msg):
if not ignoreErrors:
self.messageWindow(_("Error"),
@@ -523,9 +523,7 @@ class Fstab:
_("Creating loopback filesystem on device /dev/%s...") % (device,))
iutil.mkdirChain("/mnt/loophost")
- isys.makeDevInode(device, '/tmp/' + device)
- isys.mount('/tmp/' + device, "/mnt/loophost", fstype = "vfat")
- os.remove( '/tmp/' + device);
+ isys.mount(device, "/mnt/loophost", fstype = "vfat")
isys.makeDevInode("loop0", '/tmp/' + "loop0")
isys.ddfile("/mnt/loophost/redhat.img", self.loopbackSize)
@@ -541,8 +539,7 @@ class Fstab:
stdout = messageFile,
stderr = messageFile, searchPath = 1)
- isys.mount('/tmp/loop0', instPath)
- os.remove('/tmp/loop0')
+ isys.mount("loop0", instPath)
if self.loopbackSwapSize:
isys.ddfile("/mnt/loophost/rh-swap.img",
@@ -557,10 +554,7 @@ class Fstab:
elif fsystem == "ext2":
try:
iutil.mkdirChain(instPath + mntpoint)
- isys.makeDevInode(device, '/tmp/' + device)
- isys.mount('/tmp/' + device,
- instPath + mntpoint)
- os.remove( '/tmp/' + device);
+ isys.mount(device, instPath + mntpoint)
except SystemError, (errno, msg):
self.messageWindow(_("Error"),
_("Error mounting %s: %s") % (device, msg))
diff --git a/harddrive.py b/harddrive.py
index bd42722e4..e72ab4d1e 100644
--- a/harddrive.py
+++ b/harddrive.py
@@ -27,9 +27,7 @@ class HardDriveInstallMethod(InstallMethod):
self.tree = s[1] + "/"
return
- isys.makeDevInode(self.device, '/tmp/' + self.device)
- isys.mount('/tmp/' + self.device, "/tmp/hdimage",
- fstype = self.fstype);
+ isys.mount(self.device, "/tmp/hdimage", fstype = self.fstype);
self.tree = "/tmp/hdimage/"
self.isMounted = 1
diff --git a/image.py b/image.py
index e8f2ca48a..915d117b5 100644
--- a/image.py
+++ b/image.py
@@ -46,10 +46,9 @@ class CdromInstallMethod(ImageInstallMethod):
while not done:
self.messageWindow(_("Change CDROM"),
_("Please insert disc %d to continue.") % self.currentDisc)
- isys.makeDevInode(self.device, "/tmp/cdrom")
try:
- isys.mount("/tmp/cdrom", "/mnt/source", fstype = "iso9660",
+ isys.mount(self.device, "/mnt/source", fstype = "iso9660",
readOnly = 1)
if os.access("/mnt/source/%s" % key, os.O_RDONLY):
diff --git a/isys/isys.py b/isys/isys.py
index 94dbddd0d..1144d5c81 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -2,14 +2,14 @@ import kudzu
import _isys
import string
import os
+import os.path
+
+mountCount = {}
def spaceAvailable(device, fsystem = "ext2"):
- makeDevInode(device, "/tmp/spaceDev")
- mount("/tmp/spaceDev", "/mnt/space", fstype = fsystem)
+ mount(device, "/mnt/space", fstype = fsystem)
space = _isys.devSpaceFree("/mnt/space/.")
umount("/mnt/space")
- os.rmdir("/mnt/space")
- os.remove("/tmp/spaceDev")
return space
def raidstop(mdDevice):
@@ -64,10 +64,40 @@ def ddfile(file, megs):
os.close(fd)
def mount(device, location, fstype = "ext2", readOnly = 0):
- return _isys.mount(fstype, device, location, readOnly)
+ if device != "/proc":
+ devName = "/dev/%s" % device
+ makeDevInode(device, devName)
+ device = devName
+
+ rc = _isys.mount(fstype, device, location, readOnly)
+
+ if not rc:
+ if not mountCount.has_key(location):
+ mountCount[location] = 0
+ mountCount[location] = mountCount[location] + 1
+
+ if device != "/proc":
+ os.unlink(device)
+
+ return rc
-def umount(what):
- return _isys.umount(what)
+def umount(what, removeDir = 1):
+ if not os.path.isdir(what):
+ raise ValueError, "isys.umount() can only umount by mount point"
+
+ if mountCount.has_key(what) and mountCount[what] > 1:
+ mountCount[what] = mountCount - 1
+ return
+
+ rc = _isys.umount(what)
+
+ if removeDir and os.path.isdir(what):
+ os.rmdir(what)
+
+ if not rc and mountCount.has_key(what):
+ del mountCount[what]
+
+ return rc
def smpAvailable():
return _isys.smpavailable()
diff --git a/todo.py b/todo.py
index 7decbb543..60984e187 100644
--- a/todo.py
+++ b/todo.py
@@ -589,6 +589,8 @@ class ToDo:
out.write (inf.read ())
def verifyDeps (self):
+ win = self.intf.waitWindow(_("Dependency Check"),
+ _("Checking dependencies in packages selected for installation..."))
self.getCompsList()
if self.upgrade:
self.fstab.mountFilesystems (self.instPath)
@@ -630,6 +632,9 @@ class ToDo:
if self.upgrade:
del db
self.fstab.umountFilesystems (self.instPath)
+
+ win.pop()
+
return rc
def selectDeps (self, deps):
@@ -649,9 +654,8 @@ class ToDo:
for dev in mdList:
if fstab.isValidExt2 (dev):
- isys.makeDevInode(dev, '/tmp/' + dev)
try:
- isys.mount('/tmp/' + dev, '/mnt/sysimage')
+ isys.mount(dev, '/mnt/sysimage')
except SystemError, (errno, msg):
self.intf.messageWindow(_("Error"),
_("Error mounting ext2 filesystem on %s: %s") % (dev, msg))
@@ -679,9 +683,8 @@ class ToDo:
dev = drive + 'p' + str (i + 1)
else:
dev = drive + str (i + 1)
- isys.makeDevInode(dev, '/tmp/' + dev)
try:
- isys.mount('/tmp/' + dev, '/mnt/sysimage')
+ isys.mount(dev, '/mnt/sysimage')
except SystemError, (errno, msg):
self.intf.messageWindow(_("Error"),
_("Error mounting ext2 filesystem on %s: %s") % (dev, msg))
@@ -698,9 +701,8 @@ class ToDo:
win = self.intf.waitWindow (_("Finding"),
_("Finding packages to upgrade..."))
if self.setupFilesystems:
- isys.makeDevInode(root, '/tmp/' + root)
mdList = raid.startAllRaid(self.fstab.driveList())
- isys.mount('/tmp/' + root, '/mnt/sysimage')
+ isys.mount(root, '/mnt/sysimage')
fstab.readFstab('/mnt/sysimage/etc/fstab', self.fstab)
isys.umount('/mnt/sysimage')
raid.stopAllRaid(mdList)