UExtract-4.2

Miscellaneous tools
Message
Author
User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#31 Post by SFR »

For gzip'ed .deb, this works for me:

Code: Select all

# ar t ttyrec_1.0.8-5_i386.deb 
debian-binary
control.tar.gz
data.tar.gz
#
# ar p ttyrec_1.0.8-5_i386.deb data.tar.gz | tar xzvf -
./
./usr/
./usr/bin/
./usr/bin/ttyrec
./usr/bin/ttyplay
./usr/bin/ttytime
./usr/share/
./usr/share/doc/
./usr/share/doc/ttyrec/
./usr/share/doc/ttyrec/README
./usr/share/doc/ttyrec/copyright
./usr/share/doc/ttyrec/examples/
./usr/share/doc/ttyrec/examples/sample1.tty.gz
./usr/share/doc/ttyrec/changelog.Debian.gz
./usr/share/man/
./usr/share/man/man1/
./usr/share/man/man1/ttyrec.1.gz
./usr/share/man/man1/ttyplay.1.gz
./usr/share/man/man1/ttytime.1.gz
./usr/lib/
./usr/lib/mime/
./usr/lib/mime/packages/
./usr/lib/mime/packages/ttyrec
# 
But the bad thing is that 'ar' is not in the main .sfs, only in the devx, so I hesitate to give it more scope.
And that's why I use 7z (but only if ar's not there) also for *.a and *.ar.
I still want to look at your code -although I think you've gone overboard, by now, with what the thing should do -ripping/decoding video/audio would be more appropriate for other tools -IMO.
TBH, I too feel it's extravagance, but seeking and adding new formats was (I think there's not much left to be added, what could work OOTB in Slacko) like a drug - I couldn't stop myself. :wink:
BTW, it only do extract streams from within a container, not (en|de)codes them.

As for your AppDir, is it available somewhere?
This link is down.

Thanks &
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#32 Post by amigo »

Code: Select all

ar p ttyrec_1.0.8-5_i386.deb data.tar.gz | tar xzvf -
Trouble is that newer debs have data.tar.xz, so:

Code: Select all

ar p ttyrec_1.0.8-5_i386.deb data.tar.xz | tar xJvf -
I'll just attach a copy of my AppDir since it is small -just a couple of scripts in there(disrpm is unused but left to rest there...)

You won't be able to use the AppDir, though, unless you have Xdialog, gtk-shell and greq all installed -I was fiddling around with vearious UI builders...

Still, you may be able to glean some ideas from it. I've been threaening to re-write it for years, but I use it more than any other 'utility' application on my system.

Another thing I rather dislike is including binaries in an AppDir without the sources. Mine is simply a wrapper for tools which should be available. One really should check to see if the decompressor is available or warn and quit. And, checking the file-type could be done another way -I check archives using 'file' instead of relying on the file suffix.
Attachments
ZipZap-1.7.tar.bz2
Copy of ZipZap with modified exploderpm
(7.73 KiB) Downloaded 895 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#33 Post by SFR »

Thank you! I like how it looks & works. Very nice. :)
Xdialog is OOTB in most (all?) of Puppies these days and it seems that only greq is necessary - couldn't find any reference to 'get_dest_dir()', where gtk-shell is used.
I attached .pet of greq if anyone would also like to play with it.

Greetings!
Attachments
greq-0.9.4.pet
(8.78 KiB) Downloaded 887 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
pemasu
Posts: 5474
Joined: Wed 08 Jul 2009, 12:26
Location: Finland

#34 Post by pemasu »

Here is the .deb I tested. Of course I should have tested several of them.
Pure Ubuntu Raring repositories .debs seems to extract both control files and the package installable content. Which is great. I do like that I can check the control files included postinst script commands and the control file dependencies list.

Thanks.

https://launchpad.net/~rvm/+archive/ppa ... 1_i386.deb

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#35 Post by SFR »

Thanks, now I can see the possible culprit:

Code: Select all

# ar t smplayer_0.8.5-1~raring1_i386.deb 
debian-binary
control.tar.gz
data.tar.lzma
# 
@Amigo: can we assume it's because of .lzma?

Ok, since I'd like to preserve exploderpm as primary tool for .deb (for those extra control files), I'll rig up some workaround for the next version, e.g. this ugly one seems to work well:

Code: Select all

# [ `exploderpm -l smplayer_0.8.5-1~raring1_i386.deb | grep '^./$' | wc -l | cut -f1 -d ' '` -eq 2 ] && echo "Use exploderpm" || echo "Use dpkg-deb"
Use dpkg-deb
# 
# [ `exploderpm -l ttyrec_1.0.8-5_i386.deb | grep '^./$' | wc -l | cut -f1 -d ' '` -eq 2 ] && echo "Use exploderpm" || echo "Use dpkg-deb"
Use exploderpm
# 
@Pemasu: I attached uextract with this fix (real .gz, script only, goes to /usr/local/bin & chmod +x), so if you'd like to test it in spare time, would be nice. :)

Greetings!
Attachments
uextract.gz
(4.94 KiB) Downloaded 897 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#36 Post by musher0 »

Hello, SFR.

p7zip is not in the wary 5.5 PPM, but I did have a copy of a p7zip-9.13 pet.
I then downloaded your UExtract-1.14 and everything works fine on this
wary 5.5.

May I suggest a cosmetic change in line 12 of your AppRun, like so:

Code: Select all

xterm +tr -bg black -rv -T UExtract -e /tmp/uextract_exec -o "$CUSTOMDIR" "$@"
The "+tr" will override any transparency which may have been set in .urxvtrc,
the "-bg black" will accentuate the contrast and finally the "-rv" will produce a very readable listing on whitish background. (Please see picture.)

It's just a suggestion of course.

As to the "_extracted" ending added the extracted folder, I find it quite ugly, :oops:
but it is obviously safer! :lol: The user can always remove the ending if necessary.

That said... job well done!

BFN.

musher0
Attachments
UExtract-terminal.jpg
(19.94 KiB) Downloaded 809 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
pemasu
Posts: 5474
Joined: Wed 08 Jul 2009, 12:26
Location: Finland

#37 Post by pemasu »

SFR. It works now. Thanks.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#38 Post by amigo »

"_extracted" I meant to comment about this, as I don't like the idea either. Archives should usually extract to their natural name -that is, the name of the archive minus the suffix(es). However, this is not always the case -even with archives like tar which can tell you if there is a toplevel dir.

In my src2pkg program, I go to great lengths to avoid 'tar bombs' being unpacked without a toplevel dir. Surely you've all had the experience of opening a (usually) *.zip archive and having ti spread lots of files into the current directory. Really messy if you happen to do that where there are already lots of files. :-(
The solution is to create the directory arbitrariy and cd in there to unpack the archive. But, then you have to figure out if there already was a 'topdir' in the archive, and if so, then cd in there and move everything up one level, back out and remove that dir. It really is messy. The alternative is to list the archive beforehand and try to figure out if it has a topdir -again messy because of the difficulty of listing and variance in the output for various archive types. This is one of the reasons I have never re-written ZipZap because a *really* sane needs better intermediate functionality -which is easier to implement before adding support for a bunch of archive types.

I also like seeing the control files in *.deb archives, so my tools usually unpack them.

My AppDir does illustrate a more featureful use of AppDirs. The RISC environement was drag-n-drop oriented and with a view from the users HOME dir. The idea was, the user knows where his files are (in HOME) and usually is running things from there. So, instead of having the user start an application and then use it's file-selector to browse to his HOME dir, find the file and open it -instead, the user simply grabs the file in question and drops into the app that he wants to open it with.

On my system, I only have left-click actions set for a couple of different file types. Since one doesn't always want to do the same thing with a file: for instance, an *.html file, I drop it onto an html editor icon or a browser icon according to what I want to do. Of course, there are options like SendTo, etc., which achieve a similar variety of options or using a GUI tool which provides the options when left-clicking. Still, if you really want to understand why rox does things differently, you need to look at it from this other perspective.

As far as I know, most of the AppDirs used in Puppy do not take advantage of the extra features of them -like the menu entries which can be created in the AppInfo.xml file.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#39 Post by SFR »

RE: "_extracted"

Well, I don't particularly like it either, but I've chosen it as a necessary evil.
Better than fun with deleting hundreds or thousands junk files out of $HOME.
I, too, was thinking about the way of resolving it in some nicer manner, but it's a pure mess indeed.
Actually, something like this could be quite decent solution:

IF
- destination dir (which is "archive_name" without suffix(es)) contains only one and only a subdir
AND
- destination dir's name is exactly the same as its subdir's name
THEN
- rename subdir to sth rare (in case if inside is also a dir named like that)
- move all stuff from subdir one level up
- delete empty subdir


But what if the destination dir already exists or we're extracting identically named archive.tar, archive.zip, archive.rar and so on, at the same time (remember? - "mass extraction" :wink: )?
We'll end up with archive, archive(1), archive(2), which is IMHO even worse than archive.tar_extracted, archive.zip_extracted.
Ahh, I'll leave it alone for now...
_____________
musher0 wrote:May I suggest a cosmetic change in line 12 of your AppRun, like so:

Code: Select all

xterm +tr -bg black -rv -T UExtract -e /tmp/uextract_exec -o "$CUSTOMDIR" "$@"
The "+tr" will override any transparency which may have been set in .urxvtrc,
the "-bg black" will accentuate the contrast and finally the "-rv" will produce a very readable listing on whitish background. (Please see picture.)
Unfortunately this would break compatibility with other terminal emulators than urxvt, e.g. rxvt (won't accept e.g. '+/-tr' parameter) and others, depending which one gets called by xterm.
I tried to:

Code: Select all

echo -e '\e[30;107m'; clear
but this in turn breaks the output in "real" terminal/console.
_____________

@Pemasu: thanks for confirmation!

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#40 Post by mikeb »

Hmm one thing that occured to me is that on windows 7zip will list content directory by directory.....

On linux the list output includes every file and its path and I see no direct way of achiving the windows like result directly with 7z(a). Searching suggests that a bit of scripting is needed either to produce a tree or folder by folder output. Producing a tree output is covered but not found anything for folder traversal.

One to consider when dealing with an archive with 20,000 files and something I would like to throw at xarchive and it may be beneficial here.

If I am not being clear, opening my 20,000 file archive shows 10 files and 10 top level folders on windows 7zip...I can then browse down the folders or extract as required.

Any thoughts and suggestions welcome.

mike

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#41 Post by SFR »

If it comes for browsing archives (or extracting specific files) I switched to File Roller long time ago.
Supports 7z very well.
PeaZip also isn't bad...
_____________

Update, version 1.5

- fixed: problems with some .deb pkgs
- added: warning msg if given extraction tool isn't installed
- some minor corrections

First post updated!

Ok, I think that's it (for now). I need a break anyway. :wink:

Thank you all &
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#42 Post by amigo »

"But what if the destination dir already exists or we're extracting identically named archive.tar" Most extractors will overwrite existing files by default. Some, at least, are configurable from cli options.

"contains only one and only a subdir" & "move all stuff from subdir one level up" This is basically what I do in src2pkg, although most compressors will show us a listing -but it can still be hard to tell if a toplevel is really the top -and top of where? An archive which is an installable package may have no toplevel, but include several subdirs.
Heuristics would suggest that *.zip, *.rar and any formats commonly found on windows machines would be more likely to be a tar 'bomb. It also suggests that archives named like this: *.tar.gz are less likely to be 'tar bomb' than those with names like: *.tgz

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#43 Post by mikeb »

Thanks SFR .. Its fun to get carried away :)

regards

Mike

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#44 Post by amigo »

@SFR, I had a pretty long look yesterday at your code and I've gotta say it looks pretty good! Very readable -nicely indented, etc.
I did see a couple of rough spots though -I'll post a diff a little later with a fix or two.

I can see the logic in supporting filesytem images, like *.iso and *.sfs files, but I really think you ought to pull the video/audio/pdf stuff out of the tool. An archiver is usually meant to work with groups of archived/compressed files. The audi/video features would go nicely in their own little utility and pdf/other document tools could go elsewhere.

Then you might look at incorporating ideas from ZipZap for handling dropping files/dirs onto the AppDir.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#45 Post by mikeb »

Very readable -nicely indented, etc.
Someone should buy Barry a 'tab' key for christmas :D

mike

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#46 Post by SFR »

Hey Amigo

As for ffmpg/pdf, I understand your point and you almost convinced me, but I'd like to draw attention on an elusive difference: it's not verbatim "unarchive" utility, but more generic "extraction" utility.
TBH, if I called it, e.g. "Unarchiver" or similar, I'd have never thought to put such stuff into it.
Yeah, at the beginning I had only archives in mind, but over the time my guideline evolved to: "If the manner of processing this [format to be added] fits to (or at least doesn't abuse glaringly) the meaning of 'extraction' - put it in!".
And although this kind of logic has enslaved me, I'm gonna rethink this once more...and perhaps I'll follow what my heart says, not my mind. :lol:

Ok, I'm waiting for the diff, thanks. 8)
______________
mikeb wrote:
Very readable -nicely indented, etc.
Someone should buy Barry a 'tab' key for christmas :D

mike
:idea: :D :wink:

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#47 Post by amigo »

I think you could make two or three nice apps out of that code...
But, I've fallen into the same thinking -nearly every time I get good and started with a utility. There's always a tendency to over-reach with the scope of a project. Of course, you're gonna do just what you like with it anyway.

@mikeb You quoted what is, from me, high praise. This tool from SFR is maybe the most readable code I have ever seen on this site!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#48 Post by mikeb »

Many a fun time I have had adding tabs to puppy scripts....

Hmm 'a get stuff out of anything tool'.... i catch your drift... I feared another pburn too but I am one for making simple gui's to do all that command line work simply because my memory would let me down.

Now if you could make it extract money...........

mike

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#49 Post by SFR »

I didn't plan to update it so quick, but since I found rather important bug, I won't be waiting, so here it is, v1.6:

- bugfix: if an archive contains one or more empty directories, they won't get unpacked
- added: warning at install time about missing dependencies (if any)
- removed .mht (it was never working too well, anyways)
- minor internal improvements

And a couple of new formats:
.cramfs (it was there before, in one of previous version, but got lost somehow)
.sqfs
.udf

Ok, now I'm really taking a break. 8)

First post updated!

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#50 Post by SFR »

SFR wrote:Ok, now I'm really taking a break. 8)
I lied, version 1.7:
- fixed typo (was 'unzx' instead of 'unxz')
- all 'xz -d' occurencies replaced with 'unxz' (for consistency)
- animated GIFs extraction (using gifsicle)
- can extract "naked" (extensionless, i.e. already gunzip'ed) initrd
- more 'fool-proof' mechanisms
- got rid of awk dependency
- some internal rearrangements

First post updated!

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Post Reply