diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-11-18 23:34:19 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-11-18 23:37:25 +0100 |
commit | b297934437932de730432629b361fcb422accbb7 (patch) | |
tree | 62a0351ee6ac44a546180ea448d24cfd691c4ad1 /gnu/build | |
parent | 564cf93f2aca60171b4b97559ffc6c952e73e8ed (diff) | |
download | patches-b297934437932de730432629b361fcb422accbb7.tar patches-b297934437932de730432629b361fcb422accbb7.tar.gz |
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.
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/activation.scm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 68ecd6bc71..0e77677de1 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -148,11 +148,15 @@ properties. Return #t on success." `("-G" ,(string-join supplementary-groups ",")) '()) ,@(if comment `("-c" ,comment) '()) - ,@(if (and home create-home?) - (if (file-exists? home) - `("-d" ,home) ; avoid warning from 'useradd' - `("-d" ,home "--create-home")) + ,@(if home `("-d" ,home) '()) + + ;; Home directories of non-system accounts are created by + ;; 'activate-user-home'. + ,@(if (and home create-home? system? + (not (file-exists? home))) + '("--create-home") '()) + ,@(if shell `("-s" ,shell) '()) ,@(if password `("-p" ,password) '()) ,@(if system? '("--system") '()) @@ -229,10 +233,7 @@ numeric gid or #f." #:supplementary-groups supplementary-groups #:comment comment #:home home - - ;; Home directories of non-system accounts are created by - ;; 'activate-user-home'. - #:create-home? (and create-home? system?) + #:create-home? create-home? #:shell shell #:password password) |