about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2017-11-26T01·54-0500
committerGraham Christensen <graham@grahamc.com>2017-12-08T12·19-0500
commitbe79d1f1890c737dd04886120ef900d369d48a22 (patch)
tree85f0d6f57dfa95f00569170c2a1e17e722eb853e
parente3013543d36926ecfe51e9eceab42c88cb40b138 (diff)
darwin installer: fix on High Sierra
-rw-r--r--scripts/install-darwin-multi-user.sh26
1 files changed, 20 insertions, 6 deletions
diff --git a/scripts/install-darwin-multi-user.sh b/scripts/install-darwin-multi-user.sh
index 6369b68ab914..968dd1b84543 100644
--- a/scripts/install-darwin-multi-user.sh
+++ b/scripts/install-darwin-multi-user.sh
@@ -473,10 +473,8 @@ create_build_user_for_core() {
 
     if ! /usr/bin/dscl . -read "$dsclpath" > /dev/null 2>&1; then
         _sudo "Creating the Nix build user, $username" \
-              /usr/sbin/sysadminctl -addUser -fullName "Nix build user $coreid" \
-	      -home /var/empty \
-	      -UID "${uid}" \
-              -addUser "${username}"
+              /usr/bin/dscl . create "$dsclpath" \
+              UniqueID "${uid}"
         row "           Created" "Yes"
     else
         actual_uid=$(dsclattr "$dsclpath" "UniqueID")
@@ -504,6 +502,22 @@ EOF
         row "          IsHidden" "Yes"
     fi
 
+    if [ "$(dsclattr "$dsclpath" "NFSHomeDirectory")" = "/var/empty" ]; then
+        row "          NFSHomeDirectory" "/var/empty"
+    else
+        _sudo "in order to give $username a safe home directory" \
+              /usr/bin/dscl . -create "$dsclpath" "NFSHomeDirectory" "/var/empty"
+        row "          NFSHomeDirectory" "/var/empty"
+    fi
+
+    if [ "$(dsclattr "$dsclpath" "RealName")" = "Nix build user $coreid" ]; then
+        row "          RealName" "Nix build user $coreid"
+    else
+        _sudo "in order to give $username a useful name" \
+              /usr/bin/dscl . -create "$dsclpath" "RealName" "Nix build user $coreid"
+        row "          RealName" "Nix build user $coreid"
+    fi
+
     if [ "$(dsclattr "$dsclpath" "UserShell")" = "/sbin/nologin" ]; then
         row "   Logins Disabled" "Yes"
     else
@@ -521,11 +535,11 @@ EOF
         row "  Member of $NIX_BUILD_GROUP_NAME" "Yes"
     fi
 
-    if [ "$(dsclattr "$dsclpath" "PrimaryGroupId")" = "$NIX_BUILD_GROUP_ID" ]; then
+    if [ "$(dsclattr "$dsclpath" "PrimaryGroupID")" = "$NIX_BUILD_GROUP_ID" ]; then
         row "    PrimaryGroupID" "$NIX_BUILD_GROUP_ID"
     else
         _sudo "to let the nix daemon use this user for builds (this might seem redundant, but there are two concepts of group membership)" \
-              /usr/bin/dscl . -create "$dsclpath" "PrimaryGroupId" "$NIX_BUILD_GROUP_ID"
+              /usr/bin/dscl . -create "$dsclpath" "PrimaryGroupID" "$NIX_BUILD_GROUP_ID"
         row "    PrimaryGroupID" "$NIX_BUILD_GROUP_ID"
 
     fi