Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 19:03
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
sfs2pet-20121001
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [11 Posts]  
Author Message
TheAsterisk!


Joined: 10 Feb 2009
Posts: 403
Location: SE Wisconsin, US

PostPosted: Thu 04 Oct 2012, 17:26    Post subject:  sfs2pet-20121001
Subject description: convert SFS to PET; right-click option
 

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, 19:13; edited 5 times in total
Back to top
View user's profile Send private message Visit poster's website 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Thu 04 Oct 2012, 22:48    Post subject:  

Hi Asterisk.

Have you seen this? ---> includes batch function Smile

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
TheAsterisk!


Joined: 10 Feb 2009
Posts: 403
Location: SE Wisconsin, US

PostPosted: Fri 05 Oct 2012, 14:06    Post subject:  

@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! Cool
Back to top
View user's profile Send private message Visit poster's website 
gcmartin

Joined: 14 Oct 2005
Posts: 4353
Location: Earth

PostPosted: Fri 05 Oct 2012, 15:45    Post subject:  

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

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 4353
Location: Earth

PostPosted: Fri 05 Oct 2012, 15:52    Post subject:  

@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

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Fri 05 Oct 2012, 19:41    Post subject:  

Quote:
@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).

Quote:
Would this require "WOOFing"?

I don't know anything about WOOF and its related stuff. Sad

Quote:
since I kind of wanted to try my hand at it anyway

Yes, I see. It's the same way over here. Laughing

Quote:
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... Laughing

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
TheAsterisk!


Joined: 10 Feb 2009
Posts: 403
Location: SE Wisconsin, US

PostPosted: Sat 06 Oct 2012, 18:31    Post subject:  

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.

Shocked
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.)

Quote:
...But i like 8-liners also... Laughing

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. Laughing

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. Razz)
Back to top
View user's profile Send private message Visit poster's website 
pemasu


Joined: 08 Jul 2009
Posts: 5463
Location: Finland

PostPosted: Sun 07 Oct 2012, 02:30    Post subject:  

http://www.murga-linux.com/puppy/viewtopic.php?t=56431
Sc0ttman`s project...that scratch file tool.
Back to top
View user's profile Send private message 
TheAsterisk!


Joined: 10 Feb 2009
Posts: 403
Location: SE Wisconsin, US

PostPosted: Tue 09 Oct 2012, 12:38    Post subject:  

@pemasu: That's the one!
Back to top
View user's profile Send private message Visit poster's website 
Tman


Joined: 22 Jan 2011
Posts: 814
Location: Toronto

PostPosted: Thu 18 Oct 2012, 20:25    Post subject:  

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:

#!/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.
sfs2pet-1.2.pet
Description 
pet

 Download 
Filename  sfs2pet-1.2.pet 
Filesize  794 Bytes 
Downloaded  600 Time(s) 
Back to top
View user's profile Send private message 
TheAsterisk!


Joined: 10 Feb 2009
Posts: 403
Location: SE Wisconsin, US

PostPosted: Sun 18 Nov 2012, 19:17    Post subject:  

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).
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [11 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0874s ][ Queries: 13 (0.0041s) ][ GZIP on ]