diff options
| author | John Kehayias <john.kehayias@protonmail.com> | 2022-07-20 23:46:45 -0400 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-10-13 09:19:08 +0200 |
| commit | c7ba5f38b80433b040d3946b8fc0b1e8621ba30a (patch) | |
| tree | 44b431da8e97b51ea3402323895c8a9daf606b73 /tests | |
| parent | 3d1d29e440910a99531b738f8f090de2cd4df9da (diff) | |
environment: Add '--emulate-fhs'.
* guix/scripts/environment.scm (show-environment-options-help, %options): Add
'--emulate-fhs'.
(setup-fhs): New procedure. Setup for the Filesystem Hierarchy Standard (FHS)
container. Defines and uses FHS-SYMLINKS and LINK-CONTENTS to create FHS
expected directories and creates /etc/ld.so.conf.
(launch-environment): Add 'emulate-fhs?' key and implement it to set $PATH and
generate /etc/ld.so.cache before calling COMMAND.
(launch-environment/container): Add 'emulate-fhs?' and 'setup-hook' keys and
implement them. Define and use FHS-MAPPINGS, to set up additional bind mounts
in the container to follow FHS expectations.
(guix-environment*): Add glibc-for-fhs to the container packages when
'emulate-fhs?' key is in OPTS.
* doc/guix.texi (Invoking guix shell): Document '--emulate-fhs'.
(Invoking guix environment): Document '--emulate-fhs'.
* tests/guix-environment-container.sh: Add tests for '--emulate-fhs'.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/guix-environment-container.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index 2e238c501d6..898c57f41bf 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh | |||
| @@ -197,3 +197,37 @@ then false; | |||
| 197 | else | 197 | else |
| 198 | test $? -gt 127 | 198 | test $? -gt 127 |
| 199 | fi | 199 | fi |
| 200 | |||
| 201 | # Test the Filesystem Hierarchy Standard (FHS) container option, --emulate-fhs (-F) | ||
| 202 | |||
| 203 | # As this option requires a glibc package (glibc-for-fhs), try to run these | ||
| 204 | # tests with the user's global store to make it easier to build or download a | ||
| 205 | # substitute. | ||
| 206 | storedir="`guile -c '(use-modules (guix config))(display %storedir)'`" | ||
| 207 | localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`" | ||
| 208 | NIX_STORE_DIR="$storedir" | ||
| 209 | GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket" | ||
| 210 | export NIX_STORE_DIR GUIX_DAEMON_SOCKET | ||
| 211 | |||
| 212 | if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))' | ||
| 213 | then | ||
| 214 | exit 77 | ||
| 215 | fi | ||
| 216 | |||
| 217 | # Test that the container has FHS specific files/directories. Note that /bin | ||
| 218 | # exists in a non-FHS container as it will contain sh, a symlink to the bash | ||
| 219 | # package, so we don't test for it. | ||
| 220 | guix environment -C --emulate-fhs --ad-hoc --bootstrap guile-bootstrap \ | ||
| 221 | -- guile -c '(exit (and (file-exists? "/etc/ld.so.cache") | ||
| 222 | (file-exists? "/lib") | ||
| 223 | (file-exists? "/sbin") | ||
| 224 | (file-exists? "/usr/bin") | ||
| 225 | (file-exists? "/usr/include") | ||
| 226 | (file-exists? "/usr/lib") | ||
| 227 | (file-exists? "/usr/libexec") | ||
| 228 | (file-exists? "/usr/sbin") | ||
| 229 | (file-exists? "/usr/share")))' | ||
| 230 | |||
| 231 | # Test that the ld cache was generated and can be successfully read. | ||
| 232 | guix environment -C --emulate-fhs --ad-hoc --bootstrap guile-bootstrap \ | ||
| 233 | -- guile -c '(execlp "ldconfig" "ldconfig" "-p")' | ||
