pupmode=67 - an indirect save mode, a bit like PUPMODE=13, but overlayfs compatible.
Please try it on a frugal install of a recent Puppy, on a Linux partition.
Required:
FrugalPup v20 or later, although best with FrugalPup v35.
Booting with "grub2" to accomodate a second "initrd" file.
Download files from https://www.mediafire.com/folder/j2u10wl713fky/pm66.
1. Download 'local-initrd.gz':
For Puppies released this year (2021) download 'local-initrd-woof.gz'.
For older Puppies download 'local-initrd-old.gz'. (This one works for me on Puppies as old as Xenialpup.)
Rename the downloaded file to 'local-initrd.gz' and place it in the install directory of the test Puppy.
2. Download 'local-pm67.sfs' and 'BOOT_SPECS' and place in the install directory.
3. Rename 'local-pm67.sfs' to be an 'ldrv_...sfs':
If your "zdrv" is 'zdrv_upuphh+d_21.04.sfs' rename 'local-pm67.sfs' to 'ldrv_upuphh+d_21.04.sfs'.
If your install directory is on a Linux partition you can use a symbolic link instead,
Code: Select all
ln -sf local-pm67.sfs ldrv_upuphh+d_21.04.sfs
4. Modify 'grub.cfg' to boot the test Puppy using 'local-initrd.gz':
If you have FrugalPup v35, you can generate a replacement boot-entry for the test Puppy with either "FrugalPup->Boot" or 'bootentry'.
Other wise you need to change the "initrd" line from:
Code: Select all
initrd /puppy/upuphh+d/initrd.gz
to
Code: Select all
initrd /puppy/upuphh+d/initrd.gz /puppy/upuphh+d/local-initrd.gz
5. Reboot.
The new 'init' script in 'local-initrd.gz' plus 'BOOT_SPECS' will enable the 'ldrv_...sfs' to be loaded.
Then run the CLI utility 'setup-pm67' ("setup-pm67 -h" for help), and reboot.
Select "SAVE".
6. '/etc/rc.d/PUPSTATE' should indicate that "PUPMODE=67".
Return to PUPMODE=12 using an existing "${DISTRO_FILE_PREFIX}save", by renaming the archive file so the 'init' script won't find it.
To return to PUPMODE=12 and keep the changes made in PUPMODE=67, run the CLI script 'savefolder67to12' ("savefolder67to12 -h" for help).
If the save directory is '/pups/upuphh+d' then
Code: Select all
savefolder67to12 /pups/upuphh+d
will produce '/pups/upuphh+d/upuphh+dsave.new'.
Rename '/pups/upuphh+d/upuphh+dsave.new' to '/pups/upuphh+d/upuphh+dsave', rename '/pups/upuphh+d/upuphh+dPM667save.tar.gz' to '/pups/upuphh+d/Xupuphh+dPM667save.tar.gz' and reboot.
How does it work?
It's a bit like PUPMODE=13, the RW layer is a tmpfs in RAM, and the top RO layer is a savefolder.
But unlike PUPMODE=13 this, savefolder called "${DISTRO_FILE_PREFIX}PM67save", remains truly RO.
Like PUPMODE=66, on shutdown the user is prompted to "SAVE" or not, if "SAVE" is selected the contents of the RW layer are saved into a "${DISTRO_FILE_PREFIX}PM667save.tar.gz" archive file,
then on next boot the contents of the archive are extracted into a tmpfs in RAM, before it is added to the stack.
Also before it is added to the stack, the savefolder is populated by moving all ordinary files from the tmpfs into it,
and then a new archive is produced because the RW layer in RAM is a lot smaller without all the ordinary files.
Why do it?
Because, while it is part of the stack, the savefolder is never modified, only read, even on shutdown.
This makes it compatible with using an overlayfs stack, whose RO layers are not allowed to be changed.
But it still ends up containing the bulk of the files that end up in the save layer, e.g. files from installed ".pet" files, etc...,
so the archive remains small, even after installing many ".pet" files, unlike PUPMODE=66.
The statement "moving all ordinary files" is significant;
a) the "moving" is what makes the archive smaller,
b) "all ordinary files" means that the savefolder contains only "ordinary" files, "whiteout" files and symbolic links remain in the RW layer in RAM, so theoretically in an overlayfs environment the savefolder could exist on non-Linux partitions.
RW="Read-Write"
RO="Read-Only"
Note: This is mainly a "proof of concept" at the moment.
Obviously 'setup-pm67' should be integrated into "Boot Manager" for a production environment.