|
|
18971c |
From a0b85db18e163a14144230ae67c43ac23246b7ea Mon Sep 17 00:00:00 2001
|
|
|
18971c |
From: Koen Kooi <koen@dominion.thruhere.net>
|
|
|
18971c |
Date: Thu, 16 Jan 2014 11:00:54 +0100
|
|
|
18971c |
Subject: [PATCH] dracut-initramfs-restore,lsinitrd: add LZ4 support
|
|
|
18971c |
|
|
|
18971c |
Dracut claims to have LZ4 support, but trying to use it will result in an xzcat failure at the end due to missing CAT support.
|
|
|
18971c |
|
|
|
18971c |
The lz4 command chokes on '--', so abstract that out into the CAT select.
|
|
|
18971c |
|
|
|
18971c |
Something similar will need to be done for LZO.
|
|
|
18971c |
|
|
|
18971c |
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
|
|
|
18971c |
---
|
|
|
18971c |
dracut-initramfs-restore.sh | 2 ++
|
|
|
18971c |
lsinitrd.sh | 22 ++++++++++++----------
|
|
|
18971c |
2 files changed, 14 insertions(+), 10 deletions(-)
|
|
|
18971c |
|
|
|
18971c |
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
|
|
|
18971c |
index ec5fe180..f29c8146 100644
|
|
|
18971c |
--- a/dracut-initramfs-restore.sh
|
|
|
18971c |
+++ b/dracut-initramfs-restore.sh
|
|
|
18971c |
@@ -20,6 +20,8 @@ if zcat "$IMG" | cpio -id --quiet >/dev/null; then
|
|
|
18971c |
rm -f -- .need_shutdown
|
|
|
18971c |
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
|
|
|
18971c |
rm -f -- .need_shutdown
|
|
|
18971c |
+elif lz4 -d -c "$IMG" | cpio -id --quiet >/dev/null; then
|
|
|
18971c |
+ rm -f -- .need_shutdown
|
|
|
18971c |
else
|
|
|
18971c |
# something failed, so we clean up
|
|
|
18971c |
echo "Unpacking of $IMG to /run/initramfs failed" >&2
|
|
|
18971c |
diff --git a/lsinitrd.sh b/lsinitrd.sh
|
|
|
18971c |
index 584c29a9..f9f243bb 100755
|
|
|
18971c |
--- a/lsinitrd.sh
|
|
|
18971c |
+++ b/lsinitrd.sh
|
|
|
18971c |
@@ -106,15 +106,17 @@ fi
|
|
|
18971c |
read -N 6 bin < "$image"
|
|
|
18971c |
case $bin in
|
|
|
18971c |
$'\x1f\x8b'*)
|
|
|
18971c |
- CAT="zcat";;
|
|
|
18971c |
+ CAT="zcat --";;
|
|
|
18971c |
BZh*)
|
|
|
18971c |
- CAT="bzcat";;
|
|
|
18971c |
+ CAT="bzcat --";;
|
|
|
18971c |
$'\x71\xc7'*|070701)
|
|
|
18971c |
- CAT="cat";;
|
|
|
18971c |
+ CAT="cat --";;
|
|
|
18971c |
+ $'\x04\x22'*)
|
|
|
18971c |
+ CAT="lz4 -d -c";;
|
|
|
18971c |
*)
|
|
|
18971c |
- CAT="xzcat";
|
|
|
18971c |
+ CAT="xzcat --";
|
|
|
18971c |
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
|
|
18971c |
- CAT="xzcat --single-stream"
|
|
|
18971c |
+ CAT="xzcat --single-stream --"
|
|
|
18971c |
fi
|
|
|
18971c |
;;
|
|
|
18971c |
esac
|
|
|
18971c |
@@ -126,7 +128,7 @@ if (( ${#filenames[@]} > 0 )); then
|
|
|
18971c |
for f in ${!filenames[@]}; do
|
|
|
18971c |
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
|
|
18971c |
[[ $nofileinfo ]] || echo "========================================================================"
|
|
|
18971c |
- $CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
|
|
18971c |
+ $CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
|
|
18971c |
((ret+=$?))
|
|
|
18971c |
[[ $nofileinfo ]] || echo "========================================================================"
|
|
|
18971c |
[[ $nofileinfo ]] || echo
|
|
|
18971c |
@@ -134,16 +136,16 @@ if (( ${#filenames[@]} > 0 )); then
|
|
|
18971c |
else
|
|
|
18971c |
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
|
|
18971c |
echo "========================================================================"
|
|
|
18971c |
- version=$($CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/dracut-*' 2>/dev/null)
|
|
|
18971c |
+ version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/dracut-*' 2>/dev/null)
|
|
|
18971c |
((ret+=$?))
|
|
|
18971c |
echo "$version with dracut modules:"
|
|
|
18971c |
- $CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/modules.txt' 2>/dev/null
|
|
|
18971c |
+ $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/modules.txt' 2>/dev/null
|
|
|
18971c |
((ret+=$?))
|
|
|
18971c |
echo "========================================================================"
|
|
|
18971c |
if [ "$sorted" -eq 1 ]; then
|
|
|
18971c |
- $CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
|
|
18971c |
+ $CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
|
|
18971c |
else
|
|
|
18971c |
- $CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
|
|
18971c |
+ $CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
|
|
18971c |
fi
|
|
|
18971c |
((ret+=$?))
|
|
|
18971c |
echo "========================================================================"
|