[PATCH f17-branch 4/4] dracut: add anaconda_auto_updates() (product.img/updates.img) (#800107)

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

 



So, loader used to look for updates.img/product.img/RHUpdates under
whatever path it was given for the stage2 image. We need product.img for
variant installers (like the RHEL installer) so we need to look for
these things.

Add the anaconda_auto_updates() function to look for these things and
put them in the appropriate places. Also add unpack_updates_img() as a
helper for cleanly unpacking updates images.
---
 dracut/anaconda-lib.sh |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 49c4f9e..a045bab 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+command -v unpack_img >/dev/null || . /lib/img-lib.sh
+
 # config_get SECTION KEY < FILE
 # read an .ini-style config file, find the KEY in the given SECTION, and return
 # the value provided for that key.
@@ -48,14 +50,16 @@ 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="" mnt="$1" path="$2"; shift 2
+    local img="" iso="" srcdir="" mnt="$1" path="$2"; shift 2
     img=$(find_runtime $mnt/$path)
     if [ -n "$img" ]; then
         info "anaconda: found $img"
         [ "$mnt" = "$repodir" ] || mount --move $mnt $repodir
+        anaconda_auto_updates $repodir/$path/images
     else
         if [ "${path%.iso}" != "$path" ]; then
             iso=$path
+            path=${path%/*.iso}
         else
             iso=$(find_iso $mnt/$path)
         fi
@@ -65,6 +69,7 @@ anaconda_live_root_dir() {
         iso=${isodir}/${iso#$mnt}
         mount -o loop,ro $iso $repodir
         img=$(find_runtime $repodir) || { warn "$iso has no suitable runtime"; }
+        anaconda_auto_updates $isodir/$path/images
     fi
     # FIXME: make rd.live.ram clever enough to do this for us
     if [ "$1" = "--copy-to-ram" ]; then
@@ -78,6 +83,31 @@ anaconda_live_root_dir() {
     [ -e "$img" ] && /sbin/dmsquash-live-root $img
 }
 
+# find updates.img/product.img/RHUpdates and unpack/copy them so they'll
+# end up in the location(s) that anaconda expects them
+anaconda_auto_updates() {
+    local dir="$1"
+    if [ -d $dir/RHupdates ]; then
+        copytree $dir/RHupdates /updates
+    fi
+    if [ -e $dir/updates.img ]; then
+        unpack_updates_img $dir/updates.img /updates
+    fi
+    if [ -e $dir/product.img ]; then
+        unpack_updates_img $dir/product.img /updates/tmp/product
+    fi
+}
+
+# Unpack an image into the given dir.
+unpack_updates_img() {
+    local img="$1" tmpdir="/tmp/${1##*/}.$$" outdir="${2:+/updates}"
+    # NOTE: unpack_img $img $outdir can clobber existing subdirs in $outdir,
+    # which is why we use a tmpdir and copytree (which doesn't clobber)
+    unpack_img $img $tmpdir
+    copytree $tmpdir $outdir
+    rm -rf $tmpdir
+}
+
 # These could probably be in dracut-lib or similar
 
 copytree() {
-- 
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