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

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

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

Post Reply