dracut-017-43.git20120312

- live image: fixed image uncompression
- live updates for livenet
This commit is contained in:
Harald Hoyer 2012-03-12 15:46:29 +01:00
parent 0e9e569b55
commit 9e9f8f2f11
34 changed files with 228 additions and 31 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 99fs-lib/module-setup.sh: removed "touch"
---
modules.d/99fs-lib/module-setup.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh
index 9c900cc..344dcdf 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 95nfs/module-setup.sh: removed "egrep" and "ls" calls
---
modules.d/95nfs/module-setup.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 7aedb4d..7853783 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 30convertfs/convertfs.sh: use hardlinks for inter-/usr cp
---
modules.d/30convertfs/convertfs.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/30convertfs/convertfs.sh b/modules.d/30convertfs/convertfs.sh
index 69c3b3e..036ec51 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] dracut-functions.sh: get_fs_env() replaced egrep with shell
---
dracut-functions.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index bb0c96f..9e9ee4e 100755

View File

@ -6,7 +6,7 @@ Subject: [PATCH] dracut-functions.sh: instmods(): replace egrep with shell
---
dracut-functions.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 9e9ee4e..81801e1 100755

View File

@ -6,7 +6,7 @@ Subject: [PATCH] dracut-functions.sh: instmods() removed special case for
---
dracut-functions.sh | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 81801e1..bd3203d 100755

View File

@ -8,7 +8,7 @@ do not print the full path, when we use "find" for kernel modules, but
rather only the filename.
---
dracut-functions.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index bd3203d..80714aa 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] dracut.spec: require "hardlink"
---
dracut.spec | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
1 file changed, 1 insertion(+)
diff --git a/dracut.spec b/dracut.spec
index 1ec8b68..4102bb0 100644

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 95terminfo/module-setup.sh: no need to call "find"
---
modules.d/95terminfo/module-setup.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/95terminfo/module-setup.sh b/modules.d/95terminfo/module-setup.sh
index aec3582..32a3fe9 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 10i18n/module-setup.sh: optimize install of all kbd files
---
modules.d/10i18n/module-setup.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
index a5a3388..b4c19e1 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] TODO: update
---
TODO | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/TODO b/TODO
index e5abef0..6c27268 100644

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 98usrmount/mount-usr.sh: ignore comments in fstab
---
modules.d/98usrmount/mount-usr.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
1 file changed, 1 insertion(+)
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
index 3e23b15..f9d049e 100755

View File

@ -6,7 +6,7 @@ Subject: [PATCH] 98usrmount/mount-usr.sh: check, if we have
---
modules.d/98usrmount/mount-usr.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
index f9d049e..39f75b9 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 30convertfs/convertfs.sh: correct check for /usr/bin
---
modules.d/30convertfs/convertfs.sh | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/modules.d/30convertfs/convertfs.sh b/modules.d/30convertfs/convertfs.sh
index 036ec51..d1d25aa 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 90crypt/parse-crypt.sh: simplify rd.luks.uuid testing
---
modules.d/90crypt/parse-crypt.sh | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index 2ab3a9f..f96b59a 100755

View File

@ -12,7 +12,7 @@ example: nfs.ko module in kernel-modules, but the nfs module
should be able to load it later on.
---
dracut-functions.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index c7337e9..20fc6e1 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix correct nfs path
---
modules.d/45url-lib/url-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh
index 383e7ac..1fc80a1 100755

View File

@ -7,7 +7,7 @@ Only include /lib/nfs-lib.sh if it exists, and then only run
add_url_handler if nfs-lib was imported.
---
modules.d/45url-lib/url-lib.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh
index 1fc80a1..043a700 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 40network/kill-dhclient.sh: kill dhclient silently
---
modules.d/40network/kill-dhclient.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/40network/kill-dhclient.sh b/modules.d/40network/kill-dhclient.sh
index 2f834c1..78060f5 100755

View File

@ -7,7 +7,7 @@ mkdir -p creates intermediate directories and never returns an error, so
we don't need to create the intermediate directories ourself.
---
modules.d/45ifcfg/write-ifcfg.sh | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index d633a96..0f431e3 100755

View File

@ -14,7 +14,7 @@ b) save the lease file as /var/lib/dhclient-<uuid>-<iface>.lease
This patch should make write-ifcfg handle both these things.
---
modules.d/45ifcfg/write-ifcfg.sh | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
1 file changed, 7 insertions(+)
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 0f431e3..fe986df 100755

View File

@ -8,7 +8,7 @@ supposed to go into e.g. /lib would get dropped if you had /updates/lib
as an actual directory, but the target system had /lib->/usr/lib.
---
modules.d/90dmsquash-live/apply-live-updates.sh | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/modules.d/90dmsquash-live/apply-live-updates.sh b/modules.d/90dmsquash-live/apply-live-updates.sh
index f840d1a..144e8b9 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 40network/net-genrules.sh: move ifup in the initqueue
---
modules.d/40network/net-genrules.sh | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
index 323d185..6c46d9a 100755

View File

@ -6,7 +6,7 @@ Subject: [PATCH] dracut-functions.sh: check for .kernelmodseen dir, before
---
dracut-functions.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 20fc6e1..5cf24a7 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] ifup.sh: check for "-m" to set manualup
---
modules.d/40network/ifup.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index b138e8e..b55362c 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] TEST-20-NFS: use ext3 on server and fsck after kill
---
test/TEST-20-NFS/test.sh | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index c6a9670..fcd424f 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] TEST-20-NFS/test.sh: fsck with "-a"
---
test/TEST-20-NFS/test.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index fcd424f..a6bde0e 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] 95iscsi/iscsiroot.sh: fix for empty $root
---
modules.d/95iscsi/iscsiroot.sh | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 1bd6dd3..7fa2715 100755

View File

@ -5,7 +5,7 @@ Subject: [PATCH] dracut.spec: add 98pollcdrom
---
dracut.spec | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
1 file changed, 1 insertion(+)
diff --git a/dracut.spec b/dracut.spec
index 91b3451..0275af3 100644

View File

@ -7,7 +7,7 @@ The ctcm module is not loaded automagically because it doesn't pass the
"ether_type_trans" test in 40net/module-setup.sh, so load it explicitly.
---
modules.d/95znet/module-setup.sh | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
1 file changed, 4 insertions(+)
diff --git a/modules.d/95znet/module-setup.sh b/modules.d/95znet/module-setup.sh
index fbb79aa..b354947 100755

View File

@ -0,0 +1,48 @@
From 04febed7822979d38cecb47b8675d021bbd7bd72 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 8 Mar 2012 18:02:29 -0500
Subject: [PATCH] img-lib: fix unpack_img()
- det_img should have been det_archive
- for ft=xz|gzip|bzip2, decompr should be "$ft -dc"
---
modules.d/99img-lib/img-lib.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules.d/99img-lib/img-lib.sh b/modules.d/99img-lib/img-lib.sh
index f6be26d..22507aa 100755
--- a/modules.d/99img-lib/img-lib.sh
+++ b/modules.d/99img-lib/img-lib.sh
@@ -1,12 +1,13 @@
#!/bin/sh
# img-lib.sh: utilities for dealing with archives and filesystem images.
#
-# TODO: identify/unpack rpm, deb?
+# TODO: identify/unpack rpm, deb, maybe others?
# super-simple "file" that only identifies archives.
# works with stdin if $1 is not set.
det_archive() {
+ # NOTE: echo -e works in ash and bash, but not dash
local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')"
local headerblock="$(dd ${1:+if=$1} bs=262 count=1 2>/dev/null)"
case "$headerblock" in
@@ -32,7 +33,7 @@ unpack_archive() {
local img="$1" outdir="$2" archiver="" decompr=""
local ft="$(det_archive $img)"
case "$ft" in
- xz|gzip|bzip2) decompr="$decompr -dc" ;;
+ xz|gzip|bzip2) decompr="$ft -dc" ;;
cpio|tar) decompr="cat";;
*) return 1 ;;
esac
@@ -64,7 +65,7 @@ unpack_img() {
[ -r "$img" ] || { warn "can't read img!"; return 1; }
[ -n "$outdir" ] || { warn "unpack_img: no output dir given"; return 1; }
- if [ "$(det_img $img)" ]; then
+ if [ "$(det_archive $img)" ]; then
unpack_archive "$@" || { warn "can't unpack archive file!"; return 1; }
else
unpack_fs "$@" || { warn "can't unpack filesystem image!"; return 1; }

View File

@ -0,0 +1,48 @@
From 7e60091c6b1aefb52581066d9dc04fa0ecc0e5fc Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 8 Mar 2012 18:03:39 -0500
Subject: [PATCH] url-lib: clean up output
For curl_fetch_url (http/https/ftp):
- use --progress-bar (the output is less messy)
- print the URL we're fetching so the user know's what's happening
For curl and nfs:
- don't echo the filename if it was provided by the user
---
modules.d/45url-lib/url-lib.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh
index 043a700..e305a68 100755
--- a/modules.d/45url-lib/url-lib.sh
+++ b/modules.d/45url-lib/url-lib.sh
@@ -53,9 +53,10 @@ add_url_handler() {
export CURL_HOME="/run/initramfs/url-lib"
mkdir -p $CURL_HOME
-curl_args="--location --retry 3 --fail --show-error"
+curl_args="--location --retry 3 --fail --show-error --progress-bar"
curl_fetch_url() {
local url="$1" outloc="$2"
+ echo "$url" > /proc/self/fd/0
if [ -n "$outloc" ]; then
curl $curl_args --output "$outloc" "$url" || return $?
else
@@ -64,7 +65,7 @@ curl_fetch_url() {
outloc="$outdir/$(ls -A $outdir)"
fi
[ -f "$outloc" ] || return 253
- echo "$outloc"
+ if [ -z "$2" ]; then echo "$outloc" ; fi
}
add_url_handler curl_fetch_url http https ftp
@@ -110,6 +111,6 @@ nfs_fetch_url() {
cp -f "$mntdir/$filename" "$outloc" || return $?
fi
[ -f "$outloc" ] || return 253
- echo "$outloc"
+ if [ -z "$2" ]; then echo "$outloc" ; fi
}
command -v nfs_to_var >/dev/null && add_url_handler nfs_fetch_url nfs nfs4

View File

@ -0,0 +1,94 @@
From 52c4c9484d0cdccad7d9a3cc684677e784edab53 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 8 Mar 2012 18:03:48 -0500
Subject: [PATCH] Add 'live.updates' to livenet module
live.updates allows you to specify the URL for an "updates image" that
should be applied to the live runtime before switch_root.
The URL can be anything supported by url-lib (http, https, ftp, possibly
nfs) and the image can be anything supported by img-lib (xz/gzip
compressed cpio/tar, uncompressed cpio/tar, filesystem image, etc.)
---
modules.d/90livenet/fetch-liveupdate.sh | 32 +++++++++++++++++++++++++++++++
modules.d/90livenet/module-setup.sh | 1 +
modules.d/90livenet/parse-livenet.sh | 12 +++++++++++-
3 files changed, 44 insertions(+), 1 deletion(-)
create mode 100755 modules.d/90livenet/fetch-liveupdate.sh
diff --git a/modules.d/90livenet/fetch-liveupdate.sh b/modules.d/90livenet/fetch-liveupdate.sh
new file mode 100755
index 0000000..8a5fdec
--- /dev/null
+++ b/modules.d/90livenet/fetch-liveupdate.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# fetch-liveupdate - fetch an update image for dmsquash-live media.
+# this gets called by the "initqueue/online" hook for each network interface
+# that comes online.
+
+# no updates requested? we're not needed.
+[ -e /tmp/liveupdates.info ] || return 0
+
+command -v getarg >/dev/null || . /lib/dracut-lib.sh
+command -v fetch_url >/dev/null || . /lib/url-lib.sh
+command -v unpack_img >/dev/null || . /lib/img-lib.sh
+
+read url < /tmp/liveupdates.info
+
+info "fetching live updates from $url"
+
+fetch_url "$url" /tmp/updates.img
+if [ $? != 0 ]; then
+ warn "failed to fetch update image!"
+ warn "url: $url"
+ return 1
+fi
+
+unpack_img /tmp/updates.img /updates.tmp.$$
+if [ $? != 0 ]; then
+ warn "failed to unpack update image!"
+ warn "url: $url"
+ return 1
+fi
+rm -rf /updates
+mv -f /updates.tmp.$$ /updates
+mv /tmp/liveupdates.info /tmp/liveupdates.done
diff --git a/modules.d/90livenet/module-setup.sh b/modules.d/90livenet/module-setup.sh
index c650ef3..2071553 100755
--- a/modules.d/90livenet/module-setup.sh
+++ b/modules.d/90livenet/module-setup.sh
@@ -12,6 +12,7 @@ depends() {
install() {
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
+ inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh"
inst "$moddir/livenetroot.sh" "/sbin/livenetroot"
}
diff --git a/modules.d/90livenet/parse-livenet.sh b/modules.d/90livenet/parse-livenet.sh
index 926dba2..3553cef 100755
--- a/modules.d/90livenet/parse-livenet.sh
+++ b/modules.d/90livenet/parse-livenet.sh
@@ -1,10 +1,20 @@
-#!/bin/bash
+#!/bin/sh
# live net images - just like live images, but specified like:
# root=live:[url-to-backing-file]
[ -z "$root" ] && root=$(getarg root=)
. /lib/url-lib.sh
+# live updates
+updates=$(getarg live.updates=)
+if [ -n "$updates" ]; then
+ # make sure network comes up even if we're doing a local live device
+ [ -z "$netroot" ] && echo "rd.neednet=1" > /etc/cmdline.d/90livenet.conf
+ echo "$updates" > /tmp/liveupdates.info
+ echo '[ -e /tmp/liveupdates.done ]' > \
+ $hookdir/initqueue/finished/liveupdates.sh
+fi
+
str_starts "$root" "live:" && liveurl="$root"
str_starts "$liveurl" "live:" || return
liveurl="${liveurl#live:}"

View File

@ -10,7 +10,7 @@
Name: dracut
Version: 017
Release: 40.git20120308%{?dist}
Release: 43.git20120312%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -63,6 +63,9 @@ Patch36: 0036-TEST-20-NFS-test.sh-fsck-with-a.patch
Patch37: 0037-95iscsi-iscsiroot.sh-fix-for-empty-root.patch
Patch38: 0038-dracut.spec-add-98pollcdrom.patch
Patch39: 0039-install-ctcm-network-module-on-s390.patch
Patch40: 0040-img-lib-fix-unpack_img.patch
Patch41: 0041-url-lib-clean-up-output.patch
Patch42: 0042-Add-live.updates-to-livenet-module.patch
BuildArch: noarch
@ -367,6 +370,10 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Mon Mar 12 2012 Harald Hoyer <harald@redhat.com> 017-43.git20120312
- live image: fixed image uncompression
- live updates for livenet
* Thu Mar 08 2012 Harald Hoyer <harald@redhat.com> 017-40.git20120308
- add s390 ctcm network kernel module