Skip to content

Conversation

@pboushy
Copy link
Contributor

@pboushy pboushy commented Oct 28, 2024

The current version of the uninstall script:

  1. Doesn't contain an interpreter directive
  2. Requires root but doesn't check that it's running as root.
  3. Uses a method that is not recommended by Apple for detecting current desktop user.

This PR:

  1. sets the directive to be #!/bin/sh to ensure the most compatibility across macOS versions/environments.
  2. Checks that the script is being run as root or via sudo
  3. Switches to using the POSIX shell compliant version of scutil parsing as documented by scriptingosx in https://scriptingosx.com/2020/02/getting-the-current-user-in-macos-update/

Copy link
Collaborator

@almenscorner almenscorner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I updated the console_user_uid as it otherwise was not able to unload the LaunchAgent

@almenscorner almenscorner merged commit 361f65d into macadmins:main Nov 6, 2024
@almenscorner almenscorner mentioned this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants