From a47da8e3e0627fe242226fb37ce3586999d69fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Maldonado?= Date: Thu, 12 Sep 2024 16:48:22 +0200 Subject: [PATCH] Fix: do not run post-uninstall script on RPM update Fixes #544 --- script/electron-builder.js | 2 +- script/post-uninstall-rpm.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 script/post-uninstall-rpm.sh diff --git a/script/electron-builder.js b/script/electron-builder.js index 32718fdce7..fe55c30dd4 100644 --- a/script/electron-builder.js +++ b/script/electron-builder.js @@ -149,7 +149,7 @@ let options = { }, rpm: { afterInstall: "script/post-install.sh", - afterRemove: "script/post-uninstall.sh", + afterRemove: "script/post-uninstall-rpm.sh", compression: 'xz', fpm: ['--rpm-rpmbuild-define=_build_id_links none'] }, diff --git a/script/post-uninstall-rpm.sh b/script/post-uninstall-rpm.sh new file mode 100644 index 0000000000..f68d62c968 --- /dev/null +++ b/script/post-uninstall-rpm.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# https://github.com/pulsar-edit/pulsar/issues/544 +# This check works only for RPMs +if [ $1 -ge 1 ]; then + # Package upgrade, do not uninstall + exit 0 +fi + +PULSAR_SCRIPT_PATH='/usr/bin/pulsar' + +if [ -f "$PULSAR_SCRIPT_PATH" ] +then + rm "$PULSAR_SCRIPT_PATH" +fi + +PPM_SYMLINK_PATH='/usr/bin/ppm' + +if [ -L "$PPM_SYMLINK_PATH" ] +then + rm "$PPM_SYMLINK_PATH" +fi