Skip to content

Commit

Permalink
Merge pull request #76 from rosahaj/fix-rpm-scriptlet
Browse files Browse the repository at this point in the history
Fix POSTUN scriptlet on RPM upgrade and uninstall
  • Loading branch information
pimterry authored Nov 7, 2024
2 parents 04ad263 + 946ae32 commit f3bc3ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
]
},
"rpm": {
"artifactName": "HttpToolkit-${version}.rpm"
"artifactName": "HttpToolkit-${version}.rpm",
"afterRemove": "scripts/post-uninstall-rpm.sh"
},
"appImage": {
"artifactName": "HttpToolkit-${version}.AppImage"
Expand Down
14 changes: 14 additions & 0 deletions scripts/post-uninstall-rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# This check works only for RPMs
if [ $1 -ge 1 ]; then
# Package upgrade, do not uninstall
exit 0
fi

# Delete the link to the binary
if type update-alternatives >/dev/null 2>&1; then
update-alternatives --remove "httptoolkit" "/opt/HTTP Toolkit/httptoolkit"
else
rm -f "/usr/bin/httptoolkit"
fi

0 comments on commit f3bc3ab

Please sign in to comment.