144 lines
4.2 KiB
Diff
144 lines
4.2 KiB
Diff
|
From f24f363eb329f8ce4b2435fb5d14786c104dec99 Mon Sep 17 00:00:00 2001
|
||
|
From: Kairui Song <kasong@redhat.com>
|
||
|
Date: Mon, 2 Aug 2021 13:33:18 +0200
|
||
|
Subject: [PATCH] fix(squash): fixes related to squash module rebase
|
||
|
|
||
|
fix fro missing dracutsysrootdir
|
||
|
move the $compress args parsing to later part after mksquashfs, so mksquashfs can use $compress as the original parameter value
|
||
|
|
||
|
Related:#1959336
|
||
|
---
|
||
|
dracut.sh | 94 +++++++++++++++++++-------------------
|
||
|
modules.d/99squash/module-setup.sh | 3 +-
|
||
|
2 files changed, 49 insertions(+), 48 deletions(-)
|
||
|
|
||
|
diff --git a/dracut.sh b/dracut.sh
|
||
|
index fa14e3ce..e559bb96 100755
|
||
|
--- a/dracut.sh
|
||
|
+++ b/dracut.sh
|
||
|
@@ -825,53 +825,6 @@ if [[ $_no_compress_l = "cat" ]]; then
|
||
|
compress="cat"
|
||
|
fi
|
||
|
|
||
|
-if ! [[ $compress ]]; then
|
||
|
- # check all known compressors, if none specified
|
||
|
- for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
|
||
|
- command -v "$i" &>/dev/null || continue
|
||
|
- compress="$i"
|
||
|
- break
|
||
|
- done
|
||
|
- if [[ $compress = cat ]]; then
|
||
|
- printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
|
||
|
- fi
|
||
|
-fi
|
||
|
-
|
||
|
-# choose the right arguments for the compressor
|
||
|
-case $compress in
|
||
|
- bzip2|lbzip2)
|
||
|
- if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
|
||
|
- compress="lbzip2 -9"
|
||
|
- else
|
||
|
- compress="bzip2 -9"
|
||
|
- fi
|
||
|
- ;;
|
||
|
- lzma)
|
||
|
- compress="lzma -9 -T0"
|
||
|
- ;;
|
||
|
- xz)
|
||
|
- compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
|
||
|
- ;;
|
||
|
- gzip|pigz)
|
||
|
- if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
|
||
|
- compress="pigz -9 -n -T -R"
|
||
|
- elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
|
||
|
- compress="gzip -n -9 --rsyncable"
|
||
|
- else
|
||
|
- compress="gzip -n -9"
|
||
|
- fi
|
||
|
- ;;
|
||
|
- lzo|lzop)
|
||
|
- compress="lzop -9"
|
||
|
- ;;
|
||
|
- lz4)
|
||
|
- compress="lz4 -l -9"
|
||
|
- ;;
|
||
|
- zstd)
|
||
|
- compress="zstd -15 -q -T0"
|
||
|
- ;;
|
||
|
-esac
|
||
|
-
|
||
|
[[ $hostonly = yes ]] && hostonly="-h"
|
||
|
[[ $hostonly != "-h" ]] && unset hostonly
|
||
|
|
||
|
@@ -1848,6 +1801,53 @@ if [[ $create_early_cpio = yes ]]; then
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
+if ! [[ $compress ]]; then
|
||
|
+ # check all known compressors, if none specified
|
||
|
+ for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
|
||
|
+ command -v "$i" &>/dev/null || continue
|
||
|
+ compress="$i"
|
||
|
+ break
|
||
|
+ done
|
||
|
+ if [[ $compress = cat ]]; then
|
||
|
+ printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
|
||
|
+ fi
|
||
|
+fi
|
||
|
+
|
||
|
+# choose the right arguments for the compressor
|
||
|
+case $compress in
|
||
|
+ bzip2|lbzip2)
|
||
|
+ if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
|
||
|
+ compress="lbzip2 -9"
|
||
|
+ else
|
||
|
+ compress="bzip2 -9"
|
||
|
+ fi
|
||
|
+ ;;
|
||
|
+ lzma)
|
||
|
+ compress="lzma -9 -T0"
|
||
|
+ ;;
|
||
|
+ xz)
|
||
|
+ compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
|
||
|
+ ;;
|
||
|
+ gzip|pigz)
|
||
|
+ if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
|
||
|
+ compress="pigz -9 -n -T -R"
|
||
|
+ elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
|
||
|
+ compress="gzip -n -9 --rsyncable"
|
||
|
+ else
|
||
|
+ compress="gzip -n -9"
|
||
|
+ fi
|
||
|
+ ;;
|
||
|
+ lzo|lzop)
|
||
|
+ compress="lzop -9"
|
||
|
+ ;;
|
||
|
+ lz4)
|
||
|
+ compress="lz4 -l -9"
|
||
|
+ ;;
|
||
|
+ zstd)
|
||
|
+ compress="zstd -15 -q -T0"
|
||
|
+ ;;
|
||
|
+esac
|
||
|
+
|
||
|
if ! (
|
||
|
umask 077; cd "$initdir"
|
||
|
find . -print0 | sort -z \
|
||
|
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
||
|
index 14790ce8..11964b97 100644
|
||
|
--- a/modules.d/99squash/module-setup.sh
|
||
|
+++ b/modules.d/99squash/module-setup.sh
|
||
|
@@ -39,9 +39,10 @@ installpost() {
|
||
|
|
||
|
# Copy dracut spec files out side of the squash image
|
||
|
# so dracut rebuild and lsinitrd can work
|
||
|
+ mkdir -p "$initdir/usr/lib/dracut/"
|
||
|
for file in "$squash_dir"/usr/lib/dracut/*; do
|
||
|
[[ -f $file ]] || continue
|
||
|
- DRACUT_RESOLVE_DEPS=1 dracutsysrootdir="$squash_dir" inst "${file#$squash_dir}"
|
||
|
+ cp "$file" "$initdir/${file#$squash_dir}"
|
||
|
done
|
||
|
|
||
|
# Install required modules and binaries for the squash image init script.
|
||
|
|