[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/11: activation: Aways pass '-d HOME' to 'useradd'.
From: |
Ludovic Courtès |
Subject: |
01/11: activation: Aways pass '-d HOME' to 'useradd'. |
Date: |
Sun, 18 Nov 2018 17:40:56 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit b297934437932de730432629b361fcb422accbb7
Author: Ludovic Courtès <address@hidden>
Date: Sun Nov 18 23:34:19 2018 +0100
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.
---
gnu/build/activation.scm | 17 +++++++++--------
gnu/tests/base.scm | 11 ++++++++---
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 68ecd6b..0e77677 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)
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 02882f4..03392ce 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -154,10 +154,15 @@ info --version")
(#f (reverse result))
(x (loop (cons x result))))))
marionette)))
- (lset= string=?
- (map passwd:name users)
+ (lset= equal?
+ (map (lambda (user)
+ (list (passwd:name user)
+ (passwd:dir user)))
+ users)
(list
- #$@(map user-account-name
+ #$@(map (lambda (account)
+ `(list ,(user-account-name account)
+ ,(user-account-home-directory account)))
(operating-system-user-accounts os))))))
(test-assert "shepherd services"
- branch master updated (564cf93 -> ab6caf4), Ludovic Courtès, 2018/11/18
- 01/11: activation: Aways pass '-d HOME' to 'useradd'.,
Ludovic Courtès <=
- 02/11: bootloader: De-monadify configuration file generators., Ludovic Courtès, 2018/11/18
- 04/11: linux-initrd: Return file-like objects instead of monadic values., Ludovic Courtès, 2018/11/18
- 10/11: guix system: De-monadify bootloader installation script., Ludovic Courtès, 2018/11/18
- 05/11: system: De-monadify 'operating-system-boot-parameters'., Ludovic Courtès, 2018/11/18
- 08/11: vm: Remove explicit calls to 'operating-system-derivation'., Ludovic Courtès, 2018/11/18
- 03/11: system: Simplify kernel argument handling., Ludovic Courtès, 2018/11/18
- 07/11: system: De-monadify 'operating-system-bootcfg'., Ludovic Courtès, 2018/11/18
- 06/11: system: Please Emacs., Ludovic Courtès, 2018/11/18
- 11/11: guix system: Clarify 'perform-action'., Ludovic Courtès, 2018/11/18
- 09/11: guix system: Simplify bootloader package handling., Ludovic Courtès, 2018/11/18