#!/bin/bash
# Отключает системные LaunchAgents/LaunchDaemons (требуется sudo).
# Запуск: sudo ./disable_system_launch_items.sh

set -e

LA="/Library/LaunchAgents"
LD="/Library/LaunchDaemons"

unload_and_rename() {
  local path="$1"
  if [[ -f "$path" ]]; then
    launchctl unload "$path" 2>/dev/null || true
    mv "$path" "${path}.disabled"
    echo "Disabled: $path"
  fi
}

unload_and_rename "$LA/com.philandro.anydesk.Frontend.plist"
unload_and_rename "$LA/us.zoom.updater.plist"
unload_and_rename "$LA/us.zoom.updater.login.check.plist"
unload_and_rename "$LD/us.zoom.ZoomDaemon.plist"
unload_and_rename "$LD/jp.co.canon.MasterInstaller.plist"

echo "Done."
