From dd65d4e50aae2086d92b3ee75ceccdf731b6b098 Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Fri, 8 Oct 2021 22:01:46 +0300 Subject: [PATCH] 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. --- packages/termux-tools/termux-restore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/termux-tools/termux-restore b/packages/termux-tools/termux-restore index 1482ae96c..4ce2f3fc6 100755 --- a/packages/termux-tools/termux-restore +++ b/packages/termux-tools/termux-restore @@ -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" \