From 3cf319a3f8e23831960a0f1320122cc514188a37 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 21 Aug 2016 19:03:29 +0200 Subject: services: elogind: Provide '%elogind-file-systems' by extension. * gnu/system/file-systems.scm (%base-file-systems): Remove %ELOGIND-FILE-SYSTEMS. * gnu/services/desktop.scm (elogind-service-type): Extend FILE-SYSTEM-SERVICE-TYPE to provide %ELOGIND-FILE-SYSTEMS. --- gnu/system/file-systems.scm | 1 - 1 file changed, 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 116e2813e8..0dc472e3c7 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -257,7 +257,6 @@ TARGET in the other system." (append (list %pseudo-terminal-file-system %shared-memory-file-system %immutable-store) - %elogind-file-systems %control-groups)) ;; File systems for Linux containers differ from %base-file-systems in that -- cgit v1.2.3 From 17073dafc59d62fb8cbb8b94d61d3ecc488ac59f Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Mon, 22 Aug 2016 08:16:37 -0400 Subject: Revert "services: elogind: Provide '%elogind-file-systems' by extension." This reverts commit 3cf319a3f8e23831960a0f1320122cc514188a37. --- gnu/services/desktop.scm | 8 +------- gnu/system/file-systems.scm | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'gnu/system') diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index df93bc8e10..bf21707bfe 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -27,8 +27,6 @@ #:use-module (gnu services avahi) #:use-module (gnu services xorg) #:use-module (gnu services networking) - #:use-module ((gnu system file-systems) - #:select (%elogind-file-systems)) #:use-module (gnu system shadow) #:use-module (gnu system pam) #:use-module (gnu packages glib) @@ -762,11 +760,7 @@ seats.)" ;; Extend PAM with pam_elogind.so. (service-extension pam-root-service-type - pam-extension-procedure) - - ;; We need /run/user, /run/systemd, etc. - (service-extension file-system-service-type - (const %elogind-file-systems)))))) + pam-extension-procedure))))) (define* (elogind-service #:key (config (elogind-configuration))) "Return a service that runs the @command{elogind} login and seat management diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 0dc472e3c7..116e2813e8 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -257,6 +257,7 @@ TARGET in the other system." (append (list %pseudo-terminal-file-system %shared-memory-file-system %immutable-store) + %elogind-file-systems %control-groups)) ;; File systems for Linux containers differ from %base-file-systems in that -- cgit v1.2.3 From eb56ee027b4c6b5682f69fa885d16e55c4495bd8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Aug 2016 12:53:20 +0200 Subject: system: Add 'create-home-directory?' field to . * gnu/system/shadow.scm ()[create-home-directory?]: New field. (user-account->gexp): Serialize it. * gnu/build/activation.scm (activate-users+groups)[activate-user]: Update 'match-lambda' pattern accordingly. Pass #:create-home? to 'ensure-user'. (add-user, modify-user, ensure-user): Add #:create-home? parameter and honor it. * doc/guix.texi (User Accounts): Document it. --- doc/guix.texi | 4 ++++ gnu/build/activation.scm | 15 ++++++++++----- gnu/system/shadow.scm | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'gnu/system') diff --git a/doc/guix.texi b/doc/guix.texi index 533023854b..e25cf58a31 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7223,6 +7223,10 @@ A comment about the account, such as the account owner's full name. @item @code{home-directory} This is the name of the home directory for the account. +@item @code{create-home-directory?} (default: @code{#t}) +Indicates whether the home directory of this account should be created +if it does not exist yet. + @item @code{shell} (default: Bash) This is a G-expression denoting the file name of a program to be used as the shell (@pxref{G-Expressions}). diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 6666cb4856..10aa58d85c 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -110,7 +110,8 @@ owner-writable in HOME." files))) (define* (add-user name group - #:key uid comment home shell password system? + #:key uid comment home create-home? + shell password system? (supplementary-groups '()) (log-port (current-error-port))) "Create an account for user NAME part of GROUP, with the specified @@ -139,7 +140,7 @@ properties. Return #t on success." `("-G" ,(string-join supplementary-groups ",")) '()) ,@(if comment `("-c" ,comment) '()) - ,@(if home + ,@(if (and home create-home?) (if (file-exists? home) `("-d" ,home) ; avoid warning from 'useradd' `("-d" ,home "--create-home")) @@ -158,7 +159,8 @@ properties. Return #t on success." #t))))) (define* (modify-user name group - #:key uid comment home shell password system? + #:key uid comment home create-home? + shell password system? (supplementary-groups '()) (log-port (current-error-port))) "Modify user account NAME to have all the given settings." @@ -186,7 +188,8 @@ logged in." (zero? (system* "groupdel" name))) (define* (ensure-user name group - #:key uid comment home shell password system? + #:key uid comment home create-home? + shell password system? (supplementary-groups '()) (log-port (current-error-port)) #:rest rest) @@ -207,7 +210,8 @@ numeric gid or #f." (define activate-user (match-lambda - ((name uid group supplementary-groups comment home shell password system?) + ((name uid group supplementary-groups comment home create-home? + shell password system?) (let ((profile-dir (string-append "/var/guix/profiles/per-user/" name))) (ensure-user name group @@ -216,6 +220,7 @@ numeric gid or #f." #:supplementary-groups supplementary-groups #:comment comment #:home home + #:create-home? create-home? #:shell shell #:password password) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index c3948900eb..6a4063529c 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -78,6 +78,8 @@ (default '())) ; list of strings (comment user-account-comment (default "")) (home-directory user-account-home-directory) + (create-home-directory? user-account-create-home-directory? ;Boolean + (default #t)) (shell user-account-shell ; gexp (default #~(string-append #$bash "/bin/bash"))) (system? user-account-system? ; Boolean @@ -255,6 +257,7 @@ of user '~a' is undeclared") #$(user-account-supplementary-groups account) #$(user-account-comment account) #$(user-account-home-directory account) + #$(user-account-create-home-directory? account) ,#$(user-account-shell account) ; this one is a gexp #$(user-account-password account) #$(user-account-system? account))) -- cgit v1.2.3 From d03db7434b5b2f1e588c65805d38faea973c3cf0 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Aug 2016 12:56:48 +0200 Subject: system: Do not create the home directory of "nobody". Fixes . Reported by John Darrington . * gnu/system/shadow.scm (%base-user-accounts): Add (create-home-directory? #f) for "nobody". --- gnu/system/shadow.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 6a4063529c..cfdcf5e136 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -130,6 +130,7 @@ (group "nogroup") (shell #~(string-append #$shadow "/sbin/nologin")) (home-directory "/nonexistent") + (create-home-directory? #f) (system? #t)))) (define (default-skeletons) -- cgit v1.2.3