feat: doctor, update, uninstall, config, report, MA detect, spinner, reinstall

- doctor: pre-flight diagnostic (sudo, recovery, disk, libs, third-party FW)
- update: self-update from the latest release
- uninstall: remove all Runaway traces (daemons, pf, hosts, backups, config)
- config: persistent settings file (~/.runaway.conf) with show/set/unset
- report: full markdown system status report
- MA detect: scan for Migration Assistant MDM artifacts per user
- spinner: visual progress indicator for long operations
- reinstall: uninstall + persist + whitelist + monitor-install
- Third-party firewall detection (Little Snitch, LuLu, Radio Silence, Vallum)
- Load config on startup (WEBHOOK, LOG_LEVEL, LOG_FILE)
- Bump 1.3.0 -> 1.4.0
This commit is contained in:
2026-06-20 12:23:51 -03:00
parent 5cfcf6f748
commit 33e83f8d63
11 changed files with 1138 additions and 4 deletions
+101
View File
@@ -0,0 +1,101 @@
do_uninstall() {
header "Unleash — Full Uninstall"
if ! is_root; then
error_exit "Uninstall needs sudo: sudo ./unleash uninstall"
fi
begin "Removing heal LaunchDaemon"
local plist="/Library/LaunchDaemons/com.unleash.heal.plist"
if [ -f "$plist" ]; then
launchctl unload "$plist" 2>/dev/null || true
rm -f "$plist"
end_ok
else
end_fail; echo " Not installed"
fi
begin "Removing monitor LaunchDaemon"
plist="/Library/LaunchDaemons/com.unleash.monitor.plist"
if [ -f "$plist" ]; then
launchctl unload "$plist" 2>/dev/null || true
rm -f "$plist"
end_ok
else
end_fail; echo " Not installed"
fi
begin "Cleaning pf anchors"
local anchors=("/etc/pf.anchors/com.unleash/mdm" "/etc/pf.anchors/com.unleash.selective")
for a in "${anchors[@]}"; do
[ -f "$a" ] && rm -f "$a"
done
for anchor_name in "com.unleash/mdm" "com.unleash.selective"; do
pfctl -a "$anchor_name" -F all 2>/dev/null || true
done
local pf_conf="/etc/pf.conf"
if [ -f "$pf_conf" ]; then
sed -i '' '/# Added by unleash/d' "$pf_conf" 2>/dev/null || true
sed -i '' '/com\.unleash/d' "$pf_conf" 2>/dev/null || true
fi
pfctl -f /etc/pf.conf 2>/dev/null || true
end_ok
begin "Cleaning hosts entries"
local hosts="/private/etc/hosts"
if [ -f "$hosts" ]; then
sed -i '' '/# Added by unleash/d' "$hosts" 2>/dev/null || true
local domains=("iprofiles.apple.com" "deviceenrollment.apple.com" "mdmenrollment.apple.com")
for d in "${domains[@]}"; do
sed -i '' "/[[:space:]]$d/d" "$hosts" 2>/dev/null || true
sed -i '' "/::$d/d" "$hosts" 2>/dev/null || true
done
end_ok
else
end_fail; echo " Not found"
fi
begin "Restoring launchd overrides"
local ldp="/private/var/db/com.apple.xpc.launchd/disabled.plist"
if [ -f "$ldp" ]; then
for label in com.apple.ManagedClient.enroll com.apple.ManagedClient.cloudConfiguration \
com.apple.mdmclient.daemon.runatboot com.apple.activationd; do
/usr/libexec/PlistBuddy -c "Delete :$label" "$ldp" 2>/dev/null || true
done
end_ok
else
end_fail; echo " Not found"
fi
begin "Removing backup directory"
local backup=".unleash-backup"
if [ -d "$backup" ]; then
rm -rf "$backup" 2>/dev/null || true
end_ok
else
end_fail; echo " Not found"
fi
begin "Removing config file"
if [ -f "$HOME/.unleash.conf" ]; then
rm -f "$HOME/.unleash.conf"
end_ok
else
end_fail; echo " Not found"
fi
begin "Stopping monitor if running"
local pidfile="/tmp/unleash-monitor.pid"
if [ -f "$pidfile" ]; then
kill "$(cat "$pidfile")" 2>/dev/null || true
rm -f "$pidfile"
end_ok
else
end_fail; echo " Not running"
fi
echo ""
success "Uninstall complete"
info "Your system is back to its original state."
info "The unleash script itself was not removed."
}