summarylogtreecommitdiffstats
path: root/electron-blur-me-not-unpatch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'electron-blur-me-not-unpatch.sh')
-rw-r--r--electron-blur-me-not-unpatch.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/electron-blur-me-not-unpatch.sh b/electron-blur-me-not-unpatch.sh
index 2e5e6198e42f..37a04633d0bb 100644
--- a/electron-blur-me-not-unpatch.sh
+++ b/electron-blur-me-not-unpatch.sh
@@ -10,6 +10,13 @@ if [[ ! -L '{{target}}' ]]; then
exit 0
fi
-# Modify symlink so it points to the original executable
-echo >&2 'Restoring original {{target}}'
-exec ln -fnsv '{{executable}}' '{{target}}'
+# shellcheck disable=SC2193 # these are just template placeholders
+if [[ '{{executable}}' == *'/{{pkgname}}/'* ]]; then
+ # Move original executable back into place
+ mv -fv '{{executable}}' '{{target}}'
+ rmdir -pv --ignore-fail-on-non-empty "$(dirname '{{executable}}')"
+else
+ # Modify symlink so it points to the original executable
+ echo >&2 'Restoring original {{target}}'
+ ln -fnsv '{{executable}}' '{{target}}'
+fi