]> git.ozlabs.org Git - petitboot/commitdiff
pb-sos: effectively compress the pb-sos file with gzip v1.5.0
authorGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Tue, 11 Jul 2017 18:04:05 +0000 (15:04 -0300)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Wed, 12 Jul 2017 04:47:06 +0000 (14:47 +1000)
Currently the pb-sos tool creates a TAR file with logs, but without
compressing it using gzip, for example. Even the output of command
says "Compressing...", but in fact no compression is done.

This patch uses gzip to effectively compress the logs. It achieves
83% of compression, observed after a simple experiment.
Also, makes use of $tarflags variable instead of pass the flags
directly in the command call.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
utils/pb-sos

index 3fa8e89bf9974bd24de0a6202ac7e4a64ff0950f..e3e8f6bb393bf9309b524790248f22581cb931d8 100755 (executable)
@@ -2,7 +2,7 @@
 
 diagdir="diag"
 tarfile="pb-sos.tar"
 
 diagdir="diag"
 tarfile="pb-sos.tar"
-tarflags=""
+tarflags="-cf"
 corefile="/core"
 verbose=0
 
 corefile="/core"
 verbose=0
 
@@ -28,7 +28,7 @@ fi
 while [ $# -gt 0 ]
 do
     case "$1" in
 while [ $# -gt 0 ]
 do
     case "$1" in
-       -v)     verbose=1; tarflags="$tarflags --verbose";;
+       -v)     verbose=1; tarflags="--verbose $tarflags";;
        -f)     tarfile="$2"; shift;;
        -d)     desthost="$2"; shift;;
        --)     shift; break;;
        -f)     tarfile="$2"; shift;;
        -d)     desthost="$2"; shift;;
        --)     shift; break;;
@@ -69,7 +69,11 @@ cat /sys/firmware/opal/msglog > /$diagdir/msglog
 
 log "Compressing..."
 cd /
 
 log "Compressing..."
 cd /
-tar $tarflags -cf $tarfile $diagdir
+
+tar $tarflags $tarfile $diagdir
+gzip < $tarfile > $tarfile.gz
+rm -f $tarfile
+tarfile="$tarfile.gz"
 
 echo "Complete, tarfile location $tarfile"
 
 
 echo "Complete, tarfile location $tarfile"