mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-05-26 02:51:49 +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:
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user