Merge Utility for SFS

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

Merge Utility for SFS

#1 Post by jpeps »

Merge SFS files

(usage with script named "merge")

USAGE: merge [ one.sfs two.sfs...]

Output: merge.sfs

Code: Select all

#!/bin/sh -a

[ "$1" == "" -o "$1" == "-h" ] && echo "USAGE: merge [ one.sfs two.sfs...]" && exit

 
MERGE="/tmp/merge"
  mkdir "$MERGE"

FILES="/tmp/files"
  mkdir "$FILES"

 NUM="$#" 

i=0
for  ((i=0;i<$NUM;i++)); do
   
   mount "$1" "$FILES" -o loop,ro
   cp -rp ${FILES}/* "$MERGE"
   umount "$FILES" 
   sleep 1 
shift 
done
    mksquashfs "$MERGE"  merge.sfs

## cleanup;
rm -r "$MERGE"
rm -r "$FILES"


User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#2 Post by Lobster »

Brilliant :)
After the merge you could run the program again?

So we could easily create
Graphic SFS
or Browser SFS
bundles?
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#3 Post by jpeps »

If I understand you, output is just another SFS that could be merged with something else. The output name defaults as "merge.sfs" You can merge several at once, however.. (Note: set MERGE & FILES dir to wherever you have enough space).

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

#4 Post by reckrhodes »

Yepeey! This is what Linux for. The freedom to choose.

I have merge.sfs and createsfs. Thanks jpeps and mohan34u. :D

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#5 Post by jpeps »

reckrhodes wrote:Yepeey! This is what Linux for. The freedom to choose.

I have merge.sfs and createsfs. Thanks jpeps and mohan34u. :D
Cool! Now add Shinobars sfs-on-the-fly and Desktop-restore and you're set to go!! :D
http://murga-linux.com/puppy/viewtopic.php?t=64354
http://murga-linux.com/puppy/viewtopic.php?t=64464

User avatar
Q5sys
Posts: 1105
Joined: Thu 11 Dec 2008, 19:49
Contact:

#6 Post by Q5sys »

nice little script. If you want to merge a ton of SFS files, there is another easy way to do it. Install the 'Edit SFS' script and then take all the SFS files you want, pop them open, drag'n'drop the files into one window and then build that window. Bingo... a dozen SFS files built into one. :)
Now if only someone could create a GUI program, where you can just drag and drop however many SFS files you want and have it merge them all.. heh
Perhaps in V2 of your work? :P

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#7 Post by jemimah »

Q5sys wrote:nice little script. If you want to merge a ton of SFS files, there is another easy way to do it. Install the 'Edit SFS' script and then take all the SFS files you want, pop them open, drag'n'drop the files into one window and then build that window. Bingo... a dozen SFS files built into one. :)
Now if only someone could create a GUI program, where you can just drag and drop however many SFS files you want and have it merge them all.. heh
Perhaps in V2 of your work? :P
There is a gui Ecube and I wrote Fluppy. It's a roxapp based on edit-sfs.

(It needs xpupsay for the dialog).
Attachments
xpupsay-1.2.1-i486.pet
(86.74 KiB) Downloaded 758 times
Combine-SFS-01.pet
(8.96 KiB) Downloaded 1103 times

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#8 Post by jpeps »

jemimah...think it needs some work. Files shouldn't HAVE to be in /mnt/home to include. Dragging onto the icon should list them, not just open up the program. Shouldn't need a few gigs to merge a few SFS's; also It's failing to even combine 2 little test SFSs.

Code: Select all

ERROR - unsquashfs failed to expand /initrd/mnt/dev_save/myfiles.sfs
It returned the following error message:

This should be something SIMPLE that works. I like the pooches for the wireless, but gets old for simple utilities.

Doesn't seem to work as cli.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#9 Post by jpeps »

Q5sys wrote: Now if only someone could create a GUI program, where you can just drag and drop however many SFS files you want and have it merge them all.. heh
Perhaps in V2 of your work? :P
Hi Q5sys,

The nice thing about scripts is that you can incorporate them anyway you like. For your request, all you need is to have items dragged to an icon listed to a file. Then simply run the list as arguments to the script above. Very simple, and fun to try for yourself.

BTW/ I don't know why you'd want to open SFS's and drag files, etc. A script does that for you.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#10 Post by jpeps »

Here's a simple icon click version.
USAGE: Drag sfs files to desktop icon. Click on icon to create merge.sfs in /mnt/home

Desktop Icon: merge-icon; Place on desktop

Code: Select all

#/bin/sh

### Desktop Icon for rox-merge 
## USAGE: Drag SFS files to icon; click on icon to create merge.sfs
##          Click to create merge.sfs in /mnt/home
 

if [ "$1" == "" ]; then
 
  if [ -f /tmp/list ]; then
      rox-merge  
     
yaf-splash -font "8x16" -outline 0 -margin 4  -fg black -text "merge.sfs in /mnt/home"
  fi
exit
fi
 
echo $@ >>/tmp/list  
rox-merge script (name "rox-merge" and place in PATH)
note: you can edit MERGE and FILES directories for more space or
to change output directory from /mnt/home (if not using pupsave, etc).

Code: Select all

#!/bin/sh 
 

 if [ -f /tmp/list ]; then 

  MERGE="/tmp/merge"
   mkdir "$MERGE"

  FILES="/tmp/files"
     mkdir "$FILES"

   while read line; do  
   
        mount "$line" "$FILES" -o loop,ro 
        cp -rp ${FILES}/* "$MERGE"
        umount "$FILES"
        sleep 1 
    done </tmp/list

mksquashfs "$MERGE"  /mnt/home/merge.sfs

## cleanup
   rm -r "$MERGE"
   rm -r "$FILES"
   rm /tmp/list
fi
Attachments
rox-merge.pet
Desktop Icon: /usr/local/bin/merge-icon
(792 Bytes) Downloaded 696 times

Post Reply