termux-tools: termux-restore: ensure that files/dirs have modes rw/rwx respectively

Some utilities (e.g. proot-distro) may produce read-only files in
$PREFIX which will make use of termux-restore impossible.
This commit is contained in:
Leonid Pliushch 2021-10-08 22:01:46 +03:00
parent 88be9114b1
commit dd65d4e50a
No known key found for this signature in database
GPG Key ID: 45F2964132545795

View File

@ -57,6 +57,10 @@ else
fi
fi
# Ensure that prefix doesn't contain read-only files.
find "@TERMUX_PREFIX@" -type d -print0 | xargs -0 -r chmod u+rwx
find "@TERMUX_PREFIX@" -type f -print0 | xargs -0 -r chmod u+rw
# --recursive-unlink is added intentionally to delete all orphan/extra files
# in $PREFIX. It must be restored to a clean state as in backup tarball.
tar -x -C "@TERMUX_BASE_DIR@" -f "$BACKUP_FILE_PATH" \