From b7664ad8a7c0692d003a5cd3ebc3d66c34ba9d19 Mon Sep 17 00:00:00 2001 From: trbernstein Date: Sat, 18 Oct 2025 21:17:54 +0200 Subject: [PATCH] Adapt UID of _homebrew depending on system version --- modules/04-install-brew.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/04-install-brew.sh b/modules/04-install-brew.sh index 6cc860d..6dce8a9 100755 --- a/modules/04-install-brew.sh +++ b/modules/04-install-brew.sh @@ -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