guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] scripts: environment: Ignore user shell when spawning container.


From: David Thompson
Subject: [PATCH] scripts: environment: Ignore user shell when spawning container.
Date: Sun, 01 Nov 2015 18:40:58 -0500
User-agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu)

Cross this one off the TODO list, Ludo. ;)

>From 655edf899710544d681acacab93f4f671962fc49 Mon Sep 17 00:00:00 2001
From: David Thompson <address@hidden>
Date: Sun, 1 Nov 2015 18:34:53 -0500
Subject: [PATCH] scripts: environment: Ignore user shell when spawning
 container.

* guix/scripts/environment.scm (%default-options): Remove 'exec'
  association.
  (guix-environment): If the user didn't specify a command, use the
  default shell, or use /bin/sh when a container is requested.
---
 guix/scripts/environment.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index f9ab9a4..45b54a9 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -160,8 +160,7 @@ COMMAND or an interactive shell in that environment.\n"))
 
 (define %default-options
   ;; Default to opening a new shell.
-  `((exec . (,%default-shell))
-    (system . ,(%current-system))
+  `((system . ,(%current-system))
     (substitutes? . #t)
     (max-silent-time . 3600)
     (verbosity . 0)))
@@ -447,7 +446,14 @@ Otherwise, return the derivation for the Bash package."
            (network?   (assoc-ref opts 'network?))
            (bootstrap? (assoc-ref opts 'bootstrap?))
            (system     (assoc-ref opts 'system))
-           (command    (assoc-ref opts 'exec))
+           (command    (or (assoc-ref opts 'exec)
+                           ;; Spawn a shell if the user didn't specify
+                           ;; anything in particular.
+                           (if container?
+                               ;; The user's shell is likely not available
+                               ;; within the container.
+                               '("/bin/sh")
+                               (list %default-shell))))
            (packages   (options/resolve-packages opts))
            (mappings   (pick-all opts 'file-system-mapping))
            (inputs     (delete-duplicates
-- 
2.5.0

-- 
David Thompson
GPG Key: 0FF1D807

reply via email to

[Prev in Thread] Current Thread [Next in Thread]