Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEMPLATE.sh: Die, if BUILD_TMPDIR can't be removed
If we don't have the permissions to remove BUILD_TMPDIR (which is quite likely, when we switch from a test build with a personal user to one via tools/build.sh with the build user), the current code would ignore the fact, that the directory can't be removed and continue with a nonempty directory, possible running into permission problems later. We could just change chmod ... && rm -r ... to ( chmod ... ; rm -r ... ) and the shell would terminate when chmod fails due to permissions. However, the error message of chmod is different than that of rm: buczek@afk:~$ chmod u+w /root chmod: changing permissions of ‘/root’: Operation not permitted buczek@afk:~$ ls /root/ ls: cannot open directory /root/: Permission denied I think "Permission denied" is a bit clearer than "Operation not permitted". Ignore errors form `chmod` and try `rm` in any case, which either succeeds or aborts the script with an appropriate error message. Remove -c flag from chmod because we are not really interested if something has been changed or not.
- Loading branch information