Fix tests: 78/78 passing, fix function names, fix EUID readonly, fix missing functions

This commit is contained in:
2026-06-20 15:41:08 -03:00
parent ec824ccd23
commit 7d1adcc9a1
12 changed files with 103 additions and 58 deletions
+23
View File
@@ -144,3 +144,26 @@ detect_migration_assistant() {
return 0
fi
}
clean_ma_artifacts() {
local data_mount="${1:-}"
local homes=()
if [ -n "$data_mount" ] && [ -d "$data_mount/Users" ]; then
for h in "$data_mount/Users/"*/; do homes+=("$h"); done
elif [ -d "/Users" ]; then
for h in /Users/*/; do homes+=("$h"); done
fi
for home in "${homes[@]}"; do
local user
user=$(basename "$home")
[ "$user" = "Guest" ] || [ "$user" = "Shared" ] && continue
[ -d "$home/Library" ] || continue
rm -f "$home/Library/Preferences/com.apple.mdm.plist" 2>/dev/null || true
rm -f "$home/Library/Preferences/com.apple.mdmclient.plist" 2>/dev/null || true
rm -f "$home/Library/Preferences/com.apple.ManagedClient.plist" 2>/dev/null || true
rm -rf "$home/Library/Caches/com.apple.enrollmenttool" 2>/dev/null || true
rm -rf "$home/Library/Caches/com.apple.mdm" 2>/dev/null || true
rm -rf "$home/Library/Application Support/com.apple.ManagedClient" 2>/dev/null || true
done
info "User-level MDM artifacts cleaned"
}