fix destore

This commit is contained in:
2025-02-21 21:51:59 +01:00
parent c034fdeb6f
commit f54c1d8649

View File

@@ -1,8 +1,7 @@
destore() {
for dst in "$@"; do
local MAYBESUDO=""
if test ! -w "$(realpath --no-symlinks $dst)" \
|| test ! -w "$(basename "$(realpath --no-symlinks $dst)")"; then
if test ! -w "$(dirname $(realpath --no-symlinks $dst))" ; then
MAYBESUDO="sudo"
sudo true || {
>&2 echo "ERROR: could not destore '$dst' due to lack of sudo"