Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jul 2020 06:28:25 -0600
From:      "@lbutlr" <kremels@kreme.com>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: tbz file from pkg
Message-ID:  <C738FB9C-EAD2-484A-9D72-2240EA487E4B@kreme.com>
In-Reply-To: <CAPmsJLAYACVmXF%2BpzeBosP8AT8n8ewY7%2BDGtHeSezB_8EP2zBg@mail.gmail.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C738FB9C-EAD2-484A-9D72-2240EA487E4B>