From adf00e139fa4d487d89b700c4403439313b7900f Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 18 Apr 2013 13:03:46 +0200 Subject: dracut-027-36.git20130418 - fix initramfs creation on noexec tmpdir Resolves: rhbz#953426 - more options for lsinitrd - bash completion for lsinitrd - do not output debug information on initramfs creation, if rd.debug is on the kernel command line - drop requirement on 'file', lsinitrd can find the magic on its own --- 0030-lsinitrd-drop-use-of-file.patch | 89 ++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 0030-lsinitrd-drop-use-of-file.patch (limited to '0030-lsinitrd-drop-use-of-file.patch') diff --git a/0030-lsinitrd-drop-use-of-file.patch b/0030-lsinitrd-drop-use-of-file.patch new file mode 100644 index 0000000..1deae35 --- /dev/null +++ b/0030-lsinitrd-drop-use-of-file.patch @@ -0,0 +1,89 @@ +From 884e1cda7cf999ef15dd78a54a9ce0bf99afd8de Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 16 Apr 2013 12:44:25 +0200 +Subject: [PATCH] lsinitrd: drop use of "file" + +--- + dracut.spec | 4 +--- + lsinitrd.sh | 38 ++++++++++++++++++++------------------ + 2 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/dracut.spec b/dracut.spec +index 197e9a0..3d42af2 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -84,11 +84,9 @@ Requires: findutils + Requires: grep + Requires: hardlink + Requires: gzip xz +-Requires: module-init-tools >= 3.7-9 ++Requires: kmod + Requires: sed +-Requires: file + Requires: kpartx +-Requires: kbd kbd-misc + + %if 0%{?fedora} || 0%{?rhel} > 6 + Requires: util-linux >= 2.21 +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 42e30d9..0481975 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -103,37 +103,39 @@ if ! [[ -f "$image" ]]; then + exit 1 + fi + +-CAT=zcat +-FILE_T=$(file --dereference "$image") +- +-if echo "test"|xz|xz -dc --single-stream >/dev/null 2>&1; then +- XZ_SINGLE_STREAM="--single-stream" +-fi +- +-if [[ "$FILE_T" =~ :\ gzip\ compressed\ data ]]; then +- CAT=zcat +-elif [[ "$FILE_T" =~ :\ xz\ compressed\ data ]]; then +- CAT="xzcat $XZ_SINGLE_STREAM" +-elif [[ "$FILE_T" =~ :\ XZ\ compressed\ data ]]; then +- CAT="xzcat $XZ_SINGLE_STREAM" +-elif [[ "$FILE_T" =~ :\ LZMA ]]; then +- CAT="xzcat $XZ_SINGLE_STREAM" +-elif [[ "$FILE_T" =~ :\ data ]]; then +- CAT="xzcat $XZ_SINGLE_STREAM" +-fi ++read -N 6 bin < "$image" ++case $bin in ++ $'\x1f\x8b'*) ++ CAT="zcat";; ++ BZh*) ++ CAT="bzcat";; ++ 070701) ++ CAT="cat";; ++ *) ++ CAT="xzcat"; ++ if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then ++ CAT="xzcat --single-stream" ++ fi ++ ;; ++esac + + if (( ${#filenames[@]} > 0 )); then + $CAT $image | cpio --extract --verbose --quiet --to-stdout ${!filenames[@]} 2>/dev/null + exit $? + fi + ++ret=0 ++ + echo "$image: $(du -h $image | while read a b; do echo $a;done)" + echo "========================================================================" + $CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null ++((ret+=$?)) + echo "========================================================================" + if [ "$sorted" -eq 1 ]; then + $CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5 + else + $CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9 + fi ++((ret+=$?)) + echo "========================================================================" ++exit $ret -- cgit