activation: Aways pass '-d HOME' to 'useradd'.
Fixes <https://bugs.gnu.org/33422>. Reported by fps. * gnu/build/activation.scm (add-user): Always pass "-d HOME" when HOME is true. Pass "--create-home" only when HOME, CREATE-HOME?, and SYSTEM? are true. (activate-users+groups): Pass #:create-home? create-home? to 'ensure-user'. * gnu/tests/base.scm (run-basic-test)["accounts"]: Test 'passwd:dir' as well.
This commit is contained in:
parent
564cf93f2a
commit
b297934437
|
@ -148,11 +148,15 @@ properties. Return #t on success."
|
||||||
`("-G" ,(string-join supplementary-groups ","))
|
`("-G" ,(string-join supplementary-groups ","))
|
||||||
'())
|
'())
|
||||||
,@(if comment `("-c" ,comment) '())
|
,@(if comment `("-c" ,comment) '())
|
||||||
,@(if (and home create-home?)
|
,@(if home `("-d" ,home) '())
|
||||||
(if (file-exists? home)
|
|
||||||
`("-d" ,home) ; avoid warning from 'useradd'
|
;; Home directories of non-system accounts are created by
|
||||||
`("-d" ,home "--create-home"))
|
;; 'activate-user-home'.
|
||||||
|
,@(if (and home create-home? system?
|
||||||
|
(not (file-exists? home)))
|
||||||
|
'("--create-home")
|
||||||
'())
|
'())
|
||||||
|
|
||||||
,@(if shell `("-s" ,shell) '())
|
,@(if shell `("-s" ,shell) '())
|
||||||
,@(if password `("-p" ,password) '())
|
,@(if password `("-p" ,password) '())
|
||||||
,@(if system? '("--system") '())
|
,@(if system? '("--system") '())
|
||||||
|
@ -229,10 +233,7 @@ numeric gid or #f."
|
||||||
#:supplementary-groups supplementary-groups
|
#:supplementary-groups supplementary-groups
|
||||||
#:comment comment
|
#:comment comment
|
||||||
#:home home
|
#:home home
|
||||||
|
#:create-home? create-home?
|
||||||
;; Home directories of non-system accounts are created by
|
|
||||||
;; 'activate-user-home'.
|
|
||||||
#:create-home? (and create-home? system?)
|
|
||||||
|
|
||||||
#:shell shell
|
#:shell shell
|
||||||
#:password password)
|
#:password password)
|
||||||
|
|
|
@ -154,10 +154,15 @@ info --version")
|
||||||
(#f (reverse result))
|
(#f (reverse result))
|
||||||
(x (loop (cons x result))))))
|
(x (loop (cons x result))))))
|
||||||
marionette)))
|
marionette)))
|
||||||
(lset= string=?
|
(lset= equal?
|
||||||
(map passwd:name users)
|
(map (lambda (user)
|
||||||
|
(list (passwd:name user)
|
||||||
|
(passwd:dir user)))
|
||||||
|
users)
|
||||||
(list
|
(list
|
||||||
#$@(map user-account-name
|
#$@(map (lambda (account)
|
||||||
|
`(list ,(user-account-name account)
|
||||||
|
,(user-account-home-directory account)))
|
||||||
(operating-system-user-accounts os))))))
|
(operating-system-user-accounts os))))))
|
||||||
|
|
||||||
(test-assert "shepherd services"
|
(test-assert "shepherd services"
|
||||||
|
|
Loading…
Reference in New Issue