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