pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.24k stars 137 forks source link

Fix: preserve /usr/bin/pulsar and /usr/bin/ppm on RPM updates #1091

Open am97 opened 2 weeks ago

am97 commented 2 weeks ago

Identify the Bug

Fixes #544

Description of the Change

Currently, when pulsar rpm is upgraded, the post-uninstall.sh script is run after post-install.sh.

Inspecting the RPM for the current release with rpm -qp Linux.pulsar-1.120.0.x86_64.rpm --scripts shows that electron-builder placed the scripts in the %post and %postun sections, described here: https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#ordering

As you can see, %postun is there also on upgrades (as the old package is uninstalled). There's a method that a scriptlet in %postun can use to check if we're doing an upgrade or a removal, which relies on the first argument supplied to the scriptlet ($1). Check for example the output for the Caddy package on my system (rpm -q caddy --scripts): caddy_rpm_scripts.log

This PR adds a separate post-uninstall-rpm.sh script which terminates early if we're performing an upgrade. I did not include the check on post-uninstall.sh as other package managers may pass different kind of args to the scripts.

Alternate Designs

Keep a single post-uninstall.sh script and add extra checks to determine if we are in a RPM, however that would add more complexity.

Possible Drawbacks

Different post-uninstall scripts to keep in sync

Verification Process

Release Notes

savetheclocktower commented 1 week ago

We're about to do the 1.121.0 release, but I want to comment here to thank you for this PR and make sure we didn't run the risk of appearing ungrateful.

I'll set some reminders to make sure we review this before 1.122.0.

Paging @daeraxa, the reporter of #544 more than a year ago, in case they're in a better position to verify.