SPB Git

Repository Public

uninstall.sh 1001 B 22 lines shellscript

1#!/bin/sh2# Removes the mcc-agent launchd job and binary. Idempotent. Only the label ai.spboucher.mcc-agent is touched.3#   uninstall.sh [--purge]   --purge also deletes the identity, buffer and policy (~/.mcc-agent)4set -eu5LABEL=ai.spboucher.mcc-agent6PURGE=0; [ "${1:-}" = "--purge" ] && PURGE=17[ "$(id -u)" -ne 0 ] || { echo "run as the user that owns the agent" >&2; exit 1; }8launchctl bootout "gui/$(id -u)/$LABEL" 2>/dev/null || true9rm -f "$HOME/Library/LaunchAgents/$LABEL.plist"10if [ -f "/Library/LaunchDaemons/$LABEL.plist" ]; then11  echo "removing the LaunchDaemon (administrator rights needed)"12  sudo launchctl bootout "system/$LABEL" 2>/dev/null || true13  sudo rm -f "/Library/LaunchDaemons/$LABEL.plist"14fi15rm -f "$HOME/.mcc-agent/bin/mcc-agent"16if [ "$PURGE" = 1 ]; then17  rm -rf "$HOME/.mcc-agent" "$HOME/Library/Logs/mcc-agent"18  echo "identity removed: revoke the agent in the Command Center as well"19else20  echo "identity kept in $HOME/.mcc-agent (use --purge to delete it)"21fi22
Files main
Menu

Theme