Edit-SFS 2.1 (squash filesystem editor)
Posted: Tue 06 Oct 2009, 00:50
edit_sfs-2.1.pet
This is a simple roxapp (click-able folder that runs a script, very handy things) that allows you to edit an xxxx.sfs file like pup_xxx.sfs, or devx_xxx.sfs. It takes care of extracting and recompressing. All you need to do is supply the file, edit it, then receive the new file.
It will install to /root/my-roxapps/Edit-SFS. If you feel like modifying it, right-click, choose "look inside", and edit the AppRun file.
You can use this several different ways. Just clicking the /root/my-roxapps/Edit-SFS file will run it and let you supply a path to a .sfs file (or drag the file onto the field). Alternately, you can drag a .sfs file directly onto /root/my-roxapps/Edit-SFS itself. I also added a symlink into /usr/bin, so you can run the command edit-sfs /path/to/file.sfs (or drag-and-drop onto the binary). Finally, this package also installs a right-click action in ROX-Filer for .sfs files.
The first time you run it, you will also be asked to tell it where you want to make the working directory. This should be on a Linux partition. Depending on the size of the file you're editing, you may need several hundred megabytes free. You also have an option of having Edit-SFS set up a temporary ramdisk. That's usefull if you're using Puppy on a computer with a no Linux partitions besides your possibly too cramped pup_save.2fs file. Keep in mind however that a ramdisk requires ram, so if you don't have hundreds of megabytes of ram available, that won't work so well. (Don't forget, if your Puppy already copied pup_xxx.sfs to ram, or you're running with pfix=ram, then you are probably already using about a hundred MB or more of ram for that!)
If you ever change your mind about the location, go to /root/my-roxapps/ and right-click on the Edit-SFS icon. You'll see an entry that says "Set base dir". Use that and it will redisplay the above window.
Once it knows which file to use and where to work, it will decompress the .sfs file into a temporary directory in that location. When it finishes it will present you with a new window featuring the file's extracted content. When you are done editing, click "Build" and it will close the window, compress the data, and present you with a freshly compressed .sfs file. Place that somewhere for safe-keeping before hitting "Finished". When ready, clicking the "Finished" button will delete the working directory in the process of cleaning up after itself. It also unmounts any ramdisk it may have created. Then you're done.
This version of Edit-SFS should be much more efficient than previous versions, as it reads the sfs file from the location where it is already at rather than copying it first. It also has limited compatibility with both versions 3 and 4 of squashfs. In Puppies older than 4.3 it only supports 3 unless you go out of your way to add support for 4. But in Puppy 4.3 and newer it should be able to deal with both versions. The file it creates will be in the same format as the original, or at least close (if the original was 3.0 but you have 3.1, the final file will be 3.1). They way I implemented that isn't ideal, but it gets the job done and should be easy enough for people to deal with if they need to tack on support for even newer versions of squashfs at some point.
Unlike the previous versions, this one also shows the status as it compresses.
Also, this version doesn't care if you run multiple instances. It uses mktemp to generate unique temporary directories.
updated 2009.10.13: give output file the same permissions as the input file
This is a simple roxapp (click-able folder that runs a script, very handy things) that allows you to edit an xxxx.sfs file like pup_xxx.sfs, or devx_xxx.sfs. It takes care of extracting and recompressing. All you need to do is supply the file, edit it, then receive the new file.
It will install to /root/my-roxapps/Edit-SFS. If you feel like modifying it, right-click, choose "look inside", and edit the AppRun file.
You can use this several different ways. Just clicking the /root/my-roxapps/Edit-SFS file will run it and let you supply a path to a .sfs file (or drag the file onto the field). Alternately, you can drag a .sfs file directly onto /root/my-roxapps/Edit-SFS itself. I also added a symlink into /usr/bin, so you can run the command edit-sfs /path/to/file.sfs (or drag-and-drop onto the binary). Finally, this package also installs a right-click action in ROX-Filer for .sfs files.
The first time you run it, you will also be asked to tell it where you want to make the working directory. This should be on a Linux partition. Depending on the size of the file you're editing, you may need several hundred megabytes free. You also have an option of having Edit-SFS set up a temporary ramdisk. That's usefull if you're using Puppy on a computer with a no Linux partitions besides your possibly too cramped pup_save.2fs file. Keep in mind however that a ramdisk requires ram, so if you don't have hundreds of megabytes of ram available, that won't work so well. (Don't forget, if your Puppy already copied pup_xxx.sfs to ram, or you're running with pfix=ram, then you are probably already using about a hundred MB or more of ram for that!)
If you ever change your mind about the location, go to /root/my-roxapps/ and right-click on the Edit-SFS icon. You'll see an entry that says "Set base dir". Use that and it will redisplay the above window.
Once it knows which file to use and where to work, it will decompress the .sfs file into a temporary directory in that location. When it finishes it will present you with a new window featuring the file's extracted content. When you are done editing, click "Build" and it will close the window, compress the data, and present you with a freshly compressed .sfs file. Place that somewhere for safe-keeping before hitting "Finished". When ready, clicking the "Finished" button will delete the working directory in the process of cleaning up after itself. It also unmounts any ramdisk it may have created. Then you're done.
This version of Edit-SFS should be much more efficient than previous versions, as it reads the sfs file from the location where it is already at rather than copying it first. It also has limited compatibility with both versions 3 and 4 of squashfs. In Puppies older than 4.3 it only supports 3 unless you go out of your way to add support for 4. But in Puppy 4.3 and newer it should be able to deal with both versions. The file it creates will be in the same format as the original, or at least close (if the original was 3.0 but you have 3.1, the final file will be 3.1). They way I implemented that isn't ideal, but it gets the job done and should be easy enough for people to deal with if they need to tack on support for even newer versions of squashfs at some point.
Unlike the previous versions, this one also shows the status as it compresses.
Also, this version doesn't care if you run multiple instances. It uses mktemp to generate unique temporary directories.
updated 2009.10.13: give output file the same permissions as the input file