summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-05-17 12:22:29 +0100
committerGitHub <noreply@github.com>2018-05-17 12:22:29 +0100
commitadcae56ec81b5c4f1d80329a59a45c72db701b02 (patch)
treeef155d7913f8d9121a583841b99781dfbc9d569c /lib
parenta074d491722bf665da843e76672ffbadf92e3661 (diff)
parent2c9a6248d51de056719df546272a7b27cb590e95 (diff)
downloadchef-adcae56ec81b5c4f1d80329a59a45c72db701b02.tar.gz
Merge pull request #4903 from nmcspadden/mac_uid
UID now starts at 501, uses createhomedir instead
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/user/dscl.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 50d255db8b..79a2c73339 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -214,7 +214,7 @@ user password using shadow hash.")
#
# Sets the user id for the user using dscl.
# If a `uid` is not specified, it finds the next available one starting
- # from 200 if `system` is set, 500 otherwise.
+ # from 200 if `system` is set, 501 otherwise.
#
def dscl_set_uid
# XXX: mutates the new resource
@@ -229,11 +229,11 @@ user password using shadow hash.")
#
# Find the next available uid on the system. starting with 200 if `system` is set,
- # 500 otherwise.
+ # 501 otherwise.
#
def get_free_uid(search_limit = 1000)
uid = nil
- base_uid = new_resource.system ? 200 : 500
+ base_uid = new_resource.system ? 200 : 501
next_uid_guess = base_uid
users_uids = run_dscl("list", "/Users", "uid")
while next_uid_guess < search_limit + base_uid
@@ -326,10 +326,7 @@ user password using shadow hash.")
end
def ditto_home
- skel = "/System/Library/User Template/English.lproj"
- raise(Chef::Exceptions::User, "can't find skel at: #{skel}") unless ::File.exist?(skel)
- shell_out_compact!("ditto", skel, new_resource.home)
- ::FileUtils.chown_R(new_resource.username, new_resource.gid.to_s, new_resource.home)
+ shell_out_compact!("/usr/sbin/createhomedir", "-c", "-u", "#{new_resource.username}")
end
def move_home