From c6a0536d08e225c6c67647b17f6f0a60b2314752 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 11 Sep 2014 21:34:30 +0200 Subject: activation: Make sure /etc/sudoers & co. are regular files. Before that, 'sudo' would exit with: sudo: /etc/sudoers is not a regular file sudo: no valid sudoers sources found, quitting * gnu/build/activation.scm (activate-etc): Check if SOURCE matches 'file-is-directory?'. If not, use 'copy-file' instead of 'symlink'. --- gnu/build/activation.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gnu/build/activation.scm') diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 03c1d24126..009c1fff0a 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -155,7 +155,14 @@ numeric gid or #f." (let ((target (string-append "/etc/" file)) (source (string-append "/etc/static/" file))) (rm-f target) - (symlink source target))) + + ;; Things such as /etc/sudoers must be regular files, not + ;; symlinks; furthermore, they could be modified behind our + ;; back---e.g., with 'visudo'. Thus, make a copy instead of + ;; symlinking them. + (if (file-is-directory? source) + (symlink source target) + (copy-file source target)))) (scandir etc (lambda (file) (not (member file '("." "..")))) -- cgit v1.2.3