You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The README says: "If the file exists in persistent storage, it will be bind mounted to the target path; otherwise it will be symlinked."
Is there a specific reason for this behavior that I am missing out on? In my use case, some files spot the broken symlink, delete it, and replace it with their own file that ends up not being persisted. Wouldn't it make more sense to do:
...
if [[ -L"$mountPoint"&&$(readlink -f "$mountPoint")=="$targetFile" ]];then
trace "$mountPoint already links to $targetFile, ignoring"elif mount | grep -F "$mountPoint"''>/dev/null &&! mount | grep -F "$mountPoint"/ >/dev/null;then
trace "mount already exists at $mountPoint, ignoring"elif [[ -e"$mountPoint" ]];thenecho"A file already exists at $mountPoint!">&2exit 1
fiif [[ !-e"$targetFile" ]];then
touch "$targetFile"fi
touch "$mountPoint"
mount -o bind"$targetFile""$mountPoint"
Instead of:
...
if [[ -L"$mountPoint"&&$(readlink -f "$mountPoint")=="$targetFile" ]];then
trace "$mountPoint already links to $targetFile, ignoring"elif mount | grep -F "$mountPoint"''>/dev/null &&! mount | grep -F "$mountPoint"/ >/dev/null;then
trace "mount already exists at $mountPoint, ignoring"elif [[ -e"$mountPoint" ]];thenecho"A file already exists at $mountPoint!">&2exit 1
elif [[ -e"$targetFile" ]];then
touch "$mountPoint"
mount -o bind"$targetFile""$mountPoint"else
ln -s "$targetFile""$mountPoint"fi
I can open a PR if so :)
Thanks.
The text was updated successfully, but these errors were encountered:
I'm actually hitting an issue related to this behavior: a lot of software seems to replace symlink with raw files preventing those from being stored at all.
I could really use an option to specify the default content of the file if it doesn't exist in either place so it is ALWAYS bind-mounted.
Another option would be to create a oneshot .service triggered by a PathExists= to move the file into /persist and create bind mount as soon as it appears for the first time.
The
README
says: "If the file exists in persistent storage, it will be bind mounted to the target path; otherwise it will be symlinked."Is there a specific reason for this behavior that I am missing out on? In my use case, some files spot the broken symlink, delete it, and replace it with their own file that ends up not being persisted. Wouldn't it make more sense to do:
Instead of:
I can open a PR if so :)
Thanks.
The text was updated successfully, but these errors were encountered: