[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Allow a .iso file to be specified instead of a directory (#707846)
- From: "Brian C. Lane" <bcl redhat com>
- To: anaconda-devel-list redhat com
- Subject: [PATCH] Allow a .iso file to be specified instead of a directory (#707846)
- Date: Fri, 24 Jun 2011 13:38:02 -0700
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
NOTE: This is against master, not f15 as the previous one was
---
pyanaconda/image.py | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/image.py b/pyanaconda/image.py
index 90a264b..a2b1e49 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"),
--
1.7.4.4
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]