1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-11 01:19:16 +00:00

Sip check optimization

This commit is contained in:
Tw93
2025-12-01 14:52:09 +08:00
parent 05c59c130b
commit 4056ad5245
3 changed files with 41 additions and 15 deletions

View File

@@ -58,6 +58,24 @@ declare -a DEFAULT_WHITELIST_PATTERNS=(
"$FINDER_METADATA_SENTINEL"
)
# Check if System Integrity Protection is enabled
# Returns: 0 if SIP is enabled, 1 if disabled or cannot determine
is_sip_enabled() {
if ! command -v csrutil > /dev/null 2>&1; then
# If csrutil not available, assume SIP is enabled for safety
return 0
fi
local sip_status
sip_status=$(csrutil status 2> /dev/null || echo "")
if echo "$sip_status" | grep -qi "enabled"; then
return 0
else
return 1
fi
}
# Get spinner characters (overridable via MO_SPINNER_CHARS)
mo_spinner_chars() {
local chars="${MO_SPINNER_CHARS:-|/-\\}"