Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jul 2020 18:12:07 -0400
From:      Lonnie Cumberland <lonnie@outstep.com>
To:        Polytropon <freebsd@edvax.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: tbz file from pkg
Message-ID:  <CAPmsJLAv9ww-rz7qhM-qVAmF6e6AhY9jyDNd5rAZ0Wg89Woeyw@mail.gmail.com>
In-Reply-To: <20200725232921.be0dd463.freebsd@edvax.de>
References:  <CAPmsJLC0yTtek8AKo6r_XL8yt_9dCNvGs1jyVyOTu6g9N7YziA@mail.gmail.com> <20200725203801.9a4965b8.freebsd@edvax.de> <CAPmsJLAdK-1aS8r6=oB253ooZyaL2Q6GMNG-sAJBdR_KEXoGRg@mail.gmail.com> <CAPmsJLAYACVmXF%2BpzeBosP8AT8n8ewY7%2BDGtHeSezB_8EP2zBg@mail.gmail.com> <20200725232921.be0dd463.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <freebsd@edvax.de> 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, ...
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPmsJLAv9ww-rz7qhM-qVAmF6e6AhY9jyDNd5rAZ0Wg89Woeyw>