From owner-freebsd-questions@freebsd.org Sat Jul 25 21:29:26 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64F013711AC for ; Sat, 25 Jul 2020 21:29:26 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BDfN50Jjwz3RvP for ; Sat, 25 Jul 2020 21:29:24 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.23.103]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPA (Nemesis) id 1MkYkC-1keWq407R8-00lzOy; Sat, 25 Jul 2020 23:29:22 +0200 Date: Sat, 25 Jul 2020 23:29:21 +0200 From: Polytropon To: Lonnie Cumberland Cc: freebsd-questions@freebsd.org Subject: Re: tbz file from pkg Message-Id: <20200725232921.be0dd463.freebsd@edvax.de> In-Reply-To: References: <20200725203801.9a4965b8.freebsd@edvax.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:p2hOT0Oz7FbSIz4Rn3NO7OfV9j1FrYgoiWmF9ldZkZljIRBCSnQ 0rS/O2xJtlhWgYCiB4O1DU5G8uprBst1PDCQ29Y51LalNsiUAooUjtIlHsmFumrKC/+GdIr nEEAPDezV6mqAVdRKbvcjApATKoP/eUx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.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 217.72.192.75) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [2.19 / 15.00]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; NEURAL_HAM_SHORT(-0.11)[-0.107]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[94.222.23.103:received]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:217.72.192.0/20, country:DE]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.43)[-0.432]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.33)[0.326]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[217.72.192.75:from]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[217.72.192.75:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jul 2020 21:29:26 -0000 On Sat, 25 Jul 2020 17:15:53 -0400, Lonnie Cumberland wrote: > Hi All, > > I find that I do not need a fully blown shell script, so I cobbled together > a single set of shell commands that will convert "*.txz" file to "*.tbz" > files and it seems to work. > > # find *txz -iname '*txz' | while read txz; do echo "Found: $txz"; > name=$(echo "$txz" | sed -e 's/\.[^.]*$//'); mkdir -p tmp/$name; tar -xjf > $txz -C tmp/$name; cd tmp/$name; tar cvfj ../../$name.tbz .; cd ../..; rm > -Rf tmp/$name; rm -Rf tmp; done > > maybe it will be of help to others as well. Allow me a little addition: The first parameter to find should be a directory. If you are already in the directory where the files are stored, use ".". Note that using -iname will also process *.Txz or *.TXZ, if that is desired. If you want to remove the extension, you don't need to use sed for this: The shell - I assume it is sh - can do this for you: For example, if txz="foo-1.2.3_4,5.txz", then ${txz%.*} or ${txz%.txz} will be "foo-1.2.3_4,5". See section "Parameter Expansion" in "man 1 sh" for details. :-) Another suggestion would maybe be to omit the "store, repackage, delete" step and use a pipe. Maybe it would also be possible to omit the "extract" part altogether: Have xz only decompress (result is a regular tar file), then bzip2 recompress, that could also be possible without a temporary file if you can use |. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...