Skip to content

Commit 1f6a656

Browse files
committed
bug-report: Choose better compression method
Signed-off-by: Alexey Gladkov <[email protected]>
1 parent 7b1f1a8 commit 1f6a656

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tools/bug-report

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,24 @@ copy \
109109
progress "done"
110110
echo
111111

112-
outfile="$PWD/make-initrd-bugreport-$(date +"%Y%m%d").tar.bz2"
112+
compress="cat"
113+
compargs=()
114+
suffix=
115+
116+
if compress="$(type -P xz)"; then
117+
compargs=("-9")
118+
suffix=".xz"
119+
elif compress="$(type -P bzip2)"; then
120+
compargs=("-9")
121+
suffix=".bz2"
122+
elif compress="$(type -P gzip)"; then
123+
compargs=("-9")
124+
suffix=".gz"
125+
fi
126+
127+
outfile="$PWD/make-initrd-bugreport-$(date +"%Y%m%d").tar$suffix"
113128

114129
cd "$workdir"
115-
tar -cjf "$outfile" report
130+
tar -cf - report | "$compress" "${compargs[@]}" >"$outfile"
116131

117132
printf '\nPlease submit %s to authors\n\n' "$outfile"

0 commit comments

Comments
 (0)