From 4c017ccfe56a8887bf26faaea62d60501d7cc4f6 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Tue, 6 May 2025 16:16:09 +0900 Subject: 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 --- gnu/tests/base.scm | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 09fc91383df..0f31c152e0f 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -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))) -- cgit v1.3