Replace your savefile/folder with an sfs storage file

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

Replace your savefile/folder with an sfs storage file

#1 Post by nic007 »

I haven't been using a savefile/folder for ages, instead I save my changes to an sfs file. Some advantages: save at anytime you choose, read-only so chances of corruption small, small in size (data compressed).

METHOD:
1. With your savefile/folder loaded run the example script below. You need to edit the directory paths and filenames in the script according to your setup if necessary. You can also run the script if you do not have an existing savefile/folder (edit the paths)
2. Your new sfs containing the contents of your savefile/folder (minus a few things excluded by the script) should now be created, check if it's there.
3. Rename your existing savefile/folder to something like 1save.
4. Select reboot from menu. Do not create a new savefile/folder. Your newly created sfs with your saved data should be loaded automatically at startup.
5. After booting, edit the script so that it reflects the correct directory paths according to your setup. Whenever you want to save something in future just run the script again. You don't need a savefile/folder anymore.
6. Delete your old savefile/folder.
7. Note that this script is an example. You can change it to suit your needs.

Code: Select all

#!/bin/sh
WrkDir="/tmp/adrv"
rm -r $WrkDir
wait
mkdir $WrkDir
cp -a /initrd/pup_a/* /initrd/pup_ro1/* /initrd/pup_rw/*  $WrkDir
cd $WrkDir
rm -r ./etc ./tmp ./dev ./mnt ./initrd ./lib/modules/* ./lib/firmware/* ./usr/share/doc/* ./sys ./root/.wine/* ./root/.thumbnails/* ./root/.cache/* ./root/.Trash/* ./root/.XLOADED ./root/.pmusic ./var/log
alsactl --file /etc/asound.state store
cp -a /etc $WrkDir 
rox -d $WrkDir
Xdialog -center -msgbox "Click 'OK' when ready to proceed" 0 0
mksquashfs $WrkDir /mnt/sda3/puppy605/adrv_tahr_6.0.5.sfs -noappend
rox -D $WrkDir
rm -r $WrkDir
Xdialog -center -title "SUCCESS!!!"  --no-buttons -infobox "New adrv_tahr_6.0.5.sfs created.  Exiting" 0 0 2000 
   
exit

ADDITIONAL INFORMATION /TIPS:
- This method works best if you keep your sfs file with changes small. It is recommended to only save your personal settings and other small system changes with this method. Instead of installing programs, rather use sfs-addons. These additional sfs's can easily be loaded at startup with a simple command, eg: include the command, sfs_load -c -q /PathofSFStoLoad/NameOfSFS.sfs, in /etc/rc.d/rc.local OR you can load it on the fly during a session.
- If you have a big, existing savefolder/file (perhaps with programs already installed), the best would be to do a complete remaster first and then proceed with the method described here. Alternatively (if you have a newer puppy which support the ydrv) you can run the script in this post and rename the resulting sfs to that of the ydrv, eg: ydrv_tahr_6.0.5.sfs. The ydrv will be loaded automatically at startup. Thereafter you can proceed with the method of creating an adrv for your personal settings as suggested.
- Omit the Xdialog check/edit prompt in the script if not required.
- The script can be run at anytime you want to save changes (I have an icon on the desktop). If you want to save automatically at reboot/shutdown do this: Rename the shutdownconfig script in /usr/sbin to something like shutdownconfig1 (keep as backup of the original) > copy the script in this post to /usr/sbin and rename it shutdownconfig.
- Your sfs file containing your changes is read-only (unlike a savefile/folder which is read and write). The result is that you can add new folders/files to the running filesystem and edit existing files during a session and this will automatically be recorded when you save to the sfs. If, however you want to delete folders/files you will need to delete them by editing the sfs (which option is available when running the script).

Also see this thread: http://www.murga-linux.com/puppy/viewtopic.php?t=117254
Last edited by nic007 on Fri 06 Mar 2020, 14:53, edited 19 times in total.

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#2 Post by backi »

Hi di ho nic007 !

I am quite interested .
Do not exactly understand how this works .......could you explain a bit further ....
for dummies .... Do i only have to execute your script ? .......
How to save ?

I am using Tahrpup 6.0.6 with a Save-Folder on Usb-Flash .Would be helpful for me and others if you could give an example how to proceed .
Thank you in Advance .

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#3 Post by nic007 »

Hi, backi

The script saves your changes to an sfs file (the adrv in this case) and replaces the usage of a savefile or savefolder.

Do you need your current savings to your savefolder to be included or do you want to start afresh? How big is your savefolder currently? This works well if you want to keep your file with the changes very small.

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#4 Post by backi »

I want my current savefolder included . My Save-Folder is 125 megabytes.
I am running in pupmode=13 .......if this has any meaning .

You would do me a big favor if you fill your script with the components that fit to my TahrPup 6.0.6 with Save-Folder named tahrsave-1 on a Usb-Flash (sdb1 ? ).
Maybe i did not correctly re-named something .

This is my "modified " script .

#!/bin/sh
mkdir /mnt/sdb1/puppyfilesystem
cp -a /initrd/pup_a/* /initrd/pup_rw/* /mnt/sdb1/puppyfilesystem
wait
cd /mnt/sdb1/puppyfilesystem
rm -r ./tmp ./mnt ./initrd ./sys ./root/.cache/* ./root/.thumbnails/* ./root/.Trash/* ./root/.XLOADED ./var/log
wait
Xdialog -center -msgbox "Puppyfilesystem ready. Check and edit if needed. Press OK to proceed" 0 0
rm /mnt/sdb1/puppy606/adrv_tahr_6.0.6.sfs
mksquashfs /mnt/sdb1/puppyfilesystem /mnt/sdb1/puppy606/adrv_tahr_6.0.6.sfs -comp xz
rm -r /mnt/sdb1/puppyfilesystem

exit

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#5 Post by nic007 »

backi, it takes a bit of time to create an sfs file with that amount of data in your savefolder which may be a bit of a hassle. My setup works as follows: I do not install anything but use sfs-addons for additional programs, I do not include my browser cache or trash in my savings (my script clears these items). With this method you will make a new sfs file for your changes everytime you choose to do so, so best to keep it small. Decide if you still want to try it before I give further instructions.
Last edited by nic007 on Wed 22 Feb 2017, 16:03, edited 1 time in total.

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#6 Post by backi »

Hi belham !

Did read your E-Mail !

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#7 Post by backi »

O.K nic007 !

So give me an example script related to my situation as described above if i want to start afresh .

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#8 Post by nic007 »

backi wrote:O.K nic007 !

So give me an example script related to my situation as described above if i want to start afresh .
By afresh I mean starting without any savefile or savefolder and then using my metod further. Perhaps we should do it like this first so you can see how it works, so-
1. Rename your existing savefolder by putting a number at the beginning like 1tahrsave and reboot (without your savefolder)
2. Make some changes like changing the desktop background
3. Run the script and make sure the paths and filenames are correct according to your setup
4. An adrv with your changes should now be created
5. Reboot and check if the adrv loads as startup. You should see your changes.
Everytime you want to save changes, you run the script. That's basically it. BTW- When you restart/shutdown do not create a savefile or savefolder.

belham2
Posts: 1715
Joined: Mon 15 Aug 2016, 22:47

#9 Post by belham2 »

nic007 wrote:
backi wrote:O.K nic007 !

So give me an example script related to my situation as described above if i want to start afresh .
By afresh I mean starting without any savefile or savefolder and then using my metod further. Perhaps we should do it like this first so you can see how it works, so-
1. Rename your existing savefolder by putting a number at the beginning like 1tahrsave and reboot (without your savefolder)
2. Make some changes like changing the desktop background
3. Run the script and make sure the paths and filenames are correct according to your setup
4. An adrv with your changes should now be created
5. Reboot and check if the adrv loads as startup. You should see your changes.
Everytime you want to save changes, you run the script. That's basically it. BTW- When you restart/shutdown do not create a savefile or savefolder.
Ah hah, that-----Rename your existing savefolder by putting a number at the beginning like 1tahrsave and reboot (without your savefolder)---is what I was messing up testing this. Thanks for this, Nic007, this is really useful as I have been trying to get away from savefiles (always remastering and/or now building Woof-CE creations with changes included).


P.S. Backi, I really had to, on testing this, cut the heck out of one of my savefiles on a fresh frugal install for this to work...as Nic007 said, he keeps it small, which is probably the best advice overall here. I'll have to remaste/build the browser and other large changes into the OS.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#10 Post by nic007 »

belham2 wrote:
nic007 wrote:
backi wrote:O.K nic007 !

So give me an example script related to my situation as described above if i want to start afresh .
By afresh I mean starting without any savefile or savefolder and then using my metod further. Perhaps we should do it like this first so you can see how it works, so-
1. Rename your existing savefolder by putting a number at the beginning like 1tahrsave and reboot (without your savefolder)
2. Make some changes like changing the desktop background
3. Run the script and make sure the paths and filenames are correct according to your setup
4. An adrv with your changes should now be created
5. Reboot and check if the adrv loads as startup. You should see your changes.
Everytime you want to save changes, you run the script. That's basically it. BTW- When you restart/shutdown do not create a savefile or savefolder.
Ah hah, that-----Rename your existing savefolder by putting a number at the beginning like 1tahrsave and reboot (without your savefolder)---is what I was messing up testing this. Thanks for this, Nic007, this is really useful as I have been trying to get away from savefiles (always remastering and/or now building Woof-CE creations with changes included).
You can of course delete your savefile/savefolder if you are happy with the method. We just kept the savefile/savefolder for testing purposes. So how did it go?

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#11 Post by nic007 »

belham2 wrote:
nic007 wrote:
backi wrote:O.K nic007 !

So give me an example script related to my situation as described above if i want to start afresh .
By afresh I mean starting without any savefile or savefolder and then using my metod further. Perhaps we should do it like this first so you can see how it works, so-
1. Rename your existing savefolder by putting a number at the beginning like 1tahrsave and reboot (without your savefolder)
2. Make some changes like changing the desktop background
3. Run the script and make sure the paths and filenames are correct according to your setup
4. An adrv with your changes should now be created
5. Reboot and check if the adrv loads as startup. You should see your changes.
Everytime you want to save changes, you run the script. That's basically it. BTW- When you restart/shutdown do not create a savefile or savefolder.
Ah hah, that-----Rename your existing savefolder by putting a number at the beginning like 1tahrsave and reboot (without your savefolder)---is what I was messing up testing this. Thanks for this, Nic007, this is really useful as I have been trying to get away from savefiles (always remastering and/or now building Woof-CE creations with changes included).


P.S. Backi, I really had to, on testing this, cut the heck out of one of my savefiles on a fresh frugal install for this to work...as Nic007 said, he keeps it small, which is probably the best advice overall here. I'll have to remaste/build the browser and other large changes into the OS.
You can do a remaster first butI strongly suggest you start afresh and use sfs-addons instead of installing stuff. Your personal settings can be changed quickly so that's not a problem.

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#12 Post by backi »

Hi nic007
!
Did as you told me .
But no adrv will be created

This is my script .....maybe you have a look at it what could be wrong .

#!/bin/sh
mkdir /mnt/sdb1/puppyfilesystem
cp -a /initrd/pup_a/* /initrd/pup_rw/* /mnt/sdb1/puppyfilesystem
wait
cd /mnt/sdb1/puppyfilesystem
rm -r ./tmp ./mnt ./initrd ./sys ./root/.cache/* ./root/.thumbnails/* ./root/.Trash/* ./root/.XLOADED ./var/log
wait
Xdialog -center -msgbox "Puppyfilesystem ready. Check and edit if needed. Press OK to proceed" 0 0
rm /mnt/sdb1/puppy606/adrv_tahr_6.0.6.sfs
mksquashfs /mnt/sdb1/puppyfilesystem /mnt/sdb1/puppy606/adrv_tahr_6.0.6.sfs -comp xz
rm -r /mnt/sdb1/puppyfilesystem

exit

Maybe something in my Boot menu.lst is prventing something ....

title Puppy tahr 6.0.6 (sdb1)
find --set-root --ignore-floppies --ignore-cd /puppy_tahr_6.0.6.sfs
kernel /vmlinuz pmedia=usbflash pfix=fsck,nocopy
initrd /initrd.gz

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#13 Post by nic007 »

backi wrote:Hi nic007
!
Did as you told me .
But no adrv will be created

This is my script .....maybe you have a look at it what could be wrong .

#!/bin/sh
mkdir /mnt/sdb1/puppyfilesystem
cp -a /initrd/pup_a/* /initrd/pup_rw/* /mnt/sdb1/puppyfilesystem
wait
cd /mnt/sdb1/puppyfilesystem
rm -r ./tmp ./mnt ./initrd ./sys ./root/.cache/* ./root/.thumbnails/* ./root/.Trash/* ./root/.XLOADED ./var/log
wait
Xdialog -center -msgbox "Puppyfilesystem ready. Check and edit if needed. Press OK to proceed" 0 0
rm /mnt/sdb1/puppy606/adrv_tahr_6.0.6.sfs
mksquashfs /mnt/sdb1/puppyfilesystem /mnt/sdb1/puppy606/adrv_tahr_6.0.6.sfs -comp xz
rm -r /mnt/sdb1/puppyfilesystem

exit

Maybe something in my Boot menu.lst is prventing something ....

title Puppy tahr 6.0.6 (sdb1)
find --set-root --ignore-floppies --ignore-cd /puppy_tahr_6.0.6.sfs
kernel /vmlinuz pmedia=usbflash pfix=fsck,nocopy
initrd /initrd.gz
According to your menu entry your puppy files are in /. In the script it's in a folder. You need to change that.

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#14 Post by backi »

Thanks nic007 !

Now your script does the job ......cool.... :D :D :D

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#15 Post by backi »

Hi nic007 !

Your elegant Script answers a lot of Questions mentioned here on this Thread :

http://www.murga-linux.com/puppy/viewtopic.php?t=109585

Cheers ! :)

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#16 Post by nic007 »

backi wrote:Hi nic007 !

Your elegant Script answers a lot of Questions mentioned here on this Thread :

http://www.murga-linux.com/puppy/viewtopic.php?t=109585

Cheers ! :)
Don't know about elegant but I'm glad it works for you. :)

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#17 Post by backi »

Hi nic007 !
Well, not so sophisticated but useful nevertheless. Just to add - if you have a savefile or savefolder, the script will include that data in the created sfs file (less browser cache and trash items, etc. unless you want to keep it). After running the script, you can rename your existing savefile/folder so that it doesn't load at next boot. If you are happy with the result you can delete the savefile/folder and never use one again. The script is an EXAMPLE and you need to adapt it according to your setup and needs.
How to accomplish including Savefile or Savefolder ..
As far as i understood your Script does not work/create adrv.sfs when Save/File/Folder is loaded at bootup .?

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#18 Post by nic007 »

backi wrote:Hi nic007 !
Well, not so sophisticated but useful nevertheless. Just to add - if you have a savefile or savefolder, the script will include that data in the created sfs file (less browser cache and trash items, etc. unless you want to keep it). After running the script, you can rename your existing savefile/folder so that it doesn't load at next boot. If you are happy with the result you can delete the savefile/folder and never use one again. The script is an EXAMPLE and you need to adapt it according to your setup and needs.
How to accomplish including Savefile or Savefolder ..
As far as i understood your Script does not work/create adrv.sfs when Save/File/Folder is loaded at bootup .?
Same script should work if you make sure the paths are correct. If your savefile/folder is big though, it's going to take longer to create the adrv to include that data.

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#19 Post by backi »

Thanks man :)

I think your cool Script should not get lost in somewhere in the Nowhere-Depths of the Forum .

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#20 Post by backi »

Sorry for steeling your precious time nic007 .

But tried with loaded SaveFOLDER at startup .......in this case the "puppyfilesystem" will not be created ....so no adrv.sfs .

Booting without SaveFOLDER loaded .........in this case the "puppyfilesystem" will e created ....so the adrv.sfs .

Post Reply