From owner-freebsd-questions@freebsd.org Sat Jul 25 22:12:21 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 0AD6B371867 for ; Sat, 25 Jul 2020 22:12:21 +0000 (UTC) (envelope-from lonnie@outstep.com) Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BDgKb5sjpz3TRq for ; Sat, 25 Jul 2020 22:12:19 +0000 (UTC) (envelope-from lonnie@outstep.com) Received: by mail-il1-x12f.google.com with SMTP id t4so10097051iln.1 for ; Sat, 25 Jul 2020 15:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outstep-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Mj9rnnJyFqjlvF1cVOy7BExTGjE5eOGhEjTVv3iZAcM=; b=kpCK3I0Q/o0FBEMnCtmRIZPI2El0ZL/uQKsXUPgp4QRPpYwPwybOyk2WIGnpxLsW9Z /6GIPs2b72dvnW0KIgT/duldjiRdSXM/xkpuiGNl3dgfzAT2qNvS/i4dnqbosEAjFmiQ Kq/Jp0kOUeF/DIwgbM56MLOY/U0sR8CN7MO5SUDgo2vLJLwLJFCu7FCJyduqjA8zmafv TNBtr+AHre6rCfGKw/OAOJ55/9vJ1jXp3B3EXrcsQ1Pxu4iyWpw2w15ivYHXWzf8pIRh poZRy/w7A3HGr+6GyuibgkQAdsy41PNQJexYf6+l0QH0ZF/JSszjNlvflQV+VsiGxZfu YWDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Mj9rnnJyFqjlvF1cVOy7BExTGjE5eOGhEjTVv3iZAcM=; b=N6kzcDOVhBYNhjUtzIVveIlFxPmcozeSVSnW1MJLzQ2Qp7TAwDSfXirhfjlMG55b17 0Ucu9IjoINjWmCe/RM6AYzrQBIlRM91Lvf421/4T1pfXdG4BrIa3hDq6EpQ2LFNE50Tc nQqyIBrh4kx3VcLSfxUlE/UTiSjk/gVa9c1/0WghQ/Btq/Ppaa/19rh+lBDhzEBW/0Yw 8blrTD8MVmI7prPzMtyWzP1ygqJ8ggxzUeGxoC05tb/u+9pn5j1ojCwW2iG/KXjBIQ9D q09HqKSXfkfpjXe0phnO7QqDSClLrM1XWSQfqowxPQiybcmTahQ8tdk2xz4vGiOJexX3 uA8w== X-Gm-Message-State: AOAM5334kd5XSn3JA1v07eneuywV+kg5OfRXnOWCUBy/dbhpbLOtA9rr Fvv6Gu3qESy54XdzezNdhQ1xA3l4SDIxm7AGON8mgA== X-Google-Smtp-Source: ABdhPJwmQe0Z3AHMPLXHtNx/KjR8tC12/x9/CyDlK1cVzBzzJfsapekF5aUS//RV0it6ZiqgZj2xYIroUm7OGGmauVY= X-Received: by 2002:a05:6e02:545:: with SMTP id i5mr12497623ils.59.1595715138693; Sat, 25 Jul 2020 15:12:18 -0700 (PDT) MIME-Version: 1.0 References: <20200725203801.9a4965b8.freebsd@edvax.de> <20200725232921.be0dd463.freebsd@edvax.de> In-Reply-To: <20200725232921.be0dd463.freebsd@edvax.de> From: Lonnie Cumberland Date: Sat, 25 Jul 2020 18:12:07 -0400 Message-ID: Subject: Re: tbz file from pkg To: Polytropon Cc: freebsd-questions@freebsd.org X-Rspamd-Queue-Id: 4BDgKb5sjpz3TRq X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=outstep-com.20150623.gappssmtp.com header.s=20150623 header.b=kpCK3I0Q; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=outstep.com (policy=none); spf=softfail (mx1.freebsd.org: 2607:f8b0:4864:20::12f is neither permitted nor denied by domain of lonnie@outstep.com) smtp.mailfrom=lonnie@outstep.com X-Spamd-Result: default: False [-2.86 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.991]; R_DKIM_ALLOW(-0.20)[outstep-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.02)[-1.020]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; R_SPF_SOFTFAIL(0.00)[~all]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[outstep-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::12f:from]; NEURAL_HAM_SHORT(-0.65)[-0.649]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[outstep.com : No valid SPF, DKIM not aligned (relaxed), none] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 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 22:12:21 -0000 Yea, those are great suggestions and I will test them out too. I thought about it but have not played with piping a lot so I did not want to spend a lot of time down that pathway for now, but it's definitely something that I need to get better at using. I'm not an expert by any means and just put that together to take a directory full of txz files and repackage them into tbz files so that I can possibly use them within the mfsBSD scripts. It can definitely be improved upon by better skill people. On Sat, Jul 25, 2020 at 5:29 PM Polytropon wrote: > 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, ... >