summaryrefslogtreecommitdiffstats
path: root/pyanaconda/image.py
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2011-06-23 21:22:23 -0700
committerBrian C. Lane <bcl@redhat.com>2011-06-27 09:25:15 -0700
commitcf8dcd62ce726dd77f2af04c591fbb4aa804a27b (patch)
treef0e2cb0493d841ecd2322f58e69ddf3e9130cdf5 /pyanaconda/image.py
parent0ad1e23902f04c124bd0052d97970e1513f68464 (diff)
downloadanaconda-cf8dcd62ce726dd77f2af04c591fbb4aa804a27b.tar.gz
anaconda-cf8dcd62ce726dd77f2af04c591fbb4aa804a27b.tar.xz
anaconda-cf8dcd62ce726dd77f2af04c591fbb4aa804a27b.zip
Allow a .iso file to be specified instead of a directory (#707846)
Add the ability to specify a full path to the .iso to be mounted instead of just the path to a directory with the single iso in it. This also changes findFirstIsoImage to return the full path instead of just the filename. Resolves: rhbz#707846
Diffstat (limited to 'pyanaconda/image.py')
-rw-r--r--pyanaconda/image.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/pyanaconda/image.py b/pyanaconda/image.py
index 90a264b6a..a2b1e4942 100644
--- a/pyanaconda/image.py
+++ b/pyanaconda/image.py
@@ -30,10 +30,21 @@ log = logging.getLogger("anaconda")
_arch = iutil.getArch()
def findFirstIsoImage(path, messageWindow):
+ """
+ Find the first iso image in path
+ This also supports specifying a specific .iso image
+
+ Returns the full path to the image
+ """
flush = os.stat(path)
- files = os.listdir(path)
arch = _arch
+ if os.path.isfile(path) and path.endswith(".iso"):
+ files = [os.path.basename(path)]
+ path = os.path.dirname(path)
+ else:
+ files = os.listdir(path)
+
for fn in files:
what = path + '/' + fn
log.debug("Checking %s" % (what))
@@ -87,7 +98,7 @@ def findFirstIsoImage(path, messageWindow):
log.info("Found disc at %s" % fn)
isys.umount("/mnt/install/cdimage", removeDir=False)
- return fn
+ return what
return None
@@ -104,6 +115,10 @@ def getMediaId(path):
# This mounts the directory containing the iso images, and places the
# mount point in /mnt/install/isodir.
def mountDirectory(methodstr, messageWindow):
+ # No need to mount it again.
+ if os.path.ismount("/mnt/install/isodir"):
+ return
+
if methodstr.startswith("hd:"):
method = methodstr[3:]
options = ''
@@ -118,15 +133,13 @@ def mountDirectory(methodstr, messageWindow):
device = "/dev/%s" % device
elif methodstr.startswith("nfsiso:"):
(options, host, path) = iutil.parseNfsUrl(methodstr)
+ if path.endswith(".iso"):
+ path = os.path.dirname(path)
device = "%s:%s" % (host, path)
fstype = "nfs"
else:
return
- # No need to mount it again.
- if os.path.ismount("/mnt/install/isodir"):
- return
-
while True:
try:
isys.mount(device, "/mnt/install/isodir", fstype=fstype, options=options)
@@ -156,8 +169,7 @@ def mountImage(isodir, tree, messageWindow):
while True:
try:
- isoImage = "%s/%s" % (isodir, image)
- isys.mount(isoImage, tree, fstype = 'iso9660', readOnly = True)
+ isys.mount(image, tree, fstype = 'iso9660', readOnly = True)
break
except SystemError:
ans = messageWindow(_("Missing ISO 9660 Image"),