mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
Merge pull request #11433 from abathur/fix_sequoia_migration_gid
use existing GID in sequoia migration script
This commit is contained in:
commit
5bfe198ad5
1 changed files with 9 additions and 3 deletions
|
@ -17,18 +17,23 @@ any_nixbld(){
|
||||||
dscl . list /Users UniqueID | grep -E '\b_nixbld' >/dev/null
|
dscl . list /Users UniqueID | grep -E '\b_nixbld' >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dsclattr() {
|
||||||
|
dscl . -read "$1" | awk "/$2/ { print \$2 }"
|
||||||
|
}
|
||||||
|
|
||||||
re_create_nixbld_user(){
|
re_create_nixbld_user(){
|
||||||
local name uid
|
local name uid
|
||||||
|
|
||||||
name="$1"
|
name="$1"
|
||||||
uid="$2"
|
uid="$2"
|
||||||
|
gid="$3"
|
||||||
|
|
||||||
sudo /usr/bin/dscl . -create "/Users/$name" "UniqueID" "$uid"
|
sudo /usr/bin/dscl . -create "/Users/$name" "UniqueID" "$uid"
|
||||||
sudo /usr/bin/dscl . -create "/Users/$name" "IsHidden" "1"
|
sudo /usr/bin/dscl . -create "/Users/$name" "IsHidden" "1"
|
||||||
sudo /usr/bin/dscl . -create "/Users/$name" "NFSHomeDirectory" "/var/empty"
|
sudo /usr/bin/dscl . -create "/Users/$name" "NFSHomeDirectory" "/var/empty"
|
||||||
sudo /usr/bin/dscl . -create "/Users/$name" "RealName" "Nix build user $name"
|
sudo /usr/bin/dscl . -create "/Users/$name" "RealName" "Nix build user $name"
|
||||||
sudo /usr/bin/dscl . -create "/Users/$name" "UserShell" "/sbin/nologin"
|
sudo /usr/bin/dscl . -create "/Users/$name" "UserShell" "/sbin/nologin"
|
||||||
sudo /usr/bin/dscl . -create "/Users/$name" "PrimaryGroupID" "30001"
|
sudo /usr/bin/dscl . -create "/Users/$name" "PrimaryGroupID" "$gid"
|
||||||
}
|
}
|
||||||
|
|
||||||
hit_id_cap(){
|
hit_id_cap(){
|
||||||
|
@ -68,11 +73,12 @@ temporarily_move_existing_nixbld_uids(){
|
||||||
}
|
}
|
||||||
|
|
||||||
change_nixbld_uids(){
|
change_nixbld_uids(){
|
||||||
local name next_id user_n
|
local existing_gid name next_id user_n
|
||||||
|
|
||||||
((next_id=NEW_NIX_FIRST_BUILD_UID))
|
((next_id=NEW_NIX_FIRST_BUILD_UID))
|
||||||
((user_n=1))
|
((user_n=1))
|
||||||
name="$(nix_user_n "$user_n")"
|
name="$(nix_user_n "$user_n")"
|
||||||
|
existing_gid="$(dsclattr "/Groups/nixbld" "PrimaryGroupID")"
|
||||||
|
|
||||||
# we know that we have *some* nixbld users, but macOS may have
|
# we know that we have *some* nixbld users, but macOS may have
|
||||||
# already clobbered the first few users if this system has been
|
# already clobbered the first few users if this system has been
|
||||||
|
@ -91,7 +97,7 @@ change_nixbld_uids(){
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
re_create_nixbld_user "$name" "$next_id"
|
re_create_nixbld_user "$name" "$next_id" "$existing_gid"
|
||||||
echo " $name was missing; created with uid: $next_id"
|
echo " $name was missing; created with uid: $next_id"
|
||||||
|
|
||||||
((user_n++))
|
((user_n++))
|
||||||
|
|
Loading…
Reference in a new issue