summaryrefslogtreecommitdiffstats
path: root/image.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2004-01-06 23:08:35 +0000
committerJeremy Katz <katzj@redhat.com>2004-01-06 23:08:35 +0000
commit86a5e8d0a6e2b6d2bd31fdaac62098a8edc112e7 (patch)
tree61a0b0e8fde4f409b380cb3f7af177e34d85c08f /image.py
parent69792779ccc9abc1ed09d942d940684c2e97b735 (diff)
downloadanaconda-86a5e8d0a6e2b6d2bd31fdaac62098a8edc112e7.tar.gz
anaconda-86a5e8d0a6e2b6d2bd31fdaac62098a8edc112e7.tar.xz
anaconda-86a5e8d0a6e2b6d2bd31fdaac62098a8edc112e7.zip
collapse down the cd finding code so that we don't duplicate as much and
so that we should handle needing to swap cds and putting the next cd in a different cd drive. (#105987)
Diffstat (limited to 'image.py')
-rw-r--r--image.py105
1 files changed, 39 insertions, 66 deletions
diff --git a/image.py b/image.py
index 2521f4eac..828019f9b 100644
--- a/image.py
+++ b/image.py
@@ -210,19 +210,27 @@ class CdromInstallMethod(ImageInstallMethod):
self.unmountCD()
done = 0
+ thepass = 0
cdlist = []
for (dev, something, descript) in \
kudzu.probe(kudzu.CLASS_CDROM, kudzu.BUS_UNSPEC, 0):
cdlist.append(dev)
- for dev in cdlist:
- try:
- if not isys.mount(dev, "/mnt/source", fstype = "iso9660",
- readOnly = 1):
- if os.access("/mnt/source/.discinfo", os.R_OK):
- f = open("/mnt/source/.discinfo")
- newStamp = f.readline().strip()
+ while 1:
+ found = 0
+ for dev in cdlist:
+ try:
+ if isys.mount(self.device, "/mnt/source",
+ fstype = "iso9660", readOnly = 1):
+ time.sleep(3)
+ isys.mount(self.device, "/mnt/source",
+ fstype = "iso9660", readOnly = 1)
+
+ if os.access("/mnt/source/.discinfo", os.R_OK):
+ found = 1
+ f = open("/mnt/source/.discinfo")
+ newStamp = f.readline().strip()
try:
descr = f.readline().strip()
except:
@@ -235,69 +243,34 @@ class CdromInstallMethod(ImageInstallMethod):
discNum = getDiscNums(f.readline().strip())
except:
discNum = [ 0 ]
- f.close()
- if (newStamp == timestamp and
+ f.close()
+ if (newStamp == timestamp and
arch == _arch and
needed in discNum):
- done = 1
+ done = 1
self.currentDisc = discNum
- if not done:
- isys.umount("/mnt/source")
- except:
- pass
-
- if done:
- break
-
- if not done:
- isys.ejectCdrom(self.device)
-
- while not done:
- self.messageWindow(_("Change CDROM"),
- _("Please insert disc %d to continue.") % needed)
-
- try:
- if isys.mount(self.device, "/mnt/source",
- fstype = "iso9660", readOnly = 1):
- time.sleep(3)
- isys.mount(self.device, "/mnt/source",
- fstype = "iso9660", readOnly = 1)
-
-
- if os.access("/mnt/source/.discinfo", os.R_OK):
- f = open("/mnt/source/.discinfo")
- newStamp = f.readline().strip()
- try:
- descr = f.readline().strip()
- except:
- descr = None
- try:
- arch = f.readline().strip()
- except:
- arch = None
- try:
- discNum = getDiscNums(f.readline().strip())
- except:
- discNum = [ 0 ]
- f.close()
- if (newStamp == timestamp and
- arch == _arch and
- needed in discNum):
- done = 1
- self.currentDisc = discNum
- # make /tmp/cdrom again so cd gets ejected
- isys.makeDevInode(self.device, "/tmp/cdrom")
-
- if not done:
- self.messageWindow(_("Wrong CDROM"),
- _("That's not the correct %s CDROM.")
- % (productName,))
- isys.umount("/mnt/source")
- isys.ejectCdrom(self.device)
- except:
- self.messageWindow(_("Error"),
- _("The CDROM could not be mounted."))
+ if not done:
+ isys.umount("/mnt/source")
+ except:
+ pass
+
+ if done:
+ break
+
+ if not done:
+ isys.umount("/mnt/source")
+ isys.ejectCdrom(self.device)
+
+ if found and thepass >= 1:
+ self.messageWindow(_("Wrong CDROM"),
+ _("That's not the correct %s CDROM.")
+ % (productName,))
+ else:
+ self.messageWindow(_("Change CDROM"),
+ _("Please insert disc %d to continue.")
+ % needed)
+ thepass += 1
timer.start()