From 0bc841a4ff370b080c439b884ab1b4eee2225cff Mon Sep 17 00:00:00 2001 From: Jason Farrar Date: Fri, 11 Sep 2026 07:46:55 +0100 Subject: [PATCH 1/2] fix: prevent launcher breakage when upgrading Linux packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During a package upgrade (e.g. 0.2.0 → 0.2.1), the old package's post-uninstall.sh ran after the new post-install.sh, deleting the symlink, .desktop file, and icons — breaking the app launcher. - post-uninstall.sh: skip cleanup when another openstan-* versioned directory exists (indicates an upgrade, not a full uninstall) - fpm: add --replaces openstan so dpkg/dnf coordinate upgrades properly - Remove unused openstan.desktop at repo root (packaging/ version is the one used by cx_Freeze) --- .github/workflows/release.yml | 2 ++ openstan.desktop | 12 ------------ packaging/post-uninstall.sh | 11 +++++++++++ 3 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 openstan.desktop diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83b0bef..651ea78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -318,6 +318,7 @@ jobs: --url "https://openstan.org" --description "Open source bank statement analysis and visualization" --license "LGPL-3.0-or-later" + --replaces openstan --after-install packaging/post-install.sh --after-remove packaging/post-uninstall.sh --chdir dist @@ -452,6 +453,7 @@ jobs: --url "https://openstan.org" --description "Open source bank statement analysis and visualization" --license "LGPL-3.0-or-later" + --replaces openstan --after-install packaging/post-install.sh --after-remove packaging/post-uninstall.sh --chdir dist diff --git a/openstan.desktop b/openstan.desktop deleted file mode 100644 index 6b69de1..0000000 --- a/openstan.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=openstan -GenericName=Bank Statement Analyser -Comment=Secure statement analysis — configurable, accurate, flexible & extendable -Exec=openstan -Icon=/usr/local/share/icons/hicolor/scalable/apps/openstan.svg -Categories=Office;Finance; -Keywords=bank;statement;pdf;analysis;finance; -StartupNotify=true -StartupWMClass=openstan diff --git a/packaging/post-uninstall.sh b/packaging/post-uninstall.sh index 77405d2..d9849a5 100644 --- a/packaging/post-uninstall.sh +++ b/packaging/post-uninstall.sh @@ -1,9 +1,20 @@ #!/bin/sh # Post-uninstall script for openstan RPM/DEB package. # Removes the .desktop entry and icon, then refreshes caches. +# +# On upgrade the new package's post-install.sh runs first, then this script +# runs as part of removing the old package. If any openstan-* versioned +# directory still exists under /usr/lib, we are mid-upgrade and must not +# tear down desktop integration — the new version handles that. set -e +# If another openstan version directory exists, this is an upgrade — skip cleanup. +# The new package's post-install.sh will handle desktop integration. +if ls -dt /usr/lib/openstan-* >/dev/null 2>&1; then + exit 0 +fi + rm -f /usr/bin/openstan rm -f /usr/share/applications/openstan.desktop rm -f /usr/share/icons/hicolor/scalable/apps/openstan.svg From 565205c7c18971e2d7026147c68102efced267ca Mon Sep 17 00:00:00 2001 From: Jason Farrar Date: Fri, 11 Sep 2026 08:17:48 +0100 Subject: [PATCH 2/2] fix: address review feedback on upgrade detection and fpm metadata - post-uninstall.sh: verify the openstan binary exists inside each versioned directory before skipping cleanup (avoids false positives from stale directories) - release.yml: remove redundant --replaces openstan (package already declares --name openstan, so replaces-self is a no-op) --- .github/workflows/release.yml | 2 -- packaging/post-uninstall.sh | 13 ++++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 651ea78..83b0bef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -318,7 +318,6 @@ jobs: --url "https://openstan.org" --description "Open source bank statement analysis and visualization" --license "LGPL-3.0-or-later" - --replaces openstan --after-install packaging/post-install.sh --after-remove packaging/post-uninstall.sh --chdir dist @@ -453,7 +452,6 @@ jobs: --url "https://openstan.org" --description "Open source bank statement analysis and visualization" --license "LGPL-3.0-or-later" - --replaces openstan --after-install packaging/post-install.sh --after-remove packaging/post-uninstall.sh --chdir dist diff --git a/packaging/post-uninstall.sh b/packaging/post-uninstall.sh index d9849a5..3b93ecb 100644 --- a/packaging/post-uninstall.sh +++ b/packaging/post-uninstall.sh @@ -9,11 +9,14 @@ set -e -# If another openstan version directory exists, this is an upgrade — skip cleanup. -# The new package's post-install.sh will handle desktop integration. -if ls -dt /usr/lib/openstan-* >/dev/null 2>&1; then - exit 0 -fi +# If another openstan version directory exists with a valid binary, +# this is an upgrade — skip cleanup. The new package's post-install.sh +# will handle desktop integration. +for _d in /usr/lib/openstan-*; do + if [ -d "$_d/openstan" ] && [ -x "$_d/openstan/openstan" ]; then + exit 0 + fi +done rm -f /usr/bin/openstan rm -f /usr/share/applications/openstan.desktop