Skip to content

Commit

Permalink
Make compression do The Right Thing based on what is in the config fi…
Browse files Browse the repository at this point in the history
…les.
  • Loading branch information
VictorLowther authored and haraldh committed Mar 23, 2011
1 parent 5e6c3b0 commit 3a71443
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions dracut
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ while (($# > 0)); do
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
-I|--install) read_arg install_items "$@" || shift;;
--fwdir) read_arg fw_dir_l "$@" || shift;;
--compress) read_arg compress "$@" || shift;;
--compress) read_arg compress_l "$@" || shift;;
-f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
Expand All @@ -222,11 +222,11 @@ while (($# > 0)); do
--fstab) use_fstab_l="yes" ;;
-h|--help) usage; exit 1 ;;
-i|--include) push include_src "$2"; push include_target "$3"; shift 2;;
--bzip2) compress="bzip2";;
--lzma) compress="lzma";;
--xz) compress="xz";;
--no-compress) _no_compress="cat";;
--gzip) compress="gzip";;
--bzip2) compress_l="bzip2";;
--lzma) compress_l="lzma";;
--xz) compress_l="xz";;
--no-compress) _no_compress_l="cat";;
--gzip) compress_l="gzip";;
--list-modules)
do_list="yes";
;;
Expand All @@ -248,17 +248,6 @@ if ! [[ $kernel ]] || [[ $kernel = "unset" ]]; then
fi
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"

case $compress in
bzip2) compress="bzip -9";;
lzma) compress="lzma -9";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
gzip) type pigz > /dev/null 2>&1 && compress="pigz -9" || \
compress="gzip -9";;
esac
if [[ $_no_compress = "cat" ]]; then
compress="cat"
fi

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

Expand Down Expand Up @@ -356,9 +345,22 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $fw_dir ]] || fw_dir=/lib/firmware
[[ $do_strip ]] || do_strip=no
[[ $compress_l ]] && compress=$compress_l
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }

# handle compression options.
case $compress in
bzip2) compress="bzip -9";;
lzma) compress="lzma -9";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
gzip) type pigz > /dev/null 2>&1 && compress="pigz -9" || \
compress="gzip -9";;
esac
if [[ $_no_compress_l = "cat" ]]; then
compress="cat"
fi

[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
[[ $compress ]] || compress="gzip -9"
Expand Down

0 comments on commit 3a71443

Please sign in to comment.