summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2000-05-16 18:36:20 +0000
committerErik Troan <ewt@redhat.com>2000-05-16 18:36:20 +0000
commit079ebcf356077668c6bda1c6fc09b39787b035ac (patch)
treeb59648b8dc80e7c53ddc4bc00bf99dfc36e7fb9e /isys
parent6262ef48189f6716b2448d0584c38f02c695eb6c (diff)
downloadanaconda-079ebcf356077668c6bda1c6fc09b39787b035ac.tar.gz
anaconda-079ebcf356077668c6bda1c6fc09b39787b035ac.tar.xz
anaconda-079ebcf356077668c6bda1c6fc09b39787b035ac.zip
1) ddfile implemented in python w/ progress bar
2) fixed mount cache
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/isys/isys.py b/isys/isys.py
index 1144d5c81..c6d276e50 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -58,9 +58,27 @@ def unlosetup(device):
_isys.unlosetup(loop)
os.close(loop)
-def ddfile(file, megs):
+def ddfile(file, megs, pw = None):
+ fd = os.open("/dev/zero", os.O_RDONLY);
+ buf = os.read(fd, 1024 * 256)
+ os.close(fd)
+
fd = os.open(file, os.O_RDWR | os.O_CREAT)
- _isys.ddfile(fd, megs)
+
+ total = megs * 4 # we write out 1/4 of a meg each time through
+
+ if pw:
+ (fn, title, text) = pw
+ win = fn(title, text, total - 1)
+
+ for n in range(total):
+ os.write(fd, buf)
+ if pw:
+ win.set(n)
+
+ if pw:
+ win.pop()
+
os.close(fd)
def mount(device, location, fstype = "ext2", readOnly = 0):
@@ -69,12 +87,14 @@ def mount(device, location, fstype = "ext2", readOnly = 0):
makeDevInode(device, devName)
device = devName
+ if mountCount.has_key(location) and mountCount[location] > 0:
+ mountCount[location] = mountCount[location] + 1
+ return
+
rc = _isys.mount(fstype, device, location, readOnly)
if not rc:
- if not mountCount.has_key(location):
- mountCount[location] = 0
- mountCount[location] = mountCount[location] + 1
+ mountCount[location] = 1
if device != "/proc":
os.unlink(device)