summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudia Pellegrino2023-07-09 12:11:24 +0200
committerClaudia Pellegrino2023-07-09 12:17:39 +0200
commit70859e8a72ca19da4c6e8bd4b8848d0f6a92faf1 (patch)
treeff9b5dbccac4a801bf06b673429ec402e1315882
parentdb211dccf7e51ec12e68bae7aab7b573e5446d0b (diff)
downloadaur-70859e8a72ca19da4c6e8bd4b8848d0f6a92faf1.tar.gz
Add support for executables which are not symlinks
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD6
-rw-r--r--electron-blur-me-not-patch.sh7
-rw-r--r--electron-blur-me-not-unpatch.sh13
4 files changed, 20 insertions, 10 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 5b224e290100..041f5bdd924c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -12,8 +12,8 @@ pkgbase = electron-blur-me-not
source = electron-flags.conf
source = electron-launcher.sh
sha512sums = 5057477e2155a61a110a106e66376137f19472df215383435885529f6d8fbdc533ad912cb6a964cc2c8112d93f2443540729c3877b2259268729040c860f4506
- sha512sums = 331d86cdb0d10a82dfae45331a34a22b2938895fe874b10433674f33f9aed851289ab8cbbba35fce38bae376bcd83c82537592ee17cdfd930c1bf1db3cef8748
- sha512sums = bbe9bcbd7b6f2cd50061ba56d3e123fb76c734f2a878a2d40f7cceb5e300ab5de2127628c450bb979a64fd14abd38b867e87b70e6269710f9f459431d5d46d59
+ sha512sums = 723e199194d1a000ed8a4802e7db14dee10bc34f55c10c89630ae9d84be9086b2ec6beb2a5bd805335a13384896b542e71a15c7e0a1b507862ce2c6ada1e46de
+ sha512sums = f9bed1185af1a409d6dfef9d9b46c5765ce9ac168385934be52d7e7fe4dd8f688116cc5dc7bf8f09c2620f229bd8fd696959748e0d044928ff281a4ef023be67
sha512sums = 5f623fe7d7d750b19072ba6bd3a0ab44a46f938040c4cdfa0d8ba5ec78e6345f0b3793a8fb8950a65c39d661d7a2ac4f1cffd5c981b96385729c4c05a6fd5f3a
sha512sums = fe94d357a5da3333beaa88d1dc9a02b75c6d07ab83d32029f8ac216e783cfc8a90f4bdad2b6e01a10d796228acface0896240528811def3cfee70c13d40807d1
diff --git a/PKGBUILD b/PKGBUILD
index bf10d8baad4a..5d60db5df61d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -34,8 +34,8 @@ source=(
sha512sums=(
'5057477e2155a61a110a106e66376137f19472df215383435885529f6d8fbdc533ad912cb6a964cc2c8112d93f2443540729c3877b2259268729040c860f4506'
- '331d86cdb0d10a82dfae45331a34a22b2938895fe874b10433674f33f9aed851289ab8cbbba35fce38bae376bcd83c82537592ee17cdfd930c1bf1db3cef8748'
- 'bbe9bcbd7b6f2cd50061ba56d3e123fb76c734f2a878a2d40f7cceb5e300ab5de2127628c450bb979a64fd14abd38b867e87b70e6269710f9f459431d5d46d59'
+ '723e199194d1a000ed8a4802e7db14dee10bc34f55c10c89630ae9d84be9086b2ec6beb2a5bd805335a13384896b542e71a15c7e0a1b507862ce2c6ada1e46de'
+ 'f9bed1185af1a409d6dfef9d9b46c5765ce9ac168385934be52d7e7fe4dd8f688116cc5dc7bf8f09c2620f229bd8fd696959748e0d044928ff281a4ef023be67'
'5f623fe7d7d750b19072ba6bd3a0ab44a46f938040c4cdfa0d8ba5ec78e6345f0b3793a8fb8950a65c39d661d7a2ac4f1cffd5c981b96385729c4c05a6fd5f3a'
'fe94d357a5da3333beaa88d1dc9a02b75c6d07ab83d32029f8ac216e783cfc8a90f4bdad2b6e01a10d796228acface0896240528811def3cfee70c13d40807d1'
)
@@ -66,11 +66,13 @@ _package() {
> "${pkgdir}/usr/share/${pkgname}/${_executable##*/}-launcher.sh"
sed \
-e "s#{{launcher}}#/usr/share/${pkgname}/${_executable##*/}-launcher.sh#g" \
+ -e "s#{{backup}}#${_executable}#g" \
-e "s#{{target}}#/usr/bin/${_executable##*/}#g" \
"${srcdir}/${pkgbase}-patch.sh" \
> "${pkgdir}/usr/share/libalpm/scripts/${pkgname}-patch"
sed \
-e "s#{{executable}}#${_executable}#g" \
+ -e "s#{{pkgname}}#${pkgname}#g" \
-e "s#{{target}}#/usr/bin/${_executable##*/}#g" \
"${srcdir}/${pkgbase}-unpatch.sh" \
> "${pkgdir}/usr/share/libalpm/scripts/${pkgname}-unpatch"
diff --git a/electron-blur-me-not-patch.sh b/electron-blur-me-not-patch.sh
index 43428546a2b6..1d2c267fad1a 100644
--- a/electron-blur-me-not-patch.sh
+++ b/electron-blur-me-not-patch.sh
@@ -6,9 +6,10 @@ if [[ ! -e '{{launcher}}' ]]; then
fi
if [[ ! -L '{{target}}' ]]; then
- echo >&2 'Not modifying {{target}} because it is not a symlink.'
- exit 0
+ echo >&2 'Moving {{target}} out of the way so we can create a symlink.'
+ mkdir -pv "$(dirname '{{backup}}')"
+ mv -fv '{{target}}' '{{backup}}'
fi
-# Modify symlink so it points to the launcher script
+# Create or modify symlink so it points to the launcher script
exec ln -fnsv '{{launcher}}' '{{target}}'
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