Repository navigation
Conversation
The generated uninstaller removed every directory the project declared with `rm -Rf`. Directories shared between packages, such as /opt/puppetlabs/bin, which both openvox-agent and openbolt install into, were wiped along with the other package's files. Uninstalling OpenBolt on a Mac with openvox-agent installed removed the agent's `puppet` and `facter` links; the agent's uninstaller declares all of /opt/puppetlabs and would take OpenBolt with it. Remove exactly what the installer receipt records instead: every file and symlink is deleted, then each declared directory is removed recursively only when `pkgutil --file-info` shows no other installed package claiming it, then any receipt directories left empty are removed, and finally the receipt is forgotten. Operating-system directories such as /etc, /opt and /usr/local are never removed. Directories a package owns alone still go completely, so logs, caches and configuration written after installation are cleaned up as before. If no receipt exists the uninstaller now exits with an error instead of guessing. Fixes OpenVoxProject/openbolt#344 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes OpenVoxProject/openbolt#344.
Problem
resources/macos/uninstaller.tool.erbremoves every directory the project declares, with onerm -Rf. Directories shared between packages are wiped along with the other package's files:/opt/puppetlabs/bin, so "Uninstall OpenBolt" removes openvox-agent'spuppetandfacterlinks there./opt/puppetlabs(itsinstall_root), so its uninstaller removes/opt/puppetlabs/boltas well.The current script also never removes
/etc/paths.d/50-bolt, since only directories are listed.Change
The uninstaller now works from the installer receipt, the way
pkgutil-based cask uninstalls do:pkgutil --files <id>.rm -Rfit only ifpkgutil --file-infoshows no other installed package claiming it. Shared directories are kept and reported, for exampleKeeping /opt/puppetlabs/bin: it is also used by org.voxpupuli.openvox-agent.rmdirthe receipt's remaining directories, deepest first, so directories left empty (such as/usr/local/share/doc/<name>) go away. Operating-system directories (/etc,/opt,/usr/local,/Library, ...) are never removed.pkgutil --forget <id>.Step 2 keeps today's behaviour for directories a package owns alone: logs, caches and configuration written after installation are still cleaned up.
If no receipt exists the script exits with an error instead of guessing at paths.
Verification
bundle exec rake checkpasses (565 examples, rubocop clean). A new spec renders the template and checks the generated script is valid bash and uses the receipt rather than unconditionalrm -Rf.openvox-agent-9.1.0andopenbolt-5.6.0installed from the published DMGs, using uninstallers rendered from the real openbolt and openvox project configs with this branch:/opt/puppetlabs/bindisappears,/opt/puppetlabs/bin/puppetstops resolving,/etc/paths.d/50-boltis left behind./opt/puppetlabs/bolt,/opt/puppetlabs/bin/bolt,/etc/paths.d/50-boltand/usr/local/share/doc/openboltremoved;/opt/puppetlabs/binkept with the agent'spuppetandfacterlinks (Keeping /opt/puppetlabs/bin: it is also used by org.voxpupuli.openvox-agent); receipt forgotten;puppet --versionstill works./opt/puppetlabsand/opt/puppetlabs/binkept;/opt/puppetlabs/puppet,/etc/puppetlabs,/var/log/puppetlabs, the launchd plist and/etc/paths.d/puppet-agentremoved;bolt --versionstill works./opt/puppetlabsgone entirely, no receipts left.No installer receipt found for org.voxpupuli.openbolt; nothing to remove.No change is needed in openbolt or openvox to pick this up: both install vanagon from the branch given to the shared
build_vanagon.ymlworkflow (defaultmain), so the first macOS build after this merges ships the new uninstaller. TheUninstallapp on the DMG is assembled by openvox-release-infra, which moves vanagon's generated<project>-uninstaller.toolout of the DMG and into the applet, so that pipeline needs no change either.Assisted by Claude.