Adapt UID of _homebrew depending on system version

This commit is contained in:
2025-10-18 21:17:54 +02:00
parent 37542773e3
commit b7664ad8a7

View File

@@ -42,12 +42,11 @@ function ensureUserCanNoLongerRunPasswordlessSudo() {
}
function getFirstFreeRoleAccountID() {
local minUserID=450
local maxUserID=499
local uname_machine=$(/usr/bin/uname -m)
if [[ ${uname_machine} != "arm64" ]]; then
minUserID=200
maxUserID=400
local minUserID=200
local maxUserID=400
if is-at-least 13.0 $(sw_vers -productVersion); then
minUserID=450
maxUserID=499
fi
dscl . -list '/Users' UniqueID | grep '_.*' | sort -n -k2 | awk -v i=${minUserID} '$2>='${minUserID}' && $2<'${maxUserID}' {if(i < $2) { print i; nextfile} else i=$2+1;} END {if(i <= '${maxUserID}' && ($2 < '${minUserID}' || $2 > '${maxUserID}')) print i;}'
}
@@ -356,6 +355,7 @@ function getUsage() {
if [[ "${ZSH_EVAL_CONTEXT}" == toplevel ]]; then
test -f "${ASTZWEIG_MACOS_SYSTEM_LIB}" || { echo 'This module requires macos-system library. Please run again with macos-system library provieded as a path in ASTZWEIG_MACOS_SYSTEM_LIB env variable.'; return 10 }
autoload is-at-least
source "${ASTZWEIG_MACOS_SYSTEM_LIB}"
module_main $0 "$@"
fi