1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-26 19:11:46 +02:00

services: Add 'special-files-service-type'.

* gnu/build/activation.scm (activate-/bin/sh): Remove.
(activate-special-files): New procedure.
* gnu/services.scm (activation-script): Remove call to
'activate-/bin/sh'.
(special-files-service-type): New variable.
(extra-special-file): New procedure.
* gnu/services/base.scm (%base-services): Add SPECIAL-FILES-SERVICE-TYPE
instance.
* gnu/tests/base.scm (run-basic-test)[special-files]: New variables.
["special files"]: New test.
This commit is contained in:
Ludovic Courtès
2017-02-08 15:32:28 +01:00
parent 618739b063
commit 387e175492
5 changed files with 106 additions and 10 deletions
+18 -5
View File
@@ -28,7 +28,7 @@
activate-user-home
activate-etc
activate-setuid-programs
activate-/bin/sh
activate-special-files
activate-modprobe
activate-firmware
activate-ptrace-attach
@@ -383,10 +383,23 @@ copy SOURCE to TARGET."
(for-each make-setuid-program programs))
(define (activate-/bin/sh shell)
"Change /bin/sh to point to SHELL."
(symlink shell "/bin/sh.new")
(rename-file "/bin/sh.new" "/bin/sh"))
(define (activate-special-files special-files)
"Install the files listed in SPECIAL-FILES. Each element of SPECIAL-FILES
is a pair where the first element is the name of the special file and the
second element is the name it should appear at, such as:
((\"/bin/sh\" \"/gnu/store/…-bash/bin/sh\")
(\"/usr/bin/env\" \"/gnu/store/…-coreutils/bin/env\"))
"
(define install-special-file
(match-lambda
((target file)
(let ((pivot (string-append target ".new")))
(mkdir-p (dirname target))
(symlink file pivot)
(rename-file pivot target)))))
(for-each install-special-file special-files))
(define (activate-modprobe modprobe)
"Tell the kernel to use MODPROBE to load modules."