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