View contents of .pet or .deb packages

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
cimarron
Posts: 292
Joined: Fri 31 May 2013, 01:57

View contents of .pet or .deb packages

#1 Post by cimarron »

Sometimes I want to see what's in a pet (or deb) package before installing it. It's not hard to do manually, but takes a few steps. These scripts streamline the process, creating and opening a temporary directory with the package contents so you can see what's there (and install parts of it manually, if desired).

I found this "pet2dir" script in a post by Tman:

Code: Select all

#!/bin/sh
#Tman
clear
mkdir -p /tmp/pet
cp -f "$@" /tmp/pet 2>/dev/null
cd /tmp/pet
pet2tgz *.pet
tar -x -f *.gz
rm /tmp/pet/*.gz
echo "Done converting:"
ls
spacefm /tmp/pet 2>/dev/null
The last line opens the directory in your file manager (SpaceFM in my case). Change spacefm to rox or whatever FM you use, save the script in, say, /usr/local/bin, and give it execute permissions. It uses pet2tgz, which I think is standard in pups (in /usr/bin), but I'll attach it below for anyone that might not have it.

The "deb2dir" script I just made based on the pet script:

Code: Select all

#!/bin/sh

clear
mkdir -p /tmp/deb
cp -f "$@" /tmp/deb 2>/dev/null
cd /tmp/deb
dpkg-deb -x *.deb /tmp/deb
rm /tmp/deb/*.deb
echo "Done extracting:"
ls
spacefm /tmp/deb 2>/dev/null
Again, the last line opens the directory in your file manager (SpaceFM in my case). Change spacefm to rox or whatever FM you use, save the script in, say, /usr/local/bin, and give it execute permissions. This uses dpkg-deb, which I think is standard in pups (in /usr/bin), but I'll include it below for anyone that might not have it.

I added these scripts to the right-click menu in my SpaceFM, or they could be used from the command line, followed by the filename of the pet or deb package.
Attachments
deb2dir.tar.gz
(234 Bytes) Downloaded 809 times
pet2dir.tar.gz
(244 Bytes) Downloaded 796 times
extras.tar.gz
contains pet2tgz and dpkg-deb
(49.16 KiB) Downloaded 733 times
Last edited by cimarron on Mon 20 Oct 2014, 21:31, edited 1 time in total.

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

#2 Post by mikeb »

If you have Xarchive you can add .pet to its archive list in the tar wrapper (and to pupzip) then it will open pets like any other archive which I find convenient.

mike

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

#3 Post by amigo »

Those are both really 'expensive' utilities -needlessly extrcaing the archive and then listing it.

For a pet, simply do:

Code: Select all

tar --use-compress-program=gzip -tf $1 2>/dev/null
You'll have to check for debs, but this:

Code: Select all

dpkg-deb -l $1 
should work.

You might call them 'lspet' and 'lsdeb' respectively.

User avatar
cimarron
Posts: 292
Joined: Fri 31 May 2013, 01:57

#4 Post by cimarron »

I find it useful to extract the packages (not just list their contents) because sometimes I want to manually install parts of the package, or take a script out and edit it, etc.

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

#5 Post by amigo »

Well, the title of the thread says 'view content', not extract.

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

#6 Post by mikeb »

600 pixels makes for slim GUI's ...does debs too.

mike
Attachments
xarchive.png
(74.65 KiB) Downloaded 2866 times

watchdog
Posts: 2021
Joined: Fri 28 Sep 2012, 18:04
Location: Italy

#7 Post by watchdog »

I always install peazip which can open and extract file from a large variety of archives. I use the linux portable for Gtk version from:

http://peazip.org/

In wary the Gtk version does not work and I use the Qt version with the qt-4.7.1.sfs loaded:

http://www.4shared.com/file/Fs1zcssq/qt-471.html

You have to copy from peazip folder the Qt4pas.so in /opt/qt4/lib and create to it in the same folder a symlink named Qt4pas.so.5.

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

#8 Post by mikeb »

In wary the Gtk version does not work
what is that missing...I have peazip running on some pretty old distros? Just curious.
Peazip is a bit of a lump but wins for browsing say a pup_xxx.sfs. I can do it in xarchive using 7za backend but of course it displays every file rather than just one level so is s-l-o-w. Its like the windows equivalent...super fast for grabbing a file from an sfs....and can even browse down into initrds.... simpler than on linux that one :D

Back to topic... yes I agree to simply view contents unpacking seems a little odd...ok if small, but large archives such as sources can get messy.

Sorry cimarron if you got the wrong sort of attention here..... it happens sometimes.

mike

User avatar
cimarron
Posts: 292
Joined: Fri 31 May 2013, 01:57

#9 Post by cimarron »

As I said, I often like to do more than just look, so extracting makes sense for me. I'll pull out the parts I want and install them manually, or edit a script before installing, etc.

I like xarchiver a lot. These pet and deb scripts are nice for quick one-click access to the package contents, though. And there's no cleaning up when you're done messing with the extracted contents, since the scripts open the packages in a tmp directory.

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

#10 Post by musher0 »

watchdog wrote:I always install peazip which can open and extract file from a large variety of archives. I use the linux portable for Gtk version from:

http://peazip.org/

In wary the Gtk version does not work and I use the Qt version with the qt-4.7.1.sfs loaded:

http://www.4shared.com/file/Fs1zcssq/qt-471.html

You have to copy from peazip folder the Qt4pas.so in /opt/qt4/lib and create to it in the same folder a symlink named Qt4pas.so.5.
Hi, watchdog.

You know of UExtract and PackIt, don't you, from Puppy member SFR?
They are as efficient and do the same as Peazip in about 1/4 of the size.
And they don't need the Qt libs.

Best regards.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

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

#11 Post by musher0 »

Hello again, cimarron.

The above-mentioned resources are here:
UExtract : http://murga-linux.com/puppy/viewtopic.php?t=87864
PackIt : http://murga-linux.com/puppy/viewtopic.php?t=89211

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
cimarron
Posts: 292
Joined: Fri 31 May 2013, 01:57

#12 Post by cimarron »

I'm happy with Xarchiver. And the scripts I posted above work great for extracting and examining pet and deb packages (at least the smaller ones I use most of the time). I can run them with a click from within SpaceFM, quicker and easier than using a separate archiver application.

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

#13 Post by mikeb »

They are as efficient and do the same as Peazip in about 1/4 of the size.
well they do not descend through folder hierarchies as I mentioned which to me it the raison d'etre of using peazip over smaller extractors and saves a lot of time with large archives. Try wading through 5000 files in a gtk interface after its taken 2 minutes to load.

mike

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

#14 Post by musher0 »

mikeb wrote:
They are as efficient and do the same as Peazip in about 1/4 of the size.
well they do not descend through folder hierarchies as I mentioned which to me it the raison d'etre of using peazip over smaller extractors and saves a lot of time with large archives. Try wading through 5000 files in a gtk interface after its taken 2 minutes to load.

mike
True.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

zandarian
Posts: 117
Joined: Wed 14 Oct 2009, 21:10

#15 Post by zandarian »

An easy way to see the contents of the .pet packages is to rename them, from filename.pet to filename.pet.tar.gz or filename.tar.gz . After that if you click on them XArchive opens these compressed files showing their contents.

Source: trio in http://www.murga-linux.com/puppy/viewtopic.php?t=42056

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#16 Post by RSH »

[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

zandarian
Posts: 117
Joined: Wed 14 Oct 2009, 21:10

#17 Post by zandarian »

amigo wrote:

Code: Select all

dpkg-deb -l $1 
should work.
Here, with Slacko Puppy version 5.7, that doesn't work. But this yes:

Code: Select all

dpkg-deb -x filename.deb folder_where_deb_extracted
With this I can extract and see the contents of deb packages.

zandarian
Posts: 117
Joined: Wed 14 Oct 2009, 21:10

#18 Post by zandarian »

OK. Just to see the contents of the deb packages, without extracting them:

Code: Select all

dpkg-deb -c filename.deb

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

#19 Post by mikeb »

Curious...is Xarchive not working with debs now...its what I always use.

If you alter Xarchive script for tar by adding .pet to its list of accepted extensions it saves all that renaming.

mike

zandarian
Posts: 117
Joined: Wed 14 Oct 2009, 21:10

#20 Post by zandarian »

Thanks, mikeb.

Yes, with XArchive I can see the contents of deb packages.

As you proposed, to make XArchive show the contents of the pet packages without renaming them, I've edited /usr/lib/xarchive/wrappers/tar-wrap.sh and changed ...

Code: Select all

GZIP_EXTS="tar.gz tgz"
... to ...

Code: Select all

GZIP_EXTS="tar.gz tgz pet"
Source: upnorth in http://www.murga-linux.com/puppy/viewtopic.php?t=58641
Without XArchive, just using the terminal, to see the contents of the pet packages without extracting them we can use the command:

Code: Select all

tar -tf filename.pet
It's a shorter, easier to remember, command derived from the one provided by amigo in this thread.

Post Reply