From patchwork Tue Jul 11 18:04:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 786792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x6VNM45VBz9ryk for ; Wed, 12 Jul 2017 04:04:51 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3x6VNM2v1FzDqb7 for ; Wed, 12 Jul 2017 04:04:51 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3x6VN25SJhzDqb4 for ; Wed, 12 Jul 2017 04:04:34 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6BI3cmE133268 for ; Tue, 11 Jul 2017 14:04:31 -0400 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bn0mx8swx-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 11 Jul 2017 14:04:30 -0400 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Jul 2017 15:04:27 -0300 Received: from d24relay03.br.ibm.com (9.13.39.225) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 11 Jul 2017 15:04:26 -0300 Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6BI02hm17825846 for ; Tue, 11 Jul 2017 15:00:02 -0300 Received: from d24av05.br.ibm.com (localhost [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v6BF4NcK003546 for ; Tue, 11 Jul 2017 12:04:23 -0300 Received: from localhost ([9.85.183.83]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v6BF4L6V003276; Tue, 11 Jul 2017 12:04:21 -0300 From: "Guilherme G. Piccoli" To: petitboot@lists.ozlabs.org Subject: [PATCH 2/2] pb-sos: effectively compress the pb-sos file with gzip Date: Tue, 11 Jul 2017 15:04:05 -0300 X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711180405.11868-1-gpiccoli@linux.vnet.ibm.com> References: <20170711180405.11868-1-gpiccoli@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17071118-0020-0000-0000-000002BF2D97 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071118-0021-0000-0000-000030DE5B98 Message-Id: <20170711180405.11868-2-gpiccoli@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-11_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707110290 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sam@mendozajonas.com, gpiccoli@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" 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 --- utils/pb-sos | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/pb-sos b/utils/pb-sos index c619d7e..e94a40a 100755 --- a/utils/pb-sos +++ b/utils/pb-sos @@ -2,7 +2,7 @@ diagdir="diag" tarfile="pb-sos.tar" -tarflags="" +tarflags="-cf" corefile="/core" verbose=0 @@ -28,7 +28,7 @@ fi 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;; @@ -68,7 +68,11 @@ cat /sys/firmware/opal/msglog > /$diagdir/msglog 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"