[PATCH 13/16] Trivial bashification and minor code rearrangement for initramfs compression.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 dracut |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dracut b/dracut
index fcd32c1..f70aa50 100755
--- a/dracut
+++ b/dracut
@@ -136,10 +136,13 @@ while (($# > 0)); do
 	--fstab)       use_fstab_l="yes" ;;
 	-h|--help)     usage; exit 1 ;;
 	-i|--include)  include_src="$2"; include_target="$3"; shift 2;;
-        --gzip)        [[ $compress != cat ]] && compress="gzip -9";;
         --bzip2)       [[ $compress != cat ]] && compress="bzip2 -9";;
         --xz)          [[ $compress != cat ]] && compress="xz -9";;
         --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_kmodules="yes"
             omit_dracutmodules_l+=\ kernel-modules
@@ -258,7 +261,7 @@ fi
 
 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)
 
 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
 }
 
-[[ $compress = gzip* ]] && type pigz > /dev/null 2>&1 && compress="pigz -9"
 if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
     $compress > "$outfile"; ); then 
     derror "dracut: creation of $outfile failed"
-- 
1.7.2.1

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux