summaryrefslogtreecommitdiffstats
path: root/pyanaconda
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2012-11-15 22:31:32 -0800
committerJesse Keating <jkeating@redhat.com>2012-11-20 11:32:32 -0800
commit901f6e3f49bfb8c1243299b5b3700361ad84a480 (patch)
tree40e2cb77583890695ba9a4495a826a268a1c0742 /pyanaconda
parentc90d1bc1fb038c010a22a373fed47933aac074b9 (diff)
downloadanaconda-901f6e3f49bfb8c1243299b5b3700361ad84a480.tar.gz
anaconda-901f6e3f49bfb8c1243299b5b3700361ad84a480.tar.xz
anaconda-901f6e3f49bfb8c1243299b5b3700361ad84a480.zip
Handle hd iso leavings by dracut (#876897)
Re-arranges a bit of code and handles dracut mounted hd isos. Also handles a None type on self._currentIsoFile better.
Diffstat (limited to 'pyanaconda')
-rw-r--r--pyanaconda/packaging/yumpayload.py38
-rw-r--r--pyanaconda/ui/gui/spokes/source.py42
2 files changed, 58 insertions, 22 deletions
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index b52fb678d..65691105c 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -497,8 +497,17 @@ reposdir=%s
@property
def ISOImage(self):
- if self.data.method.method == "harddrive":
- return get_mount_device(INSTALL_TREE)[len(ISO_DIR)+1:]
+ if not self.data.method.method == "harddrive":
+ return None
+ # This could either be mounted to INSTALL_TREE or on
+ # DRACUT_REPODIR if dracut did the mount.
+ dev = get_mount_device(INSTALL_TREE)
+ if dev:
+ return dev[len(ISO_DIR)+1:]
+ dev = get_mount_device(DRACUT_REPODIR)
+ if dev:
+ return dev[len(DRACUT_ISODIR)+1:]
+ return None
def _setUpMedia(self, device):
method = self.data.method
@@ -560,6 +569,9 @@ reposdir=%s
method = self.data.method
sslverify = True
url = None
+ # See if we already have stuff mounted due to dracut
+ isodev = get_mount_device(DRACUT_ISODIR)
+ device = get_mount_device(DRACUT_REPODIR)
if method.method == "harddrive":
if method.biospart:
@@ -567,15 +579,21 @@ reposdir=%s
devspec = method.biospart
else:
devspec = method.partition
-
- device = storage.devicetree.resolveDevice(devspec)
- self._setUpMedia(device)
- self.install_device = device
- url = "file://" + INSTALL_TREE
+ needmount = True
+ # See if we used this method for stage2, thus dracut left it
+ if isodev and method.partition and method.partition in isodev \
+ and DRACUT_ISODIR in device:
+ # Everything should be setup
+ url = "file://" + DRACUT_REPODIR
+ needmount = False
+ # We don't setup an install_device here
+ # because we can't tear it down
+ isodevice = storage.devicetree.resolveDevice(devspec)
+ if needmount:
+ self._setUpMedia(isodevice)
+ url = "file://" + INSTALL_TREE
+ self.install_device = isodevice
elif method.method == "nfs":
- # See if we already have stuff mounted due to dracut
- isodev = get_mount_device(DRACUT_ISODIR)
- device = get_mount_device(DRACUT_REPODIR)
# See if dracut dealt with nfsiso
if isodev:
options, host, path = iutil.parseNfsUrl('nfs:%s' % isodev)
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index f5707001e..74c40b01a 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -41,12 +41,11 @@ from pyanaconda.ui.gui.utils import enlightbox, gtk_thread_wait
from pyanaconda.iutil import ProxyString, ProxyStringError
from pyanaconda.ui.gui.utils import gtk_call_once
from pyanaconda.threads import threadMgr, AnacondaThread
-from pyanaconda.packaging import PayloadError
+from pyanaconda.packaging import PayloadError, get_mount_paths
+from pyanaconda.constants import DRACUT_ISODIR, ISO_DIR
__all__ = ["SourceSpoke"]
-MOUNTPOINT = "/mnt/install/isodir"
-
BASEREPO_SETUP_MESSAGE = N_("Setting up installation source...")
METADATA_DOWNLOAD_MESSAGE = N_("Downloading package metadata...")
METADATA_ERROR_MESSAGE = N_("Error downloading package metadata...")
@@ -208,20 +207,26 @@ class IsoChooser(GUIObject):
GUIObject.refresh(self)
self._chooser = self.builder.get_object("isoChooser")
self._chooser.connect("current-folder-changed", self.on_folder_changed)
- self._chooser.set_filename(MOUNTPOINT + "/" + currentFile)
+ self._chooser.set_filename(ISO_DIR + "/" + currentFile)
def run(self, dev):
retval = None
unmount = not dev.format.status
- dev.format.mount(mountpoint=MOUNTPOINT)
+ mounts = get_mount_paths(dev.path)
+ # We have to check both ISO_DIR and the DRACUT_ISODIR because we
+ # still reference both, even though /mnt/install is a symlink to
+ # /run/install. Finding mount points doesn't handle the symlink
+ if ISO_DIR not in mounts and DRACUT_ISODIR not in mounts:
+ # We're not mounted to either location, so do the mount
+ dev.format.mount(mountpoint=ISO_DIR)
# If any directory was chosen, return that. Otherwise, return None.
rc = self.window.run()
if rc:
f = self._chooser.get_filename()
if f:
- retval = f.replace(MOUNTPOINT, "")
+ retval = f.replace(ISO_DIR, "")
if unmount:
dev.format.unmount()
@@ -238,8 +243,8 @@ class IsoChooser(GUIObject):
if not d:
return
- if not d.startswith(MOUNTPOINT):
- chooser.set_current_folder(MOUNTPOINT)
+ if not d.startswith(ISO_DIR):
+ chooser.set_current_folder(ISO_DIR)
class AdditionalReposDialog(GUIObject):
builderObjects = ["additionalReposDialog", "peopleRepositories", "peopleRepositoriesFilter"]
@@ -579,6 +584,8 @@ class SourceSpoke(NormalSpoke):
elif self.data.method.method == "cdrom":
return _("CD/DVD drive")
elif self.data.method.method == "harddrive":
+ if not self._currentIsoFile:
+ return _("Error setting up software source")
return os.path.basename(self._currentIsoFile)
elif self.payload.baseRepo:
return _("Closest mirror")
@@ -646,7 +653,7 @@ class SourceSpoke(NormalSpoke):
cdrom = self.payload.install_device
chosen = True
else:
- cdrom = opticalInstallMedia(self.storage.devicetree, mountpoint=MOUNTPOINT)
+ cdrom = opticalInstallMedia(self.storage.devicetree)
if cdrom:
@gtk_thread_wait
@@ -737,8 +744,13 @@ class SourceSpoke(NormalSpoke):
self.builder.get_object("nfsOptsEntry").set_text(self.data.method.opts or "")
elif self.data.method.method == "harddrive":
self._isoButton.set_active(True)
+ self._isoBox.set_sensitive(True)
+ self._verifyIsoButton.set_sensitive(True)
- self._isoChooserButton.set_label(os.path.basename(self._currentIsoFile))
+ if self._currentIsoFile:
+ self._isoChooserButton.set_label(os.path.basename(self._currentIsoFile))
+ else:
+ self._isoChooserButton.set_label("")
self._isoChooserButton.set_use_underline(False)
else:
# No method was given in advance, so now we need to make a sensible
@@ -837,8 +849,14 @@ class SourceSpoke(NormalSpoke):
dialog = MediaCheckDialog(self.data)
with enlightbox(self.window, dialog.window):
unmount = not p.format.status
- p.format.mount(mountpoint=MOUNTPOINT)
- dialog.run(MOUNTPOINT + "/" + f)
+ mounts = get_mount_paths(p.path)
+ # We have to check both ISO_DIR and the DRACUT_ISODIR because we
+ # still reference both, even though /mnt/install is a symlink to
+ # /run/install. Finding mount points doesn't handle the symlink
+ if ISO_DIR not in mounts and DRACUT_ISODIR not in mounts:
+ # We're not mounted to either location, so do the mount
+ p.format.mount(mountpoint=ISO_DIR)
+ dialog.run(ISO_DIR + "/" + f)
if unmount:
p.format.unmount()