Fix: preserve /usr/bin/pulsar and /usr/bin/ppm on RPM updates #1091
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identify the Bug
Fixes #544
Description of the Change
Currently, when pulsar rpm is upgraded, the
post-uninstall.sh
script is run afterpost-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/#orderingAs 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 onpost-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
/usr/bin/pulsar
missing, as thepost-uninstall.sh
from the old package was used/usr/bin/pulsar
exists this time !Release Notes