Skip to content

sequoia-nixbld-user-migration: Try to recreate all missing users instead of just first contiguous set #13058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions scripts/sequoia-nixbld-user-migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ change_nixbld_uids(){
local existing_gid name next_id user_n

((next_id=NEW_NIX_FIRST_BUILD_UID))
((user_n=1))
name="$(nix_user_n "$user_n")"
existing_gid="$(dsclattr "/Groups/nixbld" "PrimaryGroupID")"

# we know that we have *some* nixbld users, but macOS may have
# already clobbered the first few users if this system has been
# upgraded
# upgraded. just try to recreate any missing ones.

echo ""
echo "Step 2: re-create missing early _nixbld# users."
echo "Step 2: re-create missing _nixbld# users."

until dscl . read "/Users/$name" &>/dev/null; do
for user_n in $(seq 1 32); do
name="$(nix_user_n "$user_n")"
if dscl . read "/Users/$name" &>/dev/null; then
continue
fi
# iterate for a clean ID
while id_unavailable "$next_id"; do
((next_id++))
Expand Down