[PATCH f17-branch 1/5] fix nfsiso:...:/path/to/filename.iso (#804515)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we're given the path to an iso, we need to split it up so we mount
the directory the iso is *in*, and then mount the iso.

Also, fix a harmless typo bug in find_runtime and clean up/clarify
anaconda_live_root_dir a bit.
---
 dracut/anaconda-lib.sh     |   22 +++++++++++++++-------
 dracut/anaconda-netroot.sh |   11 +++++++++--
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 171071e..7f1a264 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -32,8 +32,9 @@ find_iso() {
 }
 
 find_runtime() {
-    local ti_img="" dir="$1$2"
-    [ -e $dir/.treeinfo ] && img=$(config_get stage2 mainimage < $dir/.treeinfo)
+    local ti_img="" dir="$1"
+    [ -e $dir/.treeinfo ] && \
+        ti_img=$(config_get stage2 mainimage < $dir/.treeinfo)
     for f in $ti_img images/install.img LiveOS/squashfs.img; do
         [ -e "$dir/$f" ] && echo "$dir/$f" && return
     done
@@ -43,17 +44,24 @@ repodir="/run/install/source"
 isodir="/run/install/isodir"
 rulesfile="/etc/udev/rules.d/90-anaconda.rules"
 
+# try to find a usable runtime image from the repo mounted at $mnt.
+# if successful, move the mount(s) to $repodir/$isodir.
 anaconda_live_root_dir() {
-    local img="" iso="" dir="$1" path="$2"; shift 2
-    img=$(find_runtime $repodir$path)
+    local img="" iso="" mnt="$1" path="$2"; shift 2
+    img=$(find_runtime $mnt/$path)
     if [ -n "$img" ]; then
         info "anaconda: found $img"
+        [ "$dir" = "$repodir" ] || mount --move $mnt $repodir
     else
-        iso=$(find_iso $repodir$path)
+        if [ "${path%.iso}" != "$path" ]; then
+            iso=$path
+        else
+            iso=$(find_iso $mnt/$path)
+        fi
         [ -n "$iso" ] || { warn "no suitable images"; return 1; }
         info "anaconda: found $iso"
-        mount --move $repodir $isodir
-        iso=${isodir}${iso#$repodir}
+        mount --move $mnt $isodir
+        iso=${isodir}/${iso#$mnt}
         mount -o loop,ro $iso $repodir
         img=$(find_runtime $repodir) || { warn "$iso has no suitable runtime"; }
     fi
diff --git a/dracut/anaconda-netroot.sh b/dracut/anaconda-netroot.sh
index 7c474dd..6be34a7 100755
--- a/dracut/anaconda-netroot.sh
+++ b/dracut/anaconda-netroot.sh
@@ -25,8 +25,15 @@ case $repo in
         . /lib/nfs-lib.sh
         info "anaconda mounting NFS repo at $repo"
         str_starts "$repo" "nfsiso:" && repo=nfs:${repo#nfsiso:}
-        mount_nfs "$repo" "$repodir" "$netif" || warn "Couldn't mount $repo"
-        anaconda_live_root_dir $repodir
+        if [ "${repo%.iso}" == "$repo" ]; then
+            mount_nfs "$repo" "$repodir" "$netif" || warn "Couldn't mount $repo"
+            anaconda_live_root_dir $repodir
+        else
+            iso="${repo##*/}"
+            mount_nfs "${repo%$iso}" "$repodir" "$netif" || \
+                warn "Couldn't mount $repo"
+            anaconda_live_root_dir $repodir $iso
+        fi
     ;;
     http*|ftp*)
         . /lib/url-lib.sh
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux