Skip to content

Commit

Permalink
feat: squash module follow --compress option
Browse files Browse the repository at this point in the history
Try to make mksquashfs follow --compress option if squash module is
included, if not specified or invalid, fall back to use mksquashfs's
default compressor.
  • Loading branch information
ryncsn authored and johannbg committed Mar 9, 2021
1 parent a9345f6 commit 5d05ffb
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2033,12 +2033,22 @@ fi
if dracut_module_included "squash"; then
dinfo "*** Squashing the files inside the initramfs ***"
declare squash_compress_arg
# shellcheck disable=SC2086
if [[ $compress ]]; then
if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $compress &>/dev/null; then
dwarn "mksquashfs doesn't support compressor '$compress', failing back to default compressor."
else
squash_compress_arg="$compress"
fi
fi
# shellcheck disable=SC2086
if ! mksquashfs "$squash_dir" "$squash_img" \
-no-xattrs -no-exports -noappend -always-use-fragments \
-comp xz -Xdict-size 100% -no-progress \
> /dev/null; then
dfatal "dracut: Failed making squash image"
exit 1
-no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
-no-progress ${squash_compress_arg:+-comp $squash_compress_arg} 1> /dev/null; then
dfatal "dracut: Failed making squash image"
exit 1
fi
rm -rf "$squash_dir"
Expand Down

0 comments on commit 5d05ffb

Please sign in to comment.