user: Don't use managehome on OpenBSD
User creation fails if home directory already exists, use tar to copy skel instead.
This commit is contained in:
parent
b9879bf45b
commit
7ef94e5b11
1 changed files with 21 additions and 10 deletions
|
@ -416,9 +416,29 @@ class user::cron {
|
|||
#
|
||||
define user::add($uid, $gid, $comment, $home, $shell, $groups=undef) {
|
||||
|
||||
if $::operatingsystem == "OpenBSD" {
|
||||
$managehome = false
|
||||
|
||||
exec { "usermod -L ldap ${name}":
|
||||
refreshonly => true,
|
||||
path => "/sbin:/usr/sbin:/bin:/usr/bin",
|
||||
require => File["/etc/login.conf"],
|
||||
subscribe => User[$name],
|
||||
}
|
||||
|
||||
exec { "mkdir -p ${home} && tar -C /etc/skel -cf - . | tar -C ${home} -xpf - && chown -R ${uid}:${gid} ${home}":
|
||||
refreshonly => true,
|
||||
path => "/sbin:/usr/sbin:/bin:/usr/bin",
|
||||
creates => $home,
|
||||
subscribe => User[$name],
|
||||
}
|
||||
} else {
|
||||
$managehome = true
|
||||
}
|
||||
|
||||
user { $name:
|
||||
ensure => present,
|
||||
managehome => true,
|
||||
managehome => $managehome,
|
||||
uid => $uid,
|
||||
gid => $gid,
|
||||
comment => $comment,
|
||||
|
@ -427,13 +447,4 @@ define user::add($uid, $gid, $comment, $home, $shell, $groups=undef) {
|
|||
groups => $groups,
|
||||
}
|
||||
|
||||
if $::operatingsystem == "OpenBSD" {
|
||||
exec { "usermod -L ldap ${name}":
|
||||
refreshonly => true,
|
||||
path => "/sbin:/usr/sbin:/bin:/usr/bin",
|
||||
subscribe => User[$name],
|
||||
require => File["/etc/login.conf"],
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue