Results 1 to 10 of 10

Thread: tgz, gz & tar decompression 101

  1. #1
    Join Date
    Sep 2002
    Posts
    1,735

    tgz, gz & tar decompression 101

    what would be the equivalent of this command line:

    Code:
    cpio -idu -H tar < ../devbin-s2.tar
    if devbin-s2 is the .tgz file from http://tivoutils.sourceforge.net/
    Collecting 9/11, Afghan/Iraq, Mail Call, Trains, Cooking, Woodworking, Fighting Illini - Let's chat
    A/V links: neuron2 doom9 VideoHelp DigitalMediaNet CreativeCow DVDShrink PgcEdit Streambox WMRecorder
    other links: SnapFiles NoNags HackADay Engadget Fontleech OfflineExplorerPro TechBargains PriceWatch

  2. #2
    Join Date
    Mar 2002
    Posts
    1,335
    simplest way would be to install a tar binary & use

    tar -zxf devbin-s2.tgz


    if you don't have tivo-tar, gzip + cpio works

    mv devbin-s2.tgz devbin-s2.tar.gz
    gzip -d devbin-s2.tar.gz decompresses devbin-s2.tar.gz to devbin-s2.tar
    cpio -i -d -H tar -F devbin-s2.tar


    or you could open devbin-s2.tgz with winzip, winrar, stuffit or whatever, transfer the tar over & expand it with cpio

  3. #3
    Join Date
    Sep 2002
    Posts
    1,735
    That would work if the files were .tar.tgz but they're not. They're only .tgz and I'm a little concerned WinRAR might screw up decompressing them. Is it safe to decompress the .tgz on a Windoze box then move the files over or does that introduce error along the lines of endian problems? My hunch is the files would be ok as long as no attempt is made to alter them.

    I'm working through ][ronman's HDTiVO howto and re-writing it for my own use on the regular S2. There's quite a few mistakes in his instructions. This is just one example. tar is inside devbin-s2.tgz so even if the version on sourceforge was devbin-s2.tar.tgz it certainly couldn't be used to decompress the archive in which it is contained.

    His text layout for the howto is pretty nice but the links are to attachments, not threads, and a few other things could use some improvement like citations and more tivoapp patches.

    The Hinsdale Howto is also screwed up. The MFSTools ISO it points to doesn't match the instructions any more.
    Last edited by FredThompson; 10-18-2004 at 05:48 AM.
    Collecting 9/11, Afghan/Iraq, Mail Call, Trains, Cooking, Woodworking, Fighting Illini - Let's chat
    A/V links: neuron2 doom9 VideoHelp DigitalMediaNet CreativeCow DVDShrink PgcEdit Streambox WMRecorder
    other links: SnapFiles NoNags HackADay Engadget Fontleech OfflineExplorerPro TechBargains PriceWatch

  4. #4
    Join Date
    Aug 2004
    Posts
    4,075
    Quote Originally Posted by FredThompson
    That would work if the files were .tar.tgz but they're not.
    .tgz is just a suffix convention for a gzip compressed tarball. It's equivalent to .tar.gz
    Last edited by Jamie; 10-18-2004 at 06:14 AM.

  5. #5
    Join Date
    Sep 2002
    Posts
    1,735
    Oh, OK, but the tar inside the archive still can't decompress the archive
    Collecting 9/11, Afghan/Iraq, Mail Call, Trains, Cooking, Woodworking, Fighting Illini - Let's chat
    A/V links: neuron2 doom9 VideoHelp DigitalMediaNet CreativeCow DVDShrink PgcEdit Streambox WMRecorder
    other links: SnapFiles NoNags HackADay Engadget Fontleech OfflineExplorerPro TechBargains PriceWatch

  6. #6
    Join Date
    Mar 2002
    Posts
    1,335
    bare tar encoding doesn't compress data. tar wrappers - the 512 byte tarheaders - preserve permissions and absolute or relative path information. it's perfectly valid to tar an existing tarfile

    whatever.tar.tgz would be somewhat silly, but it's valid in describing a tarfile inside another tarfile that's been compressed. there are some situations like source code management where storing multiple levels of directory info is pretty handy


    cr / lf issues usually occur using xmodem / zmodem / ftp or decompression utils that assume some sort of conversion is needed

    .tar / .gz / .tgz / .bz / .tbz shouldn't be converted by default during transfer


    as long as you're using standard utils to move data files around endianess isn't a problem - a compressed version of a binary executable qualifies as a data file


    GNU tar 1.14

    the -z option tells tar to pass input/output through gzip during processing - equivilant to using tar & gzip in 2 manual steps



    -----



    Quote Originally Posted by FredThompson
    Oh, OK, but the tar inside the archive still can't decompress the archive
    gzip & cpio are part of any working tivo image
    Quote Originally Posted by rc3105
    mv devbin-s2.tgz devbin-s2.tar.gz
    renames devbin-s2.tgz to devbin-s2.tar.gz to keep things simple
    Quote Originally Posted by rc3105
    gzip -d devbin-s2.tar.gz
    decompresses devbin-s2.tar.gz to devbin-s2.tar
    Quote Originally Posted by rc3105
    cpio -i -d -H tar -F devbin-s2.tar
    actually extracts the files
    Last edited by rc3105; 10-18-2004 at 06:50 AM.

  7. #7
    Join Date
    May 2004
    Location
    Ohio
    Posts
    17
    Just as an FYI in case anyone runs into .tar.bz2 files, one can expand the archive as such:

    bunzip2 -c myarchive.tar.bz2 | tar -xvf -

  8. #8
    Join Date
    Jun 2001
    Posts
    3,108
    some of the files on that site are listed as .tgz or whatnot, but they are not. some are just .tar, some are just .gz, some are both tar and gz. its pretty easy to tell, because executables should have the elf header and scripts should be readable...both can be determined by using vi on the file after expansion. you may need to rename some stuff.
    Step one: search button!
    Silly Wabbit, guides are for kids

  9. #9
    Join Date
    Jun 2001
    Posts
    3,108
    Quote Originally Posted by FredThompson
    I'm a little concerned WinRAR might screw up decompressing them. Is it safe to decompress the .tgz on a Windoze box then move the files over or does that introduce error along the lines of endian problems? My hunch is the files would be ok as long as no attempt is made to alter them.
    WinRar doesnt have any problems with the files that we have seen. if you use winzip, you need to turn off the "smart cr/lf conversion" or whatnot. the only downside is that you will lose all the permissions by expanding it on a windows box, and any symlinks will result in a straight copy of the file instead.
    Step one: search button!
    Silly Wabbit, guides are for kids

  10. #10
    Join Date
    Aug 2004
    Posts
    4,075
    Quote Originally Posted by mrblack51
    some of the files on that site are listed as .tgz or whatnot, but they are not. some are just .tar, some are just .gz, some are both tar and gz. its pretty easy to tell, because executables should have the elf header and scripts should be readable...both can be determined by using vi on the file after expansion. you may need to rename some stuff.
    The original file in question here (devbin-s2.tgz) really does seem to be a compressed tar archive:

    Code:
    fedora[130] ~ % wget -q http://unc.dl.sourceforge.net/source.../devbin-s2.tgz
    fedora[131] ~ % file -z devbin-s2.tgz
    devbin-s2.tgz: POSIX tar archive (gzip compressed data, from Unix)
    fedora[132] ~ % tar tzf devbin-s2.tgz
    chgrp
    chown
    ...
    Quote Originally Posted by mrblack51
    WinRar doesnt have any problems with the files that we have seen. if you use winzip, you need to turn off the "smart cr/lf conversion" or whatnot. the only downside is that you will lose all the permissions by expanding it on a windows box, and any symlinks will result in a straight copy of the file instead.
    That would be bad for multicall binaries like busybox. Seems like it is safest to pull these posix archives apart on the linux side. On the TiVo itself, for example. Or on the PC side when linux is running for mfstools, etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •