services: Add etc-bashrc-d-service-type.

* gnu/services.scm (files->bashrc-d-directory) New procedure.
(etc-bashrc-d-service-type): New service type.
* doc/guix.texi (Service Reference): Document it.
* gnu/tests/base.scm (test-basic-os): Test it.

Change-Id: Ibbb0f684de7aee296adedbce5b1192786d661af2
This commit is contained in:
Maxim Cournoyer 2025-05-06 16:16:09 +09:00
parent 42245040f6
commit 4c017ccfe5
No known key found for this signature in database
GPG key ID: 1260E46482E63562
3 changed files with 62 additions and 9 deletions

View file

@ -178,6 +178,19 @@ test -f /etc/profile.d/test_profile_d.sh
test \"$PROFILE_D_OK\" = yes")
marionette)))
(test-assert "/etc/bashrc.d is sourced"
(zero? (marionette-eval
'(system* "bash"
;; Ensure Bash runs interactively.
"--init-file"
#$(plain-file "test_bashrc_d.sh"
"\
. /etc/bashrc
set -e -x
test -f /etc/bashrc.d/test_bashrc_d.sh
test \"$BASHRC_D_OK\" = yes"))
marionette)))
(test-equal "special files"
'#$special-files
(marionette-eval
@ -585,15 +598,23 @@ functionality tests, using the given KERNEL.")
(operating-system
(inherit %simple-os)
(kernel kernel)
(services (cons (service
etc-profile-d-service-type
(list (plain-file
"test_profile_d.sh"
"export PROFILE_D_OK=yes\n")
(plain-file
"invalid-name"
"not a POSIX script -- ignore me")))
%base-services)))
(services (cons* (service
etc-profile-d-service-type
(list (plain-file
"test_profile_d.sh"
"export PROFILE_D_OK=yes\n")
(plain-file
"invalid-name"
"not a POSIX script -- ignore me")))
(service
etc-bashrc-d-service-type
(list (plain-file
"test_bashrc_d.sh"
"export BASHRC_D_OK=yes\n")
(plain-file
"invalid-name"
"not a Bash script -- ignore me")))
%base-services)))
#:imported-modules '((gnu services herd)
(guix combinators))))
(vm (virtual-machine os)))