Replace your savefile/folder with an sfs storage file

How to do things, solutions, recipes, tutorials
Message
Author
backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#21 Post by backi »

Another observation is .....when starting fresh or booting with pfix=ram frugally from Usb-Stick ......If Usb-stick is not mounted .
When executing your script it does not work until Usb-Stick is mounted manually .

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

#22 Post by nic007 »

backi wrote: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 .
The directories when you boot with a savefolder and when you boot without savefolder may be different. Booting with a savefile/folder may give you a mnt/home directory. Check and change the script accordingly. Your stck must be mounted because you are writing data to the stick.

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

#23 Post by backi »

When booting with Savefolder loaded at bootup
I replaced in my case sdb1 with home in the script ....now adrive will be created .
But looking in puppyfilesystem Folder in Usb Stick alot of Directories are missing opt for example
Creating the adrive is happening after modifying my script but a lot of .....Rebooted
but it seems it will not work correctly . Seems it will not work with loaded Savefolder as a kind of saving or remastering the whole running System into an adrive .
Maybe one have to copy Folder root and Folder etc into tmp as in the remaster procedure .

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

#24 Post by nic007 »

backi wrote:When booting with Savefolder loaded at bootup
I replaced in my case sdb1 with home in the script ....now adrive will be created .
But looking in puppyfilesystem Folder in Usb Stick alot of Directories are missing opt for example
Creating the adrive is happening after modifying my script but a lot of .....Rebooted
but it seems it will not work correctly . Seems it will not work with loaded Savefolder as a kind of saving or remastering the whole running System into an adrive .
Maybe one have to copy Folder root and Folder etc into tmp as in the remaster procedure .
How did you install your programs, are you using any sfs-addons? This script only includes stuff that were installed to savefile/savefolder

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

#25 Post by backi »

Thanks for your support .
But for me it seems not to work with a Savefolder loaded at Startup.....for what reason ever .In the moment i find it to complicated to research deeper into this type of Replacement for a Savefolder .
On the first sight looked like an easy alternative for a Save/folder/file... but seems not to work the way i expected ....its not your fault .

I myself don`t have any Problems with Save File/Folder ......nevertheless ....find your script quite interesting .

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#26 Post by gyro »

backi wrote: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
I'm surprised that the script works reliably with "pfix=nocopy" in the boot entry.

Usually the "init" script copies these sfs files into a tmpfs in ram and uses those. So the adrv on disk is not in use and so can be deleted and recreated, and the affect is not seen until the next boot.

But, with "pfix=nocopy", these sfs files are not copied and the ones on disk are mounted and active in the aufs stack. So I'm surprised that deleting and re-creating such a file works reliably.

But hey, if it works for you, go for it.

Hmm.., you could be saved by Unix/Linux.
An open file can be "deleted" and the process retains access to the file via it's "inode" until it closes the file, only then does the file actually go away.
So perhaps the aufs stack continues to use the "deleted" copy of the adrv file.

gyro

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

#27 Post by corvus »

Hi all, following my experience about:

Puppy booted from USB key with savefolder:

Code: Select all

#!/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
"adrv" created successfully, in my case 18MB in 10 seconds.

Rebooted and reloaded puppy with pfix=ram, during boot "adrv" loaded with success, mounted sdb1 (my USB stick) and renamed my savefolder "1tahr64save".

At this point I changed again nic007's script in order to save any changes.

Code: Select all

#!/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/tahr64/adrv_tahr64_6.0.5.sfs
mksquashfs /mnt/sdb1/puppyfilesystem /mnt/sdb1/tahr64/adrv_tahr64_6.0.5.sfs -comp xz
rm -r /mnt/sdb1/puppyfilesystem

exit
The only drawback with this method is that you have to load on the fly your .sfs file and configuring them each time.

Thank's for your work nic007 much appreciated.
Last edited by corvus on Fri 24 Feb 2017, 19:41, edited 1 time in total.
[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

#28 Post by nic007 »

backi wrote:Thanks for your support .
But for me it seems not to work with a Savefolder loaded at Startup.....for what reason ever .In the moment i find it to complicated to research deeper into this type of Replacement for a Savefolder .
On the first sight looked like an easy alternative for a Save/folder/file... but seems not to work the way i expected ....its not your fault .

I myself don`t have any Problems with Save File/Folder ......nevertheless ....find your script quite interesting .
Do a proper remaster and then use the script from then on to record your changes in future. The other thing is that this should definitely work with a current savefile, perhaps the same can not be achieved with a savefolder (although I can not see why not). This is not a remaster script as such that's why I asked the questions. I don't install anything but use sfs add-ons instead. So I have the base sfs, sfs-addons (additional programs) which gets loaded automatically at boot and then my adrv with personal changes (about 5MB). Personally I hate big savefile/folders but some like them. Works a treat for me but each to their own.

BTW - I seem to remember from long ago when I still did remasters that somehow /opt (normally the java installation) does not copy from /initrd/pup_rw so you will have to copy it from the main running system located at /opt if you want to save that data from your savefolder to your adrv. You only need to do this once of course.
Last edited by nic007 on Fri 24 Feb 2017, 21:29, edited 1 time in total.

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

#29 Post by nic007 »

corvus wrote:Hi all, following my experience about:

Puppy booted from USB key with savefolder:

Code: Select all

#!/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
"adrv" created successfully, in my case 18MB in 10 seconds.

Rebooted and reloaded puppy with pfix=ram, during boot "adrv" loaded with success, mounted sdb1 (my USB stick) and renamed my savefolder "1tahr64save".

At this point I changed again nic007's script in order to save any changes.

Code: Select all

#!/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/tahr64/adrv_tahr64_6.0.5.sfs
mksquashfs /mnt/sdb1/puppyfilesystem /mnt/sdb1/tahr64/adrv_tahr64_6.0.5.sfs -comp xz
rm -r /mnt/sdb1/puppyfilesystem

exit

The only drawback with this method is that you have to load on the fly your .sfs file and configuring them each time.

Thank's for your work nic007 much appreciated.
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. :)
BTW - Why did you include /initrd/pup_ro1 in your first script?

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

#30 Post by corvus »

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.
Attachments
Screenshot_1.png
(28.65 KiB) Downloaded 373 times
Screenshot_2.png
(22.94 KiB) Downloaded 371 times
[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

#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.

Post Reply