-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rewrite data persisting #2897
rewrite data persisting #2897
Conversation
About those hard-links:Not all of those hard-linked files work. Like Witch Blast for example. (easy way to reproduce this problem) The Persist feature in generalMaybe adding more information about how to handle different data could be added to the Example which just came to my mind: "persist": [
{
"type": "file",
"name": "config.dat",
"content": "[Config]`nlanguage=eng",
"encoding": "UTF-8",
"method": "copy"
},
{
"type": "directory",
"name": "data",
"method": "link"
},
{
"type": "directory",
"name": "plugins",
"method": "merge"
}
] |
It looks like Everything also has the problem the same as Witch Blast. |
Added the trigger for closing issue #2900 , there is no further changes I can do for this pull-request. |
Data matters, please review
This is a rework of #2891 #2890 and #2882 . This will also fix #2724 and fix #2900 , close #2779
Introduction
I add a function called
unlink_persist_data($dir)
, which recursively unlink all junction/hard link in the given directory. This affects some sub-commands which have interaction with junction/hard link:scoop-install
: the persisting logic has been improved as follow:persist
folder, also in app(source
) folder, rename that one located in app folder (e.g. app's default setting files) with aoriginal
suffix, then create link frompersist
to apppersist
folder, but no in app(source
) folder, just create link frompersist
to apppersist
folder (e.g. fresh install), but there are data in app(source
) folder (e.g. app's default setting files), we will just use that default setting files as the first-time persisting. So move that files from app folder topersist
folder, then create link frompersist
to apppersist
folder (e.g. fresh install), nor in the app(source
) folder (e.g. setting files will be created after first startup, likeEverthing.db
). We need to create empty persisting target in thepersist
folder. But by default we can't know if a persisting target is a file or a directory (e.g.conf.d
). So we create a directory by default, and to avoid this, manifest maintainers should usepre_install
to manually create the source file before persisting.scoop-reset
:reset
command uses the logic ofinstall
, but there is a problem: before re-persisting data, there have beenjunction/hard link
in the app(source
) folder. It will throw an exception of file exists Persisting bug with already existing folder #2724 . To fix this, we should unlink all old link before re-persisting, usingunlink_persist_data
.scoop-uninstall
:Remove-Item
can not removeNTFS junction
, we need to unlink all persistting data, before uninstalling/deleting an app, but keeping persisting data.scoop-cleanup
: likeuninstall
,Remove-Item
can not removeNTFS junction
, we need to unlink all persistting data, before deleting old versions of an app. Before PR scoop-cleanup: handle with junction better #2882 , it usefsutil.exe
to unlink junction, which is not friendly to restricted users (scoop-cleanup is not friendly to restricted user #2832 and scoop-cleanup: Remove-Item : Index (zero based) must be greater than or equal to zero... #2881 ).Beyond the logic improvement, there is a new feature now: it supports sub-folder data persisting, like:
So no need to strip directories of source for target anymore.
To participate in the code review and tests, go visit https://github.com/h404bi/scoop-persist-test for test cases.