WeeDog32-Void Manual Persistence Save Tools

Locked
User avatar
rockedge
Site Admin
Posts: 5724
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1997 times
Been thanked: 2099 times
Contact:

WeeDog32-Void Manual Persistence Save Tools

Post by rockedge »

After reviewing the post by @rufwoof here : http://murga-linux.com/puppy/viewtopic. ... 65#1035465
I've added the scripts save.sh and merge_changes to a WeeDog32 running on a VirtualBox machine.

I booted into the mode of upper_changes writing only to RAM by using the stanza:

Code: Select all

title WeeDog32-Void-2.8.5 (uuid)
  uuid 8a8ea99d-a1b0-4c43-b1a0-d4ce5c9c7dfa
  kernel /WeeDog32-Void-2.8.5/vmlinuz-5.9.16_1  w_bootfrom=/mnt/sdb1/WeeDog32-Void-2.8.5 w_changes=RAM  copy2ram
  initrd /WeeDog32-Void-2.8.5/initrd.gz

then I made a small script called makesave

Code: Select all

#!/bin/sh
cd /mnt/sdb1/WeeDog32-Void-2.8.5
/root/my-applications/bin/save.sh
xmessage Save Job Finished.... -center -timeout 4

which I dragged to the desktop pinboard and gave a nice icon. Now if I decide to keep the additions, changes or data from a session, a click on the icon will construct a XXchanges.sfs file that will be layered after the 01firstrib_root.sfs.
02changes.sfs
03changes.sfs
for example. Then merge_changes.sh can be run that will merge the XXchanges.sfs files into a single monolithic 02changes.sfs file.

So far the save functions well but merge_changes is buggy. Testing on a virtual machine.

I think these tools will be added to WeeDog32-Void in a perhaps more refined version, to provide the facility to choose whether or not to save the data from a session at all. Being able to shutdown the system and nothing remains is for actions like on line banking or buying with credit card numbers or PAYPAL (among others) ideal. Just as Puppy can provide this ability and adds to it's already strong suit of functions, this also shown as an example how it is done so anyone with an idea can improve on the code and method.

save.sh

Code: Select all

#!/bin/sh
# save.sh
# Create a sfs of upper changes in ram so that changes persist across reboots
# nnchanges.sfs where nn is 02, 03 ... etc.  Starts from 02changes.sfs as
# 01.. filename is reserved for the main sfs layer filename

NEXT=1
for nextlayer in `ls *changes.sfs | sort -V | cut -c1-2`; do
          if [ "$nextlayer" -ge 0 ]; then NEXT=$nextlayer; fi
done
NEXT=$(expr $NEXT + 1)
NEXT=$(printf "%02dchanges.sfs" $NEXT)  # add leading 0 if 2 to 9
mksquashfs /mnt/layers/RAM/upper_changes $NEXT -comp lz4 -Xhc -e var run mnt


merge-changes.sh

Code: Select all

#!/bin/bash
# merge-changes.sh

# Merge multiple xxchanges.sfs into one (02changes.sfs and all prior NNchanges.sfs
# changes sfs files are removed once merged)

# format of what we're looking to achieve .. (note that c is the lowest (first)
# i.e. should correspond to 02changes.sfs, b is the next lowest (03changes.sfs)
# and a is the highest (04changes.sfs)) ...
#    mount -t overlay overlay -o lowerdir=/mnt/L/a:/mnt/L/b:/mnt/L/c /mnt/L/m
# As we're mounting read only (to create a sfs from) we don't need upper or work
# Note that we mount each NNchanges.sfs to a mount point named the same
# i.e. /mnt/L/NNchanges.sfs, which are all merged into /mnt/L/m ... and
# we use that /mnt/L/m to create the new 02changes.sfs

mkdir /mnt/L
mkdir /mnt/L/m
unset lower

for addlayer in `ls *changes.sfs | sort -Vr`; do # sorted in reverse order
   [ -z $lower ] && lower=/mnt/L/${addlayer} || lower="${lower}:/mnt/L/${addlayer}"
   mkdir -p "/mnt/L/$addlayer"
   mount $addlayer /mnt/L/$addlayer
done
sync
mount -t overlay overlay -o lowerdir=$lower /mnt/L/m
mksquashfs /mnt/L/m CHANGES.sfs -comp lz4 -Xhc
sync
umount /mnt/L/m
umount /mnt/L/*changes.sfs  # release all mounted sfs's
sync
rmdir /mnt/L/*changes.sfs
rm -rf /mnt/L
rm *changes.sfs
mv CHANGES.sfs 02changes.sfs
User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Re: WeeDog32-Void Manual Persistence Save Tools

Post by wiak »

Yes, rufwoof did a good job with these and been meaning to look into their use and development for a long time. Good that you are working on these rockedge.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Locked

Return to “FirstRib (old archived info)”