tbz file from pkg

Lonnie Cumberland lonnie at outstep.com
Sat Jul 25 22:12:21 UTC 2020

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 at 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, ...

More information about the freebsd-questions mailing list