summaryrefslogtreecommitdiffstats
path: root/dracut/fetch-updates-disk
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2012-04-25 19:33:07 -0400
committerWill Woods <wwoods@redhat.com>2012-05-01 17:17:25 -0400
commite1b19050f22197fd394eb122a9caefe2d487fc4f (patch)
tree73df875274ac45bcd1fe780a122bf184b2a1d66c /dracut/fetch-updates-disk
parent5013f0dd67222e45ca4028c89f7dde6ff47cf2ec (diff)
downloadanaconda-e1b19050f22197fd394eb122a9caefe2d487fc4f.tar.gz
anaconda-e1b19050f22197fd394eb122a9caefe2d487fc4f.tar.xz
anaconda-e1b19050f22197fd394eb122a9caefe2d487fc4f.zip
dracut: support updates=hd:... (#807982)
Since we've removed all UI from initramfs, plain 'updates' no longer works if you want to load an updates image from disk. This adds support for fetching updates images, much the same way as we do with kickstarts. Note that I'd really like to merge all the *-genrules.sh / fetch-*-disk junk, but time is short..
Diffstat (limited to 'dracut/fetch-updates-disk')
-rwxr-xr-xdracut/fetch-updates-disk33
1 files changed, 33 insertions, 0 deletions
diff --git a/dracut/fetch-updates-disk b/dracut/fetch-updates-disk
new file mode 100755
index 000000000..168fe5d19
--- /dev/null
+++ b/dracut/fetch-updates-disk
@@ -0,0 +1,33 @@
+#!/bin/bash
+# fetch-updates-disk - fetch updates from a block device
+
+command -v getarg >/dev/null || . /lib/dracut-lib.sh
+command -v unpack_updates_img >/dev/null || . /lib/anaconda-lib.sh
+
+dev="$1"
+path="${2:-/updates.img}"
+
+[ -d "$path" ] && path=$path/updates.img
+[ -b "$dev" ] || exit 1
+
+info "anaconda: fetching updates from $dev:$path"
+
+mnt="$(find_mount $dev)"
+if [ -n "$mnt" ]; then
+ cp $mnt$path /tmp/updates.img
+else
+ tmpmnt="$(mkuniqdir /run/install tmpmnt)"
+ if mount -o ro $dev $tmpmnt; then
+ cp $tmpmnt$path /tmp/updates.img
+ umount $tmpmnt
+ fi
+ rmdir $tmpmnt
+fi
+
+if [ -f /tmp/updates.img ]; then
+ unpack_updates_img /tmp/updates.img /updates
+ rm /tmp/updates.img
+ echo "$dev:$path" >> /tmp/liveupdates.done
+else
+ warn "anaconda: failed to get updates from $dev:$path"
+fi