sfs2pet-20121001

Miscellaneous tools
Post Reply
Message
Author
User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

sfs2pet-20121001

#1 Post by TheAsterisk! »

At the request of gcmartin (and arguably because I gave up on a forum search too soon) I created a simple script to convert an SFS to a PET package. A right-click option for ROX-Filer is included.

Please note that my SFS-to-PET conversion currently assumes *.tar.gz compression is to be used for dot-pets.

Webpage

Direct Download
sfs2pet-20121001.pet (853 B)

MD5
md5sum.txt

Usage
(sfs2pet works in the directory that the SFS file being converted is in, so make sure you have plenty of free room for the conversion script to use!)

IMPORTANT!
Only use this script on a filesystem that supports symbolic links! EXT2/3/4 filesystems should be alright. If all else fails, you can use something inside the savefile on frugal installations (/root/ or ~ works), or work inside of "/tmp".

From ROX-Filer, right click on the SFS file, and on the pop-up context menu for the file select the option "Convert to PET".
(click for right-click menu screenshot)
The script will run in a terminal that pops up, but no user intervention is required.

Alternately, from the commandline, invoke the command "sfs2pet <SFS file>".


- - - - - - - - - - - - - - -

Additional Notes
My script invokes the "unsquashfs" command, so will usually work with whichever SFS version is used in your Puppy release, i.e. SFS4-only in newer Puppies, but SFS3-only in the older dogs (421 and older, or 431 retro kernels, etc.).

Since *.tar.gz compression is used for the final dot-pet (via "dir2tgz" and then "tgz2pet"), the created PET should be compatible with all or almost all Puppies and Puplets. (For one example, Fatdog 601 seems to use *.tar.xz compression in newly-created PETs, but can still handle and install *.tar.gz PETs.)

Finally, as with my other scripts, there is no error handling beyond whatever the invoked commands already do, and the code probable isn't the prettiest or most nicely commented and indented. Still, hopefully some of you will find it of use.

- - - - - - - - - - - - - - -

For a good GUI alternative that also includes a right-click option, and which will work on any filesystem (given enough space in "/tmp" and in the savefile), please see the next post down by RSH.
Last edited by TheAsterisk! on Sun 18 Nov 2012, 23:13, edited 5 times in total.

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

#2 Post by RSH »

Hi Asterisk.

Have you seen this? ---> includes batch function :)

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]

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

#3 Post by TheAsterisk! »

@RSH:
I have seen it, and tried it. It made a single ~58 MB Calibre SFS of mine into a PET weighing in at ~116 MB. It very well may have been user error [EDIT: I can't duplicate that issue, so I'd assume it was my error.], but at that point I figured I may as well just hammer out my own converter, since I kind of wanted to try my hand at it anyway and I usually prefer little right-click scripts when I'm keyboarding my way around the file tree in ROX.

Your script also dumps the dot-pet into a subdirectory of the home directory, which can be nasty on a savefile with some SFS files. (I have a Netbeans SFS that weighs in at ~259 MB, and placing a ~259 MB PET into my savefile could be iffy on space. It would work fine for full installations of Puppy, though.)

Regarding the batch conversion mode, I really didn't have any use for it. (A small, separate for-do-done loop invoking a standalone script has become my remedy in similar cases where a need eventually developed.)



Thanks for the information, though. It's always good to know what other options are out there. Even if I prefer my own script, maybe others reading this thread will find yours more to their liking.

Whatever works best for ya! 8)

gcmartin

#4 Post by gcmartin »

This adds some additional dimension to SFS processing. It has been a help in processing some of the packages where the developers will ONLY produce SFS files for community use (even though they understand that "DVD-only" processing is active in the community (LIveDVD) and that the PPM for all Puppy packages is rooted in PETs.

This does NOT distract from what @RSH offers. But, it does add some additional useful features for providing easy use with little system/capacity impact.

Here to help

gcmartin

#5 Post by gcmartin »

@RSH is there a way that the best of both PETs could be "merged" so that distro developers who package "right-click" (like Pemasu and others) could provide in their packaging?

Would this require "WOOFing"?

Here to help

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

#6 Post by RSH »

@RSH is there a way that the best of both PETs could be "merged" so that distro developers who package "right-click" (like Pemasu and others) could provide in their packaging?
I am currently working on an update. Next version gives the user option to select, where to save the .pet/s (at /root/ConvertedToPet or at the original path).
Would this require "WOOFing"?
I don't know anything about WOOF and its related stuff. :(
since I kind of wanted to try my hand at it anyway
Yes, I see. It's the same way over here. :lol:
Your script also dumps the dot-pet into a subdirectory of the home directory, which can be nasty on a savefile with some SFS files.
Yes, that's right - it stores the converted .pet to /root/ConvertedToPet.

---

@ TheAsterisk!

I have downloaded your .pet and did have a look into the code. I must say, i was surprised - only 8 lines of really used code.

But then i realized: your script extracts the sfs at its original place which can result in a non-working .pet if the original sfs is on a fat32 filesystem. Then all symbolic links will get lost because fat32 can not handle symbolic links of linux OS's.

I did choose to use pizzasgoods edit-sfs pet as basement because it has had already everything to extract a sfs file in a really save way with improvements, informations and options to select for the users need. I just had to make some less modifications on this, to get it to work as wanted.

This is especially what i like mostly on programming with bash. Often you find a script that offers an idea or a useful tool which can be worked out (with a lot of work). But sometimes you find a very well thought out and programmed script which allows you to make something totally different out of it - just adding and/or modifying a few lines.

But i like 8-liners also... :lol:
[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]

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

#7 Post by TheAsterisk! »

RSH wrote:@ TheAsterisk!

I have downloaded your .pet and did have a look into the code. I must say, i was surprised - only 8 lines of really used code.

But then i realized: your script extracts the sfs at its original place which can result in a non-working .pet if the original sfs is on a fat32 filesystem. Then all symbolic links will get lost because fat32 can not handle symbolic links of linux OS's.
:shock:
Uh... Yes. That's right.
I'd better make a note of it, as a limitation of my script.

Thanks for pointing it out. I've used ext2/3 filesystems only for so long that it didn't even occur to me what would happen on an FAT16/32 or NTFS filesystem. (Especially important given how many frugal Puppies are on FAT-formatted flash drives.)
...But i like 8-liners also... :lol:
Yeah, I do make compact scripts, but it's more because I'm really a rookie in disguise and my scripting knowledge usually runs out around a dozen lines or so, not because I'm a lightweight-guru. :lol:

EDIT: I seem to remember there being a tool which could create a "scratch file" with an ext2 filesystem inside of it. Could be useful. Maybe I'll experiment next week...
(This week, I'm working retail in a small town in SE Wisconsin and it's the local Oktoberfest this weekend. Drunks and lots of sales, so not much time for Puppy until later. :P)

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

#8 Post by pemasu »

http://www.murga-linux.com/puppy/viewtopic.php?t=56431
Sc0ttman`s project...that scratch file tool.

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

#9 Post by TheAsterisk! »

@pemasu: That's the one!

User avatar
Tman
Posts: 808
Joined: Sat 22 Jan 2011, 21:39
Location: Toronto

#10 Post by Tman »

theAsterisk,

You can just have your script do the work in a linux folder instead of working in the location where the sfs is..the code below works for me:

Code: Select all

#!/bin/sh
workDIR="/root/my-pets"
mkdir -p $workDIR
cp $1 $workDIR
cd $workDIR
sfs="$1"
ext=${sfs##*.}
rootname=`basename "$sfs" ".$ext"`
unsquashfs "$1"
mv squashfs-root "$rootname"
dir2tgz "$rootname";tgz2pet "$rootname".tar.gz #use this line or the one below, not both
#dir2pet "$rootname";rm nohup.out 
rm -rf $rootname
rm -f $rootname.sfs
rox $workDIR
Also, I noticed the Rox right-click option wasn't working ... maybe it does in older pups? I had to add the right-click link to the .appication_sfs folder, and not .application_x-squashfs-image

EDIT: I just took another look at my code above and found that it isn't necessary to copy the sfs file over to $workDIR. Attached is my modified pet.
Attachments
sfs2pet-1.2.pet
(794 Bytes) Downloaded 1346 times

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

#11 Post by TheAsterisk! »

Tman wrote:theAsterisk,

You can just have your script do the work in a linux folder instead of working in the location where the sfs is.
Yes, I know I can, but I run my savefile with little extra space, so I don't. I could also get into trouble given that some of my SFS files are in excess of 500 MB, and I don't know what the average savefile has to spare, but I wouldn't necessarily assume that 500 MB is free.

That being said, it is a nice option to have provided the user understands all the implications- for either the original script or your update to it, and I appreciate the suggestion and the effort. If you don't mind, I might like to mirror your package and add a small section for it to my website once I have the new one up and going completely (theasterisk.tk).

Pelo

SFS2PET pet is bigger than SFS

#12 Post by Pelo »

SFS2PET pet is bigger than SFS
Don't mind. Used to make a pet of JRE java sfs

SFS2PET-0.5|SFS2PET|0.5||Utility|60K||SFS2PET-0.5.pet||SFS to PET Converter||||

JRE8u45Lin-i586|JRE8u45Lin|i586||BuildingBlock|167556K||JRE8u45Lin-i586.pet||Java Virtual Machine|ubuntu|precise||
Attachments
clicdroit.jpg
(22.23 KiB) Downloaded 970 times

gcmartin

#13 Post by gcmartin »

I think PET size vs SFS size only impacts the subsystem's packaging for PUP installations. As far as I know, when either is complete upon installation, the installed filesystem size for JAVA subsystem launch are the same and the operational subsystem size in RAM is also the same.

Hope this is helpful

Pelo

Thanks for yr precision

#14 Post by Pelo »

Thanks for yr precision. My idea was to build a home puplet with java apps...
I will continue with SFS loaded. strange, pet miss libraries.
Don't mind. I was only a try of SFS2pet

Post Reply