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

#31 Post by nic007 »

corvus wrote:
nic007 wrote:BTW - Why did you include /initrd/pup_ro1 in your first script?
Because I want to include my savefolder stuff in "adrv" and when I run puppy with savefolder /initrd/pup_a/ is only an empty folder as shown in screenshot 1, the savefolder stuff are stored in /initrd/mnt/dev_save/tahr64/tahr64save and /initrd/pup_ro1 is a symlink to that folder as shown in screenshot 2.
Strange. In my Tahr605 /initrd/pup_rw is a symlink to the savefolder. But it worked for you so all well. Did you see my prior post with regards to booting SFS files automatically?

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

#32 Post by nic007 »

Added another dialog box to script to indicate that operation is completed, see first post.
Last edited by nic007 on Sat 25 Feb 2017, 04:29, edited 1 time in total.

User avatar
corvus
Posts: 153
Joined: Fri 12 Jun 2015, 18:00
Location: In the peninsula shaped like a boot.

#33 Post by corvus »

nic007 wrote: Did you see my prior post with regards to booting SFS files automatically?
Yes I did and I'll try to create an ydrv from the sfs I need although I think it is better to put a command in /etc/rc.d/rc.local, as you suggested, but don't know what command, can you give me some tips?

Thanks in advance.

Best regards.
[b]We are waves of the same sea, leaves of the same tree, flowers of the same garden.[/b]

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

#34 Post by nic007 »

corvus wrote:
nic007 wrote: Did you see my prior post with regards to booting SFS files automatically?
Yes I did and I'll try to create an ydrv from the sfs I need although I think it is better to put a command in /etc/rc.d/rc.local, as you suggested, but don't know what command, can you give me some tips?

Thanks in advance.

Best regards.
Example:

Code: Select all

sfs_load -c -q /mnt/sda3/Opera11.sfs
You can add several with the same command. If you only have one sfs to load you can just rename it to the name of the ydrv of course and move it to the directory where your other puppy files are located.

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

#35 Post by backi »

Hi corvus !
Tested your script with Savefolder

#!/bin/sh
mkdir /mnt/home/puppyfilesystem
cp -a /initrd/pup_ro1/* /initrd/pup_rw/* /mnt/home/puppyfilesystem
wait
cd /mnt/home/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/home/tahr64/adrv_tahr64_6.0.5.sfs
mksquashfs /mnt/home/puppyfilesystem /mnt/home/tahr64/adrv_tahr64_6.0.5.sfs -comp xz
rm -r /mnt/home/puppyfilesystem

exit
Now works .......with Savefolder loaded .....

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

#36 Post by nic007 »

backi wrote:Hi corvus !
Tested your script with Savefolder

#!/bin/sh
mkdir /mnt/home/puppyfilesystem
cp -a /initrd/pup_ro1/* /initrd/pup_rw/* /mnt/home/puppyfilesystem
wait
cd /mnt/home/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/home/tahr64/adrv_tahr64_6.0.5.sfs
mksquashfs /mnt/home/puppyfilesystem /mnt/home/tahr64/adrv_tahr64_6.0.5.sfs -comp xz
rm -r /mnt/home/puppyfilesystem

exit
Now works .......with Savefolder loaded .....
Right, tested with a usb drive/ssd card and indeed in this case /initrd/pup_ro1 must be included. I also copied some files to root and noticed that it's recorded in /initrd/pup_ro1 and not in /initrd/pup_rw. The question is now whether it's necessary to also include /initrd/pup_rw when you are running with usbdrive and savefolder/file to capture the contents of the savefile/folder. Can someone test and give us a definite answer so that I can make a few notes accordingly in the first post. Thanks

Edit: I've decided to make one uniform script which will give the desired result and to limit confusion.

User avatar
corvus
Posts: 153
Joined: Fri 12 Jun 2015, 18:00
Location: In the peninsula shaped like a boot.

#37 Post by corvus »

backi wrote:Hi corvus !
Tested your script with Savefolder

#!/bin/sh
mkdir /mnt/home/puppyfilesystem
cp -a /initrd/pup_ro1/* /initrd/pup_rw/* /mnt/home/puppyfilesystem
wait
cd /mnt/home/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/home/tahr64/adrv_tahr64_6.0.5.sfs
mksquashfs /mnt/home/puppyfilesystem /mnt/home/tahr64/adrv_tahr64_6.0.5.sfs -comp xz
rm -r /mnt/home/puppyfilesystem

exit
Now works .......with Savefolder loaded .....
I'm glad it works for you but it's not my script, I have only tweaked nic007's script in accordance with what he himself recommended to do on several post.
nic007 wrote:.....
Put your sfs-addons in your ydrv like I do and/or add to your zdrv so they are loaded automatically at startup OR load them automatically by way of including a command in /etc/rc.d/rc.local. :)
.....
I chose to edit the /etc/rc.d/rc.local file as you suggested me to do. Thanks again nic007 for your tips.
nic007 wrote:.....
The question is now whether it's necessary to also include /initrd/pup_rw when you are running with usbdrive and savefolder/file to capture the contents of the savefile/folder.
......
I think that /initrd/pup_rw contains the changes made during the session, include it or exclude it depends on whether or not you want to save the changes made during the session, and not permanently saved, in the new adrv file.

Regards.
[b]We are waves of the same sea, leaves of the same tree, flowers of the same garden.[/b]

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

#38 Post by nic007 »

corvus wrote:
backi wrote:Hi corvus !
Tested your script with Savefolder

#!/bin/sh
mkdir /mnt/home/puppyfilesystem
cp -a /initrd/pup_ro1/* /initrd/pup_rw/* /mnt/home/puppyfilesystem
wait
cd /mnt/home/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/home/tahr64/adrv_tahr64_6.0.5.sfs
mksquashfs /mnt/home/puppyfilesystem /mnt/home/tahr64/adrv_tahr64_6.0.5.sfs -comp xz
rm -r /mnt/home/puppyfilesystem

exit
Now works .......with Savefolder loaded .....
I'm glad it works for you but it's not my script, I have only tweaked nic007's script in accordance with what he himself recommended to do on several post.
nic007 wrote:.....
Put your sfs-addons in your ydrv like I do and/or add to your zdrv so they are loaded automatically at startup OR load them automatically by way of including a command in /etc/rc.d/rc.local. :)
.....
I chose to edit the /etc/rc.d/rc.local file as you suggested me to do. Thanks again nic007 for your tips.
nic007 wrote:.....
The question is now whether it's necessary to also include /initrd/pup_rw when you are running with usbdrive and savefolder/file to capture the contents of the savefile/folder.
......
I think that /initrd/pup_rw contains the changes made during the session, include it or exclude it depends on whether or not you want to save the changes made during the session, and not permanently saved, in the new adrv file.

Regards.
It's only when you have a savefile/folder loaded when using a pendrive that the session is saved to /initrd/pup_ro1 and not /initrd/pup_rw . I checked it. Only usb drives work this way. No savefile/folder and all other cases /initrd/pup_ro1 stays empty. So it's an exception. In all other cases you only need to copy initrd/pup_rw. It's good that you pointed out the use of /initrd/pup_ro1 with pendrive and savefile/folder, I didn't know that. Once you don't load any savefile/folder with USB /initrd/pup_rw saves session changes.

kerl
Posts: 154
Joined: Tue 16 Apr 2013, 21:15

#39 Post by kerl »

Hi Nick. Thanks for sharing :)
Could you elaborate Step 5 ?
What happens if there is a power outage before running the script?
On shutdown, if a savefile cannot be found, won't Puppy nag with a dialog asking to create one? as when one runs Puppy for the first time

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

#40 Post by nic007 »

kerl wrote:Hi Nick. Thanks for sharing :)
Could you elaborate Step 5 ?
What happens if there is a power outage before running the script?
On shutdown, if a savefile cannot be found, won't Puppy nag with a dialog asking to create one? as when one runs Puppy for the first time
Hi, kerl

Step 5 - If you have your savefile/folder loaded the path to your puppy files will most probably be /mnt/home.... The script assumes this is the case at the first run of the script to save the contents of your savefile/folder. If no savefiles/folder are loaded or none are available this path will change, so you have to edit the script accordingly.

Power outage - you will lose any system changes for that particular session. You can of course run the script at anytime during a session to capture changes in which case you will only lose changes that occurred after the capture.

Yes the save screen will popup by default at reboot/shutdown however you can use one of the following methods:
- Rename the shutdownconfig script found in /usr/sbin to something like 1shutdownconfig (you keep this as a backup). Create a new empty script called shutdownconfig. In this case the saving dialog will not appear at all and reboot/shutdown will follow without issues.
- Edit the timeout seconds in the shutdownconfig script to something like 3 seconds. In this case the save dialog will only appear for 3 seconds before reboot/shutdown commence automatically.

If not using one of the abovementioned methods, you will need to select "No" everytime.

kerl
Posts: 154
Joined: Tue 16 Apr 2013, 21:15

#41 Post by kerl »

Thanks nic007,
I have to check out why my official Slacko takes so long to boot. I must have a ton of hidden things to boot from a meager 1gb ram. I really need a bathtub

jd7654
Posts: 296
Joined: Mon 06 Apr 2015, 16:10

#42 Post by jd7654 »

I was trying something similar, albeit manually without the script, with Slacko 5.7 on an old computer.

The setup is to load normally with savefile, but selecting boot option with pfix=ram loads only base system plus extra software and configs for wireless networking and other personalizations in a zdrv. Basically having a clean read-only environment available on demand for security purposes.

Only problem was a few configs were missing. Not sure of the layers: assuming it was because the zdrv is under the base sfs? What Puppy versions have adrv loaded by default, and is that on top of base sfs layer?

The Quirky frugal mode actually works great with the s.sfs for this purpose, plus having a save button. Was also wondering if the Puppy desktop save button could be integrated into this somehow.

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

#43 Post by nic007 »

jd7654 wrote:I was trying something similar, albeit manually without the script, with Slacko 5.7 on an old computer.

The setup is to load normally with savefile, but selecting boot option with pfix=ram loads only base system plus extra software and configs for wireless networking and other personalizations in a zdrv. Basically having a clean read-only environment available on demand for security purposes.

Only problem was a few configs were missing. Not sure of the layers: assuming it was because the zdrv is under the base sfs? What Puppy versions have adrv loaded by default, and is that on top of base sfs layer?

The Quirky frugal mode actually works great with the s.sfs for this purpose, plus having a save button. Was also wondering if the Puppy desktop save button could be integrated into this somehow.
Yes with older puppys the base sfs takes preference to the zdrv that's why you have to do the swop as suggested in my first post. In newer puppys (tahr, etc.) the adrv and ydrv takes preference to the base sfs and the zdrv which works nicely. The file DISTRO_SPECS found in /etc will generally give an indication if your distribution support the adrv/ydrv. Call the script save (or whatever), select an icon for it and drag to desktop. Delete the old save icon from desktop. To run the script then just click on the icon on your desktop. This method replaces the use of a savefile. BTW - Don't know if this will work with Quirky. Quirky is an experimental release with some things that may or not work like the standard puppys, never tried it myself.

jd7654
Posts: 296
Joined: Mon 06 Apr 2015, 16:10

#44 Post by jd7654 »

Tried the base sfs and zdrv swap with Racy 5.5 and screen freaked out with fuzzy lines during bootup, but eventually the desktop appeared and all seemed normal. Don't know what causes that.

With Slacko 5.7 the zdrv swap worked as expected, no difference to normal boot.

jd7654
Posts: 296
Joined: Mon 06 Apr 2015, 16:10

#45 Post by jd7654 »

Tested a few Puppies I had installed with test savefiles I had for another purpose, to be able to quickly test.

For newer adrv pups, Tahr 6.0.5 and Slacko 6.3.2 seemed to work OK, but noticed a bit of slowness. Not sure if sign of problems to come. Xenial 7.0.3 partially worked on the first run, but then after the 2nd run started to fail with missing panel and menus. I think something is corrupted.

For older pups with the zdrv swap, Precise 5.7.1 always reverts to Xorg Wizard. Slacko 5.7.0 seems to work the best, seems normal. Racy 5.5 worked but required a few workarounds in the script.

I think one major thing is the danger of running this script on VFAT/Fat32 frugal install. And not sure how much NTFS is fully compliant. I made a change in the Racy test to use a Linux filesystem instead of the vfat on /mnt/home, and then it seemed to work OK.

Probably a lot to ask of a single script to account for all situations and pup versions. Even individual Puppies have many workarounds in the save scripts like snapmergepuppy, etc. And even now Quirky 8.1.6 frugal persistence is broken, so it's par for the course.

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

#46 Post by nic007 »

jd7654 wrote:Tested a few Puppies I had installed with test savefiles I had for another purpose, to be able to quickly test.

For newer adrv pups, Tahr 6.0.5 and Slacko 6.3.2 seemed to work OK, but noticed a bit of slowness. Not sure if sign of problems to come. Xenial 7.0.3 partially worked on the first run, but then after the 2nd run started to fail with missing panel and menus. I think something is corrupted.

For older pups with the zdrv swap, Precise 5.7.1 always reverts to Xorg Wizard. Slacko 5.7.0 seems to work the best, seems normal. Racy 5.5 worked but required a few workarounds in the script.

I think one major thing is the danger of running this script on VFAT/Fat32 frugal install. And not sure how much NTFS is fully compliant. I made a change in the Racy test to use a Linux filesystem instead of the vfat on /mnt/home, and then it seemed to work OK.

Probably a lot to ask of a single script to account for all situations and pup versions. Even individual Puppies have many workarounds in the save scripts like snapmergepuppy, etc. And even now Quirky 8.1.6 frugal persistence is broken, so it's par for the course.
Your working puppyfilesystem must always be in a linux environment (partition) or RAM if you have enough. Works perfectly for me as is in Racy5.5 and Tahr605. If you have problems with the script, it will be best to do a proper remaster first and then use the script furtheron. This is not a remaster script. It's impossible for me to know the condition of your savefile. BTW- It's possible to do this in a non-linux partition by creating a linux environment within.

jd7654
Posts: 296
Joined: Mon 06 Apr 2015, 16:10

#47 Post by jd7654 »

I think it's helpful to show the basic method, but maybe some caveats can be given like expected filesystem type, etc. Many Puppy frugal installs on Windows partitions.(like mine are)

Also, just wondering about the differences in the new and old scripts for the file/directory exclusions:

diff:
< rm -r ./tmp ./mnt ./initrd ./sys ./root/.cache/* ./root/.thumbnails/* ./root/.Trash/* ./root/.XLOADED ./var/log
> rm -r ./tmp ./initrd ./mnt ./sys ./root/.Trash/* ./root/.cache/* ./etc/.XLOADED ./var/log

Was that tuned specifically for Tahr 6.0.5 and Racy 5.5? I did seem to work for Racy 5.5, but I did have to change ./etc/.XLOADED to ./root/.XLOADED for Slacko 5.7.0 to not have the X improper shutdown warning.

I also tried again with the most problem test with Xenial 7.0.3, and moved it from NTFS to Ext4 partition. Same problems with menu and panel disappearing on 2nd run. Something is causing a problem for it being moved into sfs.

BTW, I'm using a slightly modified version of the script with variables to be more generic so can test across different versions, and added mount so that it works on 2nd run also when no savefile or /mnt/home is existing. Works OK with Tahr and Slacko 6.3.2:

Code: Select all

#!/bin/sh
. /etc/DISTRO_SPECS
. /etc/rc.d/PUPSTATE
PUPSFSFILE=`echo $DISTRO_ADRVSFS | tr -d "'"`
PUPSFSDIR=`echo $PSUBDIR | tr -d "'"`
PUPSFSHD=`echo $PDEV1 | tr -d "'"`

mkdir /mnt/home
mount /dev/$PUPSFSHD /mnt/home
mkdir /mnt/home/puppyfilesystem
cp -a /initrd/pup_a/* /initrd/pup_ro1/* /initrd/pup_rw/*  /mnt/home/puppyfilesystem
wait
cd /mnt/home/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 when ready" 0 0
rm /mnt/home$PUPSFSDIR/$PUPSFSFILE
mksquashfs /mnt/home/puppyfilesystem /mnt/home$PUPSFSDIR/$PUPSFSFILE
rm -r /mnt/home/puppyfilesystem
wait
Xdialog -center -title "SUCCESS!!!"  --no-buttons -infobox "Operation completed, exiting now" 0 0 3000

exit
Edit: corrected wrong code posted, old puppy code versus new puppy code, 3 lines different.
Last edited by jd7654 on Tue 14 Mar 2017, 02:41, edited 1 time in total.

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

#48 Post by nic007 »

jd7654 wrote:I think it's helpful to show the basic method, but maybe some caveats can be given like expected filesystem type, etc. Many Puppy frugal installs on Windows partitions.(like mine are)

Also, just wondering about the differences in the new and old scripts for the file/directory exclusions:

diff:
< rm -r ./tmp ./mnt ./initrd ./sys ./root/.cache/* ./root/.thumbnails/* ./root/.Trash/* ./root/.XLOADED ./var/log
> rm -r ./tmp ./initrd ./mnt ./sys ./root/.Trash/* ./root/.cache/* ./etc/.XLOADED ./var/log

Was that tuned specifically for Tahr 6.0.5 and Racy 5.5? I did seem to work for Racy 5.5, but I did have to change ./etc/.XLOADED to ./root/.XLOADED for Slacko 5.7.0 to not have the X improper shutdown warning.

I also tried again with the most problem test with Xenial 7.0.3, and moved it from NTFS to Ext4 partition. Same problems with menu and panel disappearing on 2nd run. Something is causing a problem for it being moved into sfs.

BTW, I'm using a slightly modified version of the script with variables to be more generic so can test across different versions, and added mount so that it works on 2nd run also when no savefile or /mnt/home is existing. Works OK with Tahr and Slacko 6.3.2:

Code: Select all

#!/bin/sh
. /etc/DISTRO_SPECS
. /etc/rc.d/PUPSTATE
PUPSFSFILE=`echo $DISTRO_PUPPYSFS | tr -d "'"`
PUPSFSDIR=`echo $PSUBDIR | tr -d "'"`
PUPSFSHD=`echo $PDEV1 | tr -d "'"`

mkdir /mnt/home
mount /dev/$PUPSFSHD /mnt/home

mkdir /mnt/home/puppyfilesystem
cp -a /initrd/pup_ro2/* /initrd/pup_ro1/* /initrd/pup_rw/*  /mnt/home/puppyfilesystem
wait
cd /mnt/home/puppyfilesystem
rm -r ./tmp ./initrd ./mnt ./sys ./root/.Trash/* ./root/.cache/* ./root/.XLOADED ./var/log 
wait
Xdialog -center -msgbox "Puppyfilesystem ready. Check and edit if needed. Press OK when ready" 0 0
rm /mnt/home$PUPSFSDIR/$PUPSFSFILE
mksquashfs /mnt/home/puppyfilesystem /mnt/home$PUPSFSDIR/$PUPSFSFILE
rm -r /mnt/home/puppyfilesystem
wait
Xdialog -center -title "SUCCESS!!!"  --no-buttons -infobox "Operation completed, exiting now" 0 0 3000

exit
Yes, XLOADED is in /etc for older puppys and in /root for newer puppy's it seems. The script is an example and can be used as a base for your own ideas, etc. I hope it is useful in that regard. I only tested it with the puppys I use Racy and Tahr

jd7654
Posts: 296
Joined: Mon 06 Apr 2015, 16:10

#49 Post by jd7654 »

nic007 wrote: Yes, XLOADED is in /etc for older puppys and in /root for newer puppy's it seems. The script is an example and can be used as a base for your own ideas, etc. I hope it is useful in that regard. I only tested it with the puppys I use Racy and Tahr
Yes it was useful to learn some new tricks. Thanks.
But I'm figuring out the persistence is a bit more complicated than I thought. Looking at some of Barry's and others various save scripts, there is a fair amount of workarounds to make it work on a live system.

Currently, I'm still just using a (closed) save file dumped into an sfs file, done offline, which seems to work fine for my purposes previously stated. I can update by dumping back but that is a lot of steps. Would be nice if Puppy had the option for sfs save storage like Quirky frugal does. That would be ideal.

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

#50 Post by nic007 »

jd7654 wrote:
nic007 wrote: Yes, XLOADED is in /etc for older puppys and in /root for newer puppy's it seems. The script is an example and can be used as a base for your own ideas, etc. I hope it is useful in that regard. I only tested it with the puppys I use Racy and Tahr
Yes it was useful to learn some new tricks. Thanks.
But I'm figuring out the persistence is a bit more complicated than I thought. Looking at some of Barry's and others various save scripts, there is a fair amount of workarounds to make it work on a live system.

Currently, I'm still just using a (closed) save file dumped into an sfs file, done offline, which seems to work fine for my purposes previously stated. I can update by dumping back but that is a lot of steps. Would be nice if Puppy had the option for sfs save storage like Quirky frugal does. That would be ideal.
But that is exactly what I tried to achieve here and it works for me. Are you following the instructions correctly? What are your main issues which you encounter with this method? How does Quirky's method work?

Post Reply