Browse Source

Trivial bashification and minor code rearrangement for initramfs compression.

master
Victor Lowther 15 years ago committed by Harald Hoyer
parent
commit
b2ff4317f1
  1. 8
      dracut

8
dracut

@ -136,10 +136,13 @@ while (($# > 0)); do
--fstab) use_fstab_l="yes" ;; --fstab) use_fstab_l="yes" ;;
-h|--help) usage; exit 1 ;; -h|--help) usage; exit 1 ;;
-i|--include) include_src="$2"; include_target="$3"; shift 2;; -i|--include) include_src="$2"; include_target="$3"; shift 2;;
--gzip) [[ $compress != cat ]] && compress="gzip -9";;
--bzip2) [[ $compress != cat ]] && compress="bzip2 -9";; --bzip2) [[ $compress != cat ]] && compress="bzip2 -9";;
--xz) [[ $compress != cat ]] && compress="xz -9";; --xz) [[ $compress != cat ]] && compress="xz -9";;
--no-compress) compress="cat";; --no-compress) compress="cat";;
--gzip) if [[ $compress != cat ]]; then
type pigz > /dev/null 2>&1 && compress="pigz -9" || \
compress="gzip -9"
fi;;
--ignore-kernel-modules) kernel_only="no"; no_kernel="yes" --ignore-kernel-modules) kernel_only="no"; no_kernel="yes"
ignore_kmodules="yes" ignore_kmodules="yes"
omit_dracutmodules_l+=\ kernel-modules omit_dracutmodules_l+=\ kernel-modules
@ -258,7 +261,7 @@ fi


hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency" hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency"


[[ -n "$TMPDIR" ]] && ! [[ -w "$TMPDIR" ]] && unset TMPDIR [[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
readonly initdir=$(mktemp -d -t initramfs.XXXXXX) readonly initdir=$(mktemp -d -t initramfs.XXXXXX)


trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT # clean up after ourselves no matter how we die. trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT # clean up after ourselves no matter how we die.
@ -357,7 +360,6 @@ type hardlink &>/dev/null && {
hardlink "$initdir" 2>&1 hardlink "$initdir" 2>&1
} }


[[ $compress = gzip* ]] && type pigz > /dev/null 2>&1 && compress="pigz -9"
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \ if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
$compress > "$outfile"; ); then $compress > "$outfile"; ); then
derror "dracut: creation of $outfile failed" derror "dracut: creation of $outfile failed"

Loading…
Cancel
Save