how to merge savfiles, preserving new, dicarding old versions?

Moderators: 666philb, Forum moderators

Post Reply
boof
Posts: 519
Joined: Sat Aug 15, 2020 9:17 am
Been thanked: 6 times

how to merge savfiles, preserving new, dicarding old versions?

Post by boof »

nb one is a ~save, one is ~save.4sf
need to preserve all ~save, add only ~save.4sf not in ~save
will save much wffort setting up new system startup.
verbose pls.

fernan
Posts: 112
Joined: Sat Sep 19, 2020 3:35 am
Has thanked: 39 times
Been thanked: 16 times

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by fernan »

Hello. One week later, not sure if you already solved this.

I think one way to do it would be to mount both save files (clicking on them), perhaps from a fresh session ignoring both save files at startup, and once both save files are mounted, synchronize both folders with the rsync command. There are options to copy only non existent files, or to override only if the source file is newer, and not deleting files in the destination folder not present in the source folder.

There are also options to delete files and create an exact duplicate of the source folder.

Please read the rsync documentation, it's a powerful tool. I use it all the time to sync and backup files.

I'd create duplicates or backups of your save files before trying this, just in case something goes wrong.

User avatar
mikeslr
Posts: 2850
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 173 times
Been thanked: 860 times

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by mikeslr »

One problem you should consider when merging 'SaveFile/Folders': If you uninstall a 'built-in' application --Menu>Setup>Remove Builtins-- that doesn't actually remove anything. Rather it writes a white-out file [.wh --note the dot signifying hidden]-- adjacent to the 'removed' file or folder which instructs Puppy not to use the 'removed file'. Only on Remaster which follows that instruction are the actual files/folders removed from the resulting build.
The .wh files are written to your SaveFile/Folder. When you merge SaveFiles folders they will be in the merged SaveFile/Folder and operational. So if in one SaveFile/Folder you whited out an application, but not on the other, and want the application you'll have to mount the resulting SaveFile/Folder, hunt for .wh files, delete them and repackage.

User avatar
mr_gs
Posts: 38
Joined: Tue Dec 14, 2021 6:39 am
Has thanked: 7 times
Been thanked: 8 times

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by mr_gs »

First of all sorry for the late reply
I've written an interactive python script for you(Extract the attachment). All you need to do it to mount both the save files in two locations and run the python script in terminal.
Open the terminal your downloads folder and type

Code: Select all

python3 merge_dir.py

Thats all :thumbup:

Attachments
merge_dir.py.tar.gz
(670 Bytes) Downloaded 24 times

Fossapup 9.5 64bit Kernel 5.4.53
Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
8GB RAM
Intel (R) UHD Graphics

User avatar
wiak
Posts: 3692
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 57 times
Been thanked: 1029 times
Contact:

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by wiak »

mikeslr wrote: Wed Apr 12, 2023 2:14 pm

One problem you should consider when merging 'SaveFile/Folders': If you uninstall a 'built-in' application --Menu>Setup>Remove Builtins-- that doesn't actually remove anything. Rather it writes a white-out file [.wh --note the dot signifying hidden]-- adjacent to the 'removed' file or folder which instructs Puppy not to use the 'removed file'. Only on Remaster which follows that instruction are the actual files/folders removed from the resulting build.
The .wh files are written to your SaveFile/Folder. When you merge SaveFiles folders they will be in the merged SaveFile/Folder and operational. So if in one SaveFile/Folder you whited out an application, but not on the other, and want the application you'll have to mount the resulting SaveFile/Folder, hunt for .wh files, delete them and repackage.

Yes, correct handling of white-out markers is the main part of the operation. Simply merging with the likes of rsync or similar is easy but simply not sufficient without whiteout-handling code, which is the tricky part of the coding algorithm.

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

User avatar
mr_gs
Posts: 38
Joined: Tue Dec 14, 2021 6:39 am
Has thanked: 7 times
Been thanked: 8 times

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by mr_gs »

wiak wrote: Thu Apr 13, 2023 7:39 am
mikeslr wrote: Wed Apr 12, 2023 2:14 pm

One problem you should consider when merging 'SaveFile/Folders': If you uninstall a 'built-in' application --Menu>Setup>Remove Builtins-- that doesn't actually remove anything. Rather it writes a white-out file [.wh --note the dot signifying hidden]-- adjacent to the 'removed' file or folder which instructs Puppy not to use the 'removed file'. Only on Remaster which follows that instruction are the actual files/folders removed from the resulting build.
The .wh files are written to your SaveFile/Folder. When you merge SaveFiles folders they will be in the merged SaveFile/Folder and operational. So if in one SaveFile/Folder you whited out an application, but not on the other, and want the application you'll have to mount the resulting SaveFile/Folder, hunt for .wh files, delete them and repackage.

Yes, correct handling of white-out markers is the main part of the operation. Simply merging with the likes of rsync or similar is easy but simply not sufficient without whiteout-handling code, which is the tricky part of the coding algorithm.

@wiak While merging two directories do I need to ignore .wh files in both the directories or just the old directory.

Fossapup 9.5 64bit Kernel 5.4.53
Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
8GB RAM
Intel (R) UHD Graphics

User avatar
amethyst
Posts: 2357
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 477 times

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by amethyst »

Why do you want to merge stuff when you can decide at bootup which save file/folder you want to use?

User avatar
wiak
Posts: 3692
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 57 times
Been thanked: 1029 times
Contact:

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by wiak »

mr_gs wrote: Fri Apr 14, 2023 3:42 am

@wiak While merging two directories do I need to ignore .wh files in both the directories or just the old directory.

It is as mikeslr suggested; basically it depends what you want I'd say. May be that in one savefile you had a particular app somewhere that you wanted, so there would not be a whiteout file. But in the other savefile you had, for your own reasons, wanted to delete same file in same directory position. And issue is you likely do not know everything that has been deleted, for whatever reason, by whiteout(s). Bear in mind that whatever whiteouts are in the resultant savefile are there for the purpose of whiting-out items in any of the underlying lower-layer read-only filesystems. If you were to remove all whiteouts as part of merging then nothing underneath would be whited-out, but if new version of any item appeared in savefile it would over-write underlying lower-layer versions. I suspect there is no easy answer - perhaps just try a simple merge using rsync and don't worry about what whiteouts are left in and see what the result is. You 'could' remove all whiteouts in the merged result, but then stuff will be active/available that you previously intended to be deleted; I can imagine that causing major issues since could include configuration file changes and difficult to fix it all again... hence maybe just rsync and accept all whiteouts to remain in the result is likeliest to work closer to what you hope for? I haven't done such a merge so remain unsure - perhaps someone else can provide some input from their own previous results of doing similar?

By the way, I don't know how Puppy Package manager works so don't know if merging will cause major issues. If it were some official package manager such as dpkg/apt of Debian/Ubuntu then I'm afraid merging probably going to mess up dpkg database when merging pretty much unrelated savefiles (different if a sequence of related rollback files, where only keeping the relevant sequence would be important). Does PPM keep some kind of database would thus be my question; if so, I wouldn't try to merge alternative savefiles/folders.

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

User avatar
mikeslr
Posts: 2850
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 173 times
Been thanked: 860 times

Re: how to merge savfiles, preserving new, dicarding old versions?

Post by mikeslr »

Of course, the white-out issue only applies to 'removed-builtins'. User-installed, then uninstalled applications don't use white-outs: the unwanted files/applications are actually uninstalled.

The short answer is that merging Saves involves a lot of manual hunting, with a great opportunity to make mistakes. Another reason that rather than remove builtins I just use PupMenu to turn off the display of unwanted applications. As I pointed out here, https://www.forum.puppylinux.com/viewto ... 4070#p4070 very little is gained by actually removing applications.

The only thing I do remove is the script or shortcut in /root/startup which causes conky to display on boot-up. I prefer pwidgets. That leaves just one white-out --and that at a known location-- to deal with. Well, two: for some reason executing a Save often writes a .wh file to /root/.thumbnails. When it's present rox won't show thumbnails. I certainly don't want to preserve that condition. Check before finally OKing Remaster.

Well, there is one thing I manually remove --mount, copy, pfind, delete, repack-- after I've remastered: whatever web-browser the dev built-in. Devs have to include some browser. But it won't be long before it's out-dated. There's no reason for me to preserve an out-dated web-browser. [In the rare instance when a specific web-browser is currently the only one which can be used because of computer limitations, I'll keep a copy in Storage for later installation. I'm an optimist. Maybe a better, newer, usable browser will become available].

As I'm not going to remove any application, I'll always start from scratch --the unmodified files of --in this case-- fossapup64_9.5.sfs-- and create a new SaveFile/Folder. But first I'll boot using my old Save and take a screenshot of what Menu>Setup>Puppy Package Manager>Uninstall tells me I have on my system now. With two Saves, both. Using it/them, I decide what will be in the new Save and ultimately remaster. As long as I'm going to build a Puppy I expect to use for a long time, this is also the time to search for more recent updates of applications: both user-installed and builtin. Tips: most new versions of applications will show up in The Additional Software Forum >Desktop, Filesystem and Utilities. Radky's newer versions of applications can all be found at, https://www.smokey01.com/radky/PupMates.html. Other than that, you'll know which applications you frequently use. Those you don't, don't require updating.

Post Reply

Return to “Fossapup64”