How I make .pets into .sfs's

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

How I make .pets into .sfs's

#1 Post by jrb »

Recently I put together ChoicePup4.1.2 which is designed to use .sfs files instead of .pet files for adding programs to Puppy.

Squash files, .sfs, are compressed files, like zip files, that may contain systems of files and folders. Puppy412 runs from pup_412.sfs which contains almost the entire puppy OS. Puppy can also mount and use additional .sfs files on a temporary need to use basis.

This is how I make additional .sfs files. I will do two examples, one easy and one more involved. Firstly, I will do fbreader-0.10.7-i486.pet Second I will do MPlayer from the ibiblio pet repository.

You will need an ext2 or ext3 partition. Don't Panic!!! If you don't know how to backup your harddrive, create and format a new partition then you shouldn't. (Kids, don't try this at home) You can get a usbflashdrive, insert it in your computer. Open System->Gparted, select the flashdrive (sdb1 for example), right click on /dev/sdb1, choose format to -> ext3. Click the Apply button on the toolbar and you now have an ext3 work area. (I should mention that everything on sdb1 will be deleted during this process, don't lose your Swiss bank account password).

The reason for the ext3 partition is you will be working with symlinks, handy little devices for redirecting puppy to files it doesn't know how to find. They only work on Linux partitions. You can place a symlink on a Linux partition that points to a file on a non-linux partition but not vice versa.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#2 Post by jrb »

Simple Example:
1)Place fbreader-0.10.7-i486.pet in your ext3 work area.

2)Right click on it and rename to fbreader-0.10.7-i486.tgz. Left click on it and use xarchive to extract. This will give you a new folder called /fbreader-0.10.7-i486. Look inside, no icons, no pinstall.sh, just /usr and pet.specs, should be easy. Within this folder go to /usr/share/applications/FBReader.desktop, right click and Open as Text. We see that the exec file is FBReader, if no path is specified the Exec file will be in either /usr/bin, /usr/sbin, or /usr/local/bin (or maybe /bin or /sbin, unlikely). We look in /usr/bin and there it is. The Icon=FBReader.png. Searching around we see it in /usr/share/pixmaps. Everything looks good.

3)One nice optional touch is to put FBReader on the right-click OpenWith menu. That way you can right click on an ebook and open it up. To do that go back into your /fbreader-0.10.7-i486 folder. Right click->New->Directory. Create /root and then click on it with the middle button. Now create /.config/rox.sourceforge.net/OpenWith. In the other ROX window go back to /usr/bin. Drag FBReader to the OpenWith folder and chooce "Link (relative)". Now FBReader is on the OpenWith menu.

4)Let's build the .sfs! Use the up arrow go get back to your work area where you can see the /fbreader-0.10.7-i486 folder. Right click anywhere in the work area and choose Window->Terminal Here. Once the terminal opens type "dir2sfs fbreader-0.10.7-i486". You will now have a file called fbreader-0.10.7-i486_412.sfs and a -md5.txt file.
If you're using ChoicePup, right click on the file and choose OpenWith->load_sfs. If not then place this file in /mnt/home, open System->bootmanager and tell it to load the file at bootup then reboot.

When you go to the Document menu you will see "E-book reader". Click and it will open. Find an ebook and start reading.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#3 Post by jrb »

More Involved Example:
1)Download mplayer-1.0rc2-071007-1.pet to your ext3 work area. While there you might as well download mplayer_codecs_full-20071007.pet and mplayerplug-in-3.45.pet. Full codecs sounds good and we definitely want the browser plugin. Size is not such a big deal when we can choose how many packages to load at a time.

2)At this point I usually backup (copy to slightly different name) my pup_save.2fs (pup_save-412Q.sfs->pup_save-412Q2.sfs)file and install the .pet. Pet Package Manager will tell me what dependencies (files) are missing, write these down. It will even offer to download and install them most of the time. (You will download these files and include them in your .sfs). After installing the .pet and dependencies make sure the program runs in Puppy. Try it out on a media file and in your browser. If it does, reboot and choose your backup pup_save, this will get rid of any changes the installed .pets have caused. You can delete the first pup_save.

There's at least one other way to check for dependencies but I won't go into that here.

3)Right click on each of the .pets and rename them to .tgz (mplayer-1.0rc2-071007-1.pet -> mplayer-1.0rc2-071007-1.tgz). Left click on each .tgz, xarchive will open up and you can extract the contents. This will give you a folder with the same name as the .pet.

4)Open the mplayer-1.0rc2-071007-1 folder. You will see four things, /etc, /usr, mplayer.xpm, and pinstall.sh. /etc and /usr are folders containing the mplayer program. mplayer.xpm is the menu icon for mplayer. pinstall.sh contains instructions for installing the .pet into puppy.

5)We will deal with mplayer.xpm first. This icon will automatically be placed in /usr/local/lib/X11/mini-icons/ when the .pet is installed, but not when a .sfs is loaded! That, however is where it needs to go. So, you must create /usr/lib/X11/mini-icons. Start by clicking /usr with your middle mouse button. This will open it and leave the mplayer folder open too. Right click in /usr and ->New->Directory. Create /local. Click on /local and create /lib, etc. Once you have created /mini-icons you can drag mplayer.xpm from the mplayer folder to /mini-icons and choose Move. Now its in the right place.

6)Now lets deal with pinstall.sh. Open it as text. The important line here is "echo '#!/bin/sh' > ./usr/local/bin/defaultmediaplayer". It wants to rewrite defaultmediaplayer! Not a good idea if we want to try out different mediaplayers from .sfs files. Lets just delete pinstall.sh and we'll deal with this another way. What we will do is rewrite /usr/local/bin/defaultmediaplayer ourselves. I'll cover this in the adapting for ChoicePup section but you could do the same in any version of puppy. (There isn't always a pinstall.sh. Often they build symlinks to the main exec file "ln". We'll talk about that below.)

7)Next we need to figure out which file actually runs mplayer. To do this we will go to /usr/share/applications/mplayer.desktop. Right click on it and Open as Text. Looking at the Exec line we see that mplayershell is the file we want, but where is it? If no path is specified then the exec file should be in /usr/bin, /usr/sbin, or /usr/local/bin. Looking in /usr/bin there it is, /usr/bin/mplayershell.

I want to link this to the RightClick->OpenWith menu. So, we need to create more folders. Use the green up arrow to go back up to the main mplayer folder where you can see /etc and /usr. Create /root and then click on it with the middle button. Now create /.config/rox.sourceforge.net/OpenWith. In the other folder (/etc,/usr,/root) go back to /usr/bin. Drag mplayershell to the OpenWith folder and chooce "Link (relative)". After this you can rename the link to "mplayer" if you want. Now mplayer is on the OpenWith menu.

8)Now its time to deal with the two other .pets, codecs and plugin. Use the up arrow to get back to your ext3 workspace where you can see all three folders, mplayer, codecs and plugin. Middle click on mplayer. Middle click on codecs. No pinstall.sh just /usr. Drag /usr for codecs to mplayer and choose "Copy". Puppy will ask if you want to merge. Hold down the enter key until everything is copied. Close the codecs window.

Middle click on plug-in. Drag /etc to mplayer. Repeat the copying process. Drag /usr to mplayer. Repeat the copying process.

9)Dealing with defaultmediaplayer. In Choicepup I have set defaultmediaplayer to look for a file called "media". I'll talk about that more below but right now we have to create one more symlink. Create /usr/local/bin. Go back up to mplayer. Middle click on /usr. In one window go to /usr/local/bin. In the other go to /usr/bin. Drag /usr/bin/mplayershell to /usr/local/bin and choose "Link (relative)". Rename this link to "media". Now defaultmediaplayer will find it and run it.

10)Create the .sfs. Go back to the ext3 work area. Close any other folders. Right click on a blank space in the work area and choose "Window->Terminal Here". In this terminal type "dir2sfs mplayer-1.0rc2-071007-1". When you hit "Enter" a new .sfs file, mplayer-1.0rc2-071007-1_412.sfs (or _411.sfs, etc. I've been taking this out since mine are renamed to include the ch- prefix), will be created along with a md5.txt file. This is your new .sfs package. Try it out. If it works, congratulations. If not delete and try to figure out what went wrong. Usually at this stage I see things I forgot to include or little bugs. The original folders are still there to work with so its easy to go back and make changes.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#4 Post by jrb »

Adapting to ChoicePup

1)Default files
I have rewritten several of the "default" files in /usr/local/bin.
as mentioned above for defaultmediaplayer. It looks for a file called "media" provided by a symlink to gxineshell, vlc, xine, or now mplayershell.

Code: Select all

#!/bin/sh
  if [ -L /usr/local/bin/media ]; then
     exec /usr/local/bin/media "$@"
  else
    Xdialog --wrap --title "Program Not Loaded" --msgbox "Hi, You have not loaded a MediaPlayer yet. Try gxine-0.5.9choice.sfs, vlc-0.8.6choice.sfs or xine-ui-0.99.5choice.sfs. This box will remain until you press the ENTER key.\n" 10 60
  fi
Default Browser looks for "mozstart" provided by a symlink to firefox, seamonkey or opera.

Code: Select all

!/bin/sh
  if [ -L /usr/local/bin/mozstart ]; then
    exec /usr/local/bin/mozstart "$@"
  else
    exec netsurf "www.google.ca"
  fi
Defaultpaint looks for "paint"
Defaultdraw looks for "draw"
Defaultpdfviewer looks for "pdfview"
Defaulttexteditor looks for "editor
Defaultwordprocessor looks for "writer"
Defaultspreadsheet looks for "spreadsheet"

If you provide the appropriately named symlink to the exec file in your .sfs package ChoicePup will find it and use it.

2)Menu Entries
There are several good .pets and .sfs's out there that do not have entries on the puppy menu. Their creators left them to be run from command line (or didn't convert them over from some other distro). I want ChoicePup to be easy for noobs so I would like everything there on the menu.

Let's take FlashGames from ch-games.sfs as an example, this is just a webpage that I put together with links to internet sites, but it had no entry on the "Fun" menu. So I opened the bubbles-1.0.2a.pet from the pet2 repository (which is also in ch-games.sfs) and copied /usr/share/applications/Bubbles.desktop to FlashGAmes.desktop. I then changed all mention of "Bubbles" to "Flashgames", changed the Exec=bubbles.tcl to Exec=flash_games (the exec file I created), changed Icon=ballorange16.xpm to Icon-mini-happy.xpm (I just looked for something appropriate in /usr/local/lib/X11/mini-icons), saved and placed it in /ch-games/usr/share/applications created ch-games.sfs and when I loaded ch-games.sfs there it was on the "Fun" menu.

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=FlashGames
Icon=mini-happy.xpm
Comment=FlashGames
Exec=flash_games
Terminal=false
Type=Application
Categories=Game
GenericName=FlashGames

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#5 Post by jrb »

I hope this is clear enough. If you have questions, comments, editorial suggestions or anything else you would like to say then please post a reply and I will try to answer.

Give it a try (maybe start with something simple). If you make a good .sfs package be sure and post a message here. I'm looking for new ones to add to the ChoicePup collection.

Cheers, J

magerlab
Posts: 739
Joined: Sun 08 Jul 2007, 20:08

#6 Post by magerlab »

i'd like to point that it's better to open a terminal window and run
pet2tgz xxx*.pet than just rename a pet to tgz. there are errors sometimes when you just rename pet into tgz. also do nor forget to remove pet.specs file.

when creating sfs you can also use an asterisk for long file names

i made some sfs myself before ( for mplayer, qt4, dynamic skype etc) they all work fine

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#7 Post by jrb »

magerlab,
I have seen the pet2tgz command but never used it. Renaming has always worked for me. I'll try it. Also I forgot about mentioning to remove pet.specs.

Just tried typing dir2sfs ink* instead of dir2sfs inkscape-0.45.1. Worked great. Nice tip, I always make mistakes typing out long file names. This will save a lot of typing and retyping.

Have you got any .sfs's you think would go well with ChoicePup? If you upload them, maybe to http://ifile.it, I'd like to see them.

Thanks, J

reckrhodes
Posts: 116
Joined: Wed 30 May 2007, 08:15

#8 Post by reckrhodes »

hi jrb

Maybe this bashguide_420.sfs will be of useful. I converted this from pet to sfs using Puppy Linux 4.2 using the createsfs script.

http://ifile.it/yzvie29/bashguide_420.sfs
Attachments
useful-scripts.pet
This one has so many useful scripts you can make use of.
(66.63 KiB) Downloaded 661 times

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#9 Post by jrb »

reckrhodes,
This bashguide is excellent! Did you make the original .pet? It appears to have been set up with making an .sfs in mind. The .desktop has path to icon and executable. With your permission I shall certainly add it to http://puppylinux.asia/members/choicepup/sfs.

I have to caution ChoicePup users about the useful-scripts.pet. It indeed has some very useful scripts which it places in /root/my-applications/bin. It also has load_sfs and unload_sfs which are built into ChoicePup. I have modified the ChoicePup load_sfs slightly, its in /usr/local/bin. Could create problems having two different versions installed. Similarly, the unload_sfs in useful-scripts is an updated version of the one I used. I want to try it out because currently larger .sfs's, like OpenOffice, just don't want to unload, even if it says "success". If you install this .pet then I recommend, for ChoicePup, deleteing these two from /root/my-applications/bin.

Thanks so much reckrhodes. I'll get that bash-guide updloaded later today. J

reckrhodes
Posts: 116
Joined: Wed 30 May 2007, 08:15

#10 Post by reckrhodes »

Hi jrb.

Here is the ldconfig.pet. This will solve the problem of unloading big sfs file using the unload_sfs script. Good luck with your Choicepup puplet.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#11 Post by jrb »

That did the trick! :D
I was about to reply that I already had ldconfig in /sbin but then I took a look inside your pet and saw initrdinit, mkinitrd and sin. (Must be the last one that makes it work :lol: ) So I thought I better try it out. Sure enough, OpenOffice now loads and unloads, K-Office the same.

Thanks again reckrhodes, this is ChoicePup's first patch.

As for ChoicePup I put it together for myself and when it worked I thought I better share. I'm hoping this approach might catch on, maybe even with official versions of Puppy. I'm glad to see that Leon's 24 sfs initrd.gz has been incorporated into Puppy4.2. That's a start.

User avatar
esmourguit
Posts: 1410
Joined: Fri 17 Nov 2006, 14:45
Location: Entre l'ile aux oiseaux.et l'ile de sainte Lucie

#12 Post by esmourguit »

Bonjour,
@ jrb,
I tried to build a french localization file. I made the sfs file but when i tried to load it i had that answer : Failed! Could not union ch-french_412.sfs.
What's wrong?,
Cordialement ;)
[url=http://moulinier.net/][color=blue][b]Toutou Linux[/b][/color][/url] - [url=http://toutoulinux.free.fr/pet.php][color=blue][b]Paquets français[/b][/color][/url]

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#13 Post by jrb »

Hi esmourguit,
A number of questions:
Which puppy412 are you running? Standard, ChoicePup, something else?
How many other .sfs packages do you have loaded?
Have you gotten this message with any other .sfs package?
When you left click on your package does it open in ROX so you can see the contents?

Awaiting your reply, J

User avatar
esmourguit
Posts: 1410
Joined: Fri 17 Nov 2006, 14:45
Location: Entre l'ile aux oiseaux.et l'ile de sainte Lucie

#14 Post by esmourguit »

Bonjour,
@ jrb,
Thanks for your reply.
I was running Choicepup, none .sfs package loaded . So no message.
Just build the french one (Choicepup running) and tried to load it.
And yes, when i left clic on it, i can see the content in Rox windows, (see choicepup.png).
Cordialement ;)
[url=http://moulinier.net/][color=blue][b]Toutou Linux[/b][/color][/url] - [url=http://toutoulinux.free.fr/pet.php][color=blue][b]Paquets français[/b][/color][/url]

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#15 Post by jrb »

esmourguit,
First I would try loading one of the other ch-.sfs packages to make sure load_sfs was working properly.
Then I would try rebooting and reloading ch-french_412.sfs.
Then I would reboot pfix=ram and try reloading.
Then I would copy ch-french_412.sfs to /mnt/home and try using bootmanager to load it at startup.
Then I would try building the .sfs package again.
Then I would try making a seperate .sfs package from each folder, /etc, /root, /sbin, /usr, and see if any or all of them loaded. If one of them refused then I would take a very careful look at its contents.

If none of the above worked I would upload the file, perhaps to http://www.myfreefilehosting.com/ (you don't have to put in email addresses), and let other puppy users, such as jrb, puzzle over it. :?

User avatar
esmourguit
Posts: 1410
Joined: Fri 17 Nov 2006, 14:45
Location: Entre l'ile aux oiseaux.et l'ile de sainte Lucie

#16 Post by esmourguit »

Bonjour,
I restarted the PC and I was able to load the french .sfs package.
But not everything has been taken into account :
And I lost over the functions "load SFS" and "unload SFS" in "Open With" in Rox, thought there is only the translation string for Rox in the package. But for many of the programs is a success, although there is still work.
Cordialement ;)
[url=http://moulinier.net/][color=blue][b]Toutou Linux[/b][/color][/url] - [url=http://toutoulinux.free.fr/pet.php][color=blue][b]Paquets français[/b][/color][/url]

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#17 Post by jrb »

This is the beauty of working with .sfs packages. Nothing is lost, pup_save is not corrupted and you are free to investigate and make perfect.

I think you are on to something very good here, localization by .sfs. Puppy could learn to speak every language! 8)

Good Luck, keep us posted on progress, J

Stormson5150
Posts: 40
Joined: Fri 06 Feb 2009, 16:00

#18 Post by Stormson5150 »

I have a couple of questions concerning .sfs files that perhaps you could help me with, as I am working on something somewhat similar...

1- Can .sfs files be made to a certain size, before hand, and then filled up to that particular size... Sort of like a container?

2- Are .sfs files, or can they be made to be, writable on the fly? In other words... Can I stuff say, FireFox3, into an sfs file, and then have it continue to update TO that file instead of to the save file?

3- Is there any easy way convert a save file into an sfs ( thus solving #1 as well)? Or vice versa, make an sfs act like a save (thus solving #2)? It seems that both are containers of a sort even though one is squashfs and the other ext2.. It seems if we could somehow make them act in the above manner(s) it would solve a myriad of issues...Such as what to do when you're 2g save on a fat32 partition becomes too full but you dont want to loose whats in it (simply convert it into an sfs and create a new one), or vice versa, how to have the auto updates inside of an sfs as stated above (thus saving room on the save)....

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#19 Post by jrb »

Hi Stormson5150,
Firstly let me say that there are people in the forum who are far more expert on files and file systems than I but I will give you what knowledge I have. You might also like to read http://en.wikipedia.org/wiki/Squashfs.
1- Can .sfs files be made to a certain size, before hand, and then filled up to that particular size... Sort of like a container?
1.) Short answer, no. Unlike .2fs, .sfs is a compression program, like zip, which is applied to files. It produces read-only files so they are unmodifiable after creation.
2- Are .sfs files, or can they be made to be, writable on the fly? In other words... Can I stuff say, FireFox3, into an sfs file, and then have it continue to update TO that file instead of to the save file?
2.) Short answer, no. However, it is extremely easy to remake an updated .sfs file. If you're not running the .sfs at the time you can click on it to mount, copy the contents to a folder, add your updates and run dir2sfs on the folder.

3- Is there any easy way convert a save file into an sfs ( thus solving #1 as well)? Or vice versa, make an sfs act like a save (thus solving #2)? It seems that both are containers of a sort even though one is squashfs and the other ext2.. It seems if we could somehow make them act in the above manner(s) it would solve a myriad of issues...Such as what to do when you're 2g save on a fat32 partition becomes too full but you dont want to loose whats in it (simply convert it into an sfs and create a new one), or vice versa, how to have the auto updates inside of an sfs as stated above (thus saving room on the save)....
3.) Short answer, yes. If you're not running the pup_save.2fs you can click on it to mount, copy the files you want to a folder, you can even delete them from the pup_save.2fs (careful, make a backup copy first!) and then run dir2sfs on the folder. You now have them in a .sfs. If you want to update a program running from .sfs, say FireFox, you could rebuild the FireFox.sfs with the files from your pup_save.2fs.

Suppose you are running the pup_save.2fs, simply copy to a different name, pup_save2.sfs, then mount it and copy files, edit, etc. Same with .sfs, if you're running it then copy it to a different name and mount it.

Hope that is clear and helps. J

Stormson5150
Posts: 40
Joined: Fri 06 Feb 2009, 16:00

#20 Post by Stormson5150 »

Yup.. Thanks jrb... That's all about what I figured as well.

Its a shame we dont have a writable, compressed file system in a container format for linux yet... Though I did find one solution (http://www.eldos.com/solfs/), unfortunately its commercial...

If something where to be developed along these lines under the GPL, it would answer allot of the issues surrounding all livecd type systems.. In our case it could replace both the save, allowing more save space due to the compression AND the .sfs container format making the add on packs writable and upgradable...

Post Reply