summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2006-01-10 22:59:32 +0000
committerPeter Jones <pjones@redhat.com>2006-01-10 22:59:32 +0000
commit580ef67bde74dd326a9d201511086bf595767380 (patch)
tree0e6461f4617ef1be7545f4ee581f24e377124e4d
parentd6b159a279daa25cc2b3149814f7607960a63d9a (diff)
downloadanaconda-580ef67bde74dd326a9d201511086bf595767380.tar.gz
anaconda-580ef67bde74dd326a9d201511086bf595767380.tar.xz
anaconda-580ef67bde74dd326a9d201511086bf595767380.zip
- fix harddrive installs
-rw-r--r--ChangeLog8
-rw-r--r--harddrive.py70
2 files changed, 43 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index ada8291e7..008337d8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,15 @@
+2006-01-10 Peter Jones <pjones@redhat.com>
+
+ * harddrive.py: add switchMount() and use it where appropriate
+
2006-01-10 Jeremy Katz <katzj@redhat.com>
* anaconda.spec (Version): Bump version.
+2006-01-10 Peter Jones <pjones@redhat.com>
+
+ * dmraid.py: Fix detection of degraded raids
+
2006-01-10 Jesse Keating <jkeating@redhat.com>
* util/mk-rescueimage.ppc: Create mapping file for hfs stuff
diff --git a/harddrive.py b/harddrive.py
index 4ad43ee15..8c5554204 100644
--- a/harddrive.py
+++ b/harddrive.py
@@ -1,12 +1,12 @@
#
# harddrive.py - Install method for hard drive installs
#
-# Copyright 1999-2003 Red Hat, Inc.
+# Copyright 1999-2006 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
-# library public license.
+# General Public License.
#
-# You should have received a copy of the GNU Library Public License
+# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
@@ -31,30 +31,28 @@ log = logging.getLogger("anaconda")
class HardDriveInstallMethod(ImageInstallMethod):
def copyFileToTemp(self, filename):
wasmounted = self.mediaIsMounted
- if not wasmounted:
- self.mountMedia(1)
+ self.switchMedia(1, filename)
path = ImageInstallMethod.copyFileToTemp(self, filename)
- if not wasmounted:
- self.umountMedia()
+ self.switchMedia(wasmounted)
return path
# mounts disc image cdNum under self.tree
def mountMedia(self, cdNum):
- if (self.mediaIsMounted):
- raise SystemError, "trying to mount already-mounted iso image!"
+ if self.mediaIsMounted:
+ raise SystemError, "trying to mount already-mounted iso image!"
- self.mountDirectory()
+ self.mountDirectory()
- isoImage = self.isoDir + '/' + self.path + '/' + self.discImages[cdNum]
+ isoImage = self.isoDir + '/' + self.path + '/' + self.discImages[cdNum]
- isys.makeDevInode("loop3", "/tmp/loop3")
- isys.losetup("/tmp/loop3", isoImage, readOnly = 1)
-
- isys.mount("loop3", "/tmp/isomedia", fstype = 'iso9660', readOnly = 1);
- self.tree = "/tmp/isomedia/"
- self.mediaIsMounted = cdNum
+ isys.makeDevInode("loop3", "/tmp/loop3")
+ isys.losetup("/tmp/loop3", isoImage, readOnly = 1)
+
+ isys.mount("loop3", "/tmp/isomedia", fstype = 'iso9660', readOnly = 1);
+ self.tree = "/tmp/isomedia/"
+ self.mediaIsMounted = cdNum
def umountMedia(self):
if self.mediaIsMounted:
@@ -67,7 +65,7 @@ class HardDriveInstallMethod(ImageInstallMethod):
# This mounts the directory containing the iso images, and places the
# mount point in self.isoDir. It's only used directly by __init__;
- # everything else goes through mountMedia
+ # everything else goes through switchMedia
def mountDirectory(self):
if (self.isoDirIsMounted):
raise SystemError, "trying to mount already-mounted image!"
@@ -98,17 +96,22 @@ class HardDriveInstallMethod(ImageInstallMethod):
# will probably do bad things if called during package installation
# returns None if file doesn't exist
def getFilename(self, filename, callback=None, destdir=None, retry=1):
- if destdir is None:
- destdir = self.getTempPath()
+ if destdir is None:
+ destdir = self.getTempPath()
fn = destdir + '/' + os.path.basename(filename)
- self.mountMedia(1)
- try:
- shutil.copy(self.tree + '/' + filename, fn)
- except:
- fn = None
- self.umountMedia()
- return fn
+ self.switchMedia(1, filename)
+ try:
+ shutil.copy(self.tree + '/' + filename, fn)
+ except:
+ fn = None
+ return fn
+
+ def switchMedia(self, mediano, filename=""):
+ if mediano != self.mediaIsMounted:
+ log.info("switching from iso %s to %s for %s" % (self.mediaIsMounted, mediano, filename))
+ self.umountMedia()
+ self.mountMedia(mediano)
# return reference to the RPM file specified by the header
# will mount the appropriate ISO image as required by CD # in header
@@ -116,17 +119,14 @@ class HardDriveInstallMethod(ImageInstallMethod):
if mediano == 0:
log.warning("header for %s has no disc location tag, assuming "
"it's on the currnt disc" %(filename,))
- elif mediano != self.mediaIsMounted:
- log.info("switching from iso %s to %s" %(self.mediaIsMounted,
- mediano))
- self.umountMedia()
- self.mountMedia(mediano)
+ else:
+ self.switchMedia(mediano, filename=filename)
- return "%s/%s/RPMS/%s" % (self.tree, productPath, filename)
+ return "%s/%s/RPMS/%s" % (self.tree, productPath, filename)
def systemMounted(self, fsset, mntPoint):
- self.mountMedia(1)
-
+ self.switchMedia(1)
+
def systemUnmounted(self):
self.umountMedia()