tbz file from pkg

@lbutlr kremels at kreme.com
Sun Jul 26 12:28:28 UTC 2020

> On 25 Jul 2020, at 15:15, Lonnie Cumberland <lonnie at outstep.com> 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

Hmm. I would not fully extract the tar file, but uncompress it and recompress it. There is no need to explode the tar archive into individual files.

unxr file.txz
bzip2 < file.tar > my_files.tbz

Should manage the basic functionality. 

for file in **/.txz; do unxr $file; bzip2< $(name%.tar}.tbz; done

Or something like that (assuming your shell is bash, or I think this is also valid in zsh). Not tested, but that's going to get you 95% of the way there if it's not quite right.

You can leave off the name substitution if you're ok with the result being named file.tar.bz2 instead of file.tbz.

Grow a pair of tits, Coldwater.

More information about the freebsd-questions mailing list