summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-11 21:34:30 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-12 00:14:52 +0200
commitc6a0536d08e225c6c67647b17f6f0a60b2314752 (patch)
tree3bb57d4c8f78500da0b7df016557955a8bbd1635
parent286cacaded85f44bb39290253e73a36972f9e343 (diff)
downloadpatches-c6a0536d08e225c6c67647b17f6f0a60b2314752.tar
patches-c6a0536d08e225c6c67647b17f6f0a60b2314752.tar.gz
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'.
-rw-r--r--gnu/build/activation.scm9
1 files changed, 8 insertions, 1 deletions
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 '("." ".."))))