Skip to content

superops_agent_reinstall_macos.sh

Corey Watson edited this page Dec 1, 2025 · 1 revision

superops_agent_reinstall_macos.sh

Performs a complete reinstallation of the SuperOps RMM agent on macOS.

Overview

Performs a complete reinstallation of the SuperOps RMM agent on macOS by uninstalling the current agent and installing a new version from a provided URL. This is useful for agent upgrades or fixing corrupted installations.

Purpose

Performs a complete reinstallation of the SuperOps RMM agent on macOS by uninstalling the current agent and installing a new version from a provided URL. This is useful for agent upgrades or fixing corrupted installations.

Prerequisites

  • Bash shell
  • macOS operating system
  • Sudo privileges (for installation)
  • Internet access to download new agent
  • curl command (standard on macOS)
  • SuperOps RMM agent currently installed
  • PKGURL environment variable set by RMM platform

Configuration

Required Inputs

  • PKGURL : (The download URL for the new SuperOps agent .pkg installer)
  • UninstallScriptPath : "/Library/superops/uninstall.sh" (Path to current agent's uninstall script)

Settings

  • Uses background process to handle reinstall after uninstall
  • Waits for complete uninstallation before installing new version
  • Downloads new agent to /tmp directory
  • Monitors agent processes to ensure clean uninstall
  • 5-second polling interval for uninstall completion

Behavior

  • Validates PKGURL environment variable is set
  • Validates current agent uninstall script exists
  • Starts background reinstall process
  • Background process waits for uninstall to complete
  • Executes current agent's uninstall script
  • Background process downloads and installs new agent
  • Reports progress and status to stdout
  • Exits with code 0 on success, 1 on failure

Security Notes

  • No secrets hardcoded
  • New agent URL from environment variable
  • Uses official SuperOps uninstall script
  • Requires sudo elevation for installation
  • Standard macOS installer security

Exit Codes

  • 0 success
  • 1 failure

Example Output

[ INPUT VALIDATION ]
--------------------------------------------------------------
Package URL: https://app.superops.com/downloads/agent.pkg
Uninstall Script: /Library/superops/uninstall.sh

[ OPERATION ]
--------------------------------------------------------------
Starting background reinstall process...
Background process will wait for uninstall completion
Uninstalling current SuperOps agent...
Executing uninstall script...
Uninstallation completed successfully.
[Background] Uninstall detected, waiting for cleanup...
[Background] Downloading new agent from URL...
[Background] File downloaded successfully.
[Background] Starting installation...
[Background] Installation completed successfully.

[ RESULT ]
--------------------------------------------------------------
Status: Success

[ FINAL STATUS ]
--------------------------------------------------------------
SuperOps agent reinstalled successfully

[ SCRIPT COMPLETED ]
--------------------------------------------------------------

Version History

  • 2025-11-02 v1.0.0 Initial migration from SuperOps
    • Converted to Limehawk Style A format (bash)
    • Added comprehensive error handling
    • Added validation checks
    • Added structured console output
    • Made paths configurable
    • Improved status reporting

Links

Clone this wiki locally