all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] environment: Set a default value for PS1.
@ 2016-03-28  1:22 David Thompson
  2016-03-28 16:39 ` Ludovic Courtès
  2016-03-30 13:28 ` Cyril Roelandt
  0 siblings, 2 replies; 6+ messages in thread
From: David Thompson @ 2016-03-28  1:22 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

Here's a hopefully uncontroversial patch that sets PS1 in 'guix
environment' containers to something more friendly than what bash shows
by default when PS1 is unset.  OK to push?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-environment-Set-a-default-value-for-PS1.patch --]
[-- Type: text/x-patch, Size: 943 bytes --]

From 10741ce4e09c5990e70c94f5ed650b3561d042a0 Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Sun, 27 Mar 2016 21:20:19 -0400
Subject: [PATCH] environment: Set a default value for PS1.

* guix/scripts/environment.scm (launch-environment/container): Set PS1
  during container initialization.
---
 guix/scripts/environment.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index fc75d78..6aa5ad0 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -425,6 +425,9 @@ host file systems to mount inside the container."
             (mkdir-p "/bin")
             (symlink bash "/bin/sh")
 
+            ;; Set a reasonable default PS1.
+            (setenv "PS1" "[ENV] \\u@\\h \\w\\$ ")
+
             ;; Setup directory for temporary files.
             (mkdir-p "/tmp")
             (for-each (lambda (var)
-- 
2.7.3


[-- Attachment #3: Type: text/plain, Size: 20 bytes --]


-- 
David Thompson

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] environment: Set a default value for PS1.
  2016-03-28  1:22 [PATCH] environment: Set a default value for PS1 David Thompson
@ 2016-03-28 16:39 ` Ludovic Courtès
  2016-03-30 13:10   ` Thompson, David
  2016-03-30 13:28 ` Cyril Roelandt
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2016-03-28 16:39 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> skribis:

> From 10741ce4e09c5990e70c94f5ed650b3561d042a0 Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Sun, 27 Mar 2016 21:20:19 -0400
> Subject: [PATCH] environment: Set a default value for PS1.
>
> * guix/scripts/environment.scm (launch-environment/container): Set PS1
>   during container initialization.
> ---
>  guix/scripts/environment.scm | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
> index fc75d78..6aa5ad0 100644
> --- a/guix/scripts/environment.scm
> +++ b/guix/scripts/environment.scm
> @@ -425,6 +425,9 @@ host file systems to mount inside the container."
>              (mkdir-p "/bin")
>              (symlink bash "/bin/sh")
>  
> +            ;; Set a reasonable default PS1.
> +            (setenv "PS1" "[ENV] \\u@\\h \\w\\$ ")

Maybe make it '\u@\h \w [env]\$ ' to match what /etc/skel/.bashrc does?

OK to push, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] environment: Set a default value for PS1.
  2016-03-28 16:39 ` Ludovic Courtès
@ 2016-03-30 13:10   ` Thompson, David
  0 siblings, 0 replies; 6+ messages in thread
From: Thompson, David @ 2016-03-30 13:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Mon, Mar 28, 2016 at 12:39 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> David Thompson <dthompson2@worcester.edu> skribis:
>
>> From 10741ce4e09c5990e70c94f5ed650b3561d042a0 Mon Sep 17 00:00:00 2001
>> From: David Thompson <dthompson2@worcester.edu>
>> Date: Sun, 27 Mar 2016 21:20:19 -0400
>> Subject: [PATCH] environment: Set a default value for PS1.
>>
>> * guix/scripts/environment.scm (launch-environment/container): Set PS1
>>   during container initialization.
>> ---
>>  guix/scripts/environment.scm | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
>> index fc75d78..6aa5ad0 100644
>> --- a/guix/scripts/environment.scm
>> +++ b/guix/scripts/environment.scm
>> @@ -425,6 +425,9 @@ host file systems to mount inside the container."
>>              (mkdir-p "/bin")
>>              (symlink bash "/bin/sh")
>>
>> +            ;; Set a reasonable default PS1.
>> +            (setenv "PS1" "[ENV] \\u@\\h \\w\\$ ")
>
> Maybe make it '\u@\h \w [env]\$ ' to match what /etc/skel/.bashrc does?

Sure!  Pushed with that change.

 Thanks!

- Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] environment: Set a default value for PS1.
  2016-03-28  1:22 [PATCH] environment: Set a default value for PS1 David Thompson
  2016-03-28 16:39 ` Ludovic Courtès
@ 2016-03-30 13:28 ` Cyril Roelandt
  2016-03-30 13:32   ` Thompson, David
  1 sibling, 1 reply; 6+ messages in thread
From: Cyril Roelandt @ 2016-03-30 13:28 UTC (permalink / raw)
  To: guix-devel

On 03/28/2016 03:22 AM, David Thompson wrote:
> +            ;; Set a reasonable default PS1.
> +            (setenv "PS1" "[ENV] \\u@\\h \\w\\$ ")
> +
Would it be an acceptable feature to let the user ask for their own PS1?
I very often have to make sure my code works on both Python 2.7 and
Python 3.4, and it would be very helpful to have environments named
"(py27)" and "(py34)" instead of just "[ENV]".

Cyril.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] environment: Set a default value for PS1.
  2016-03-30 13:28 ` Cyril Roelandt
@ 2016-03-30 13:32   ` Thompson, David
  2016-03-30 21:27     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Thompson, David @ 2016-03-30 13:32 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: guix-devel

On Wed, Mar 30, 2016 at 9:28 AM, Cyril Roelandt <tipecaml@gmail.com> wrote:
> On 03/28/2016 03:22 AM, David Thompson wrote:
>> +            ;; Set a reasonable default PS1.
>> +            (setenv "PS1" "[ENV] \\u@\\h \\w\\$ ")
>> +
> Would it be an acceptable feature to let the user ask for their own PS1?
> I very often have to make sure my code works on both Python 2.7 and
> Python 3.4, and it would be very helpful to have environments named
> "(py27)" and "(py34)" instead of just "[ENV]".

I should have made the commit message better.  This change only
applies to containers.  If you want to set your own PS1 there, source
a script in the container.

- Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] environment: Set a default value for PS1.
  2016-03-30 13:32   ` Thompson, David
@ 2016-03-30 21:27     ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2016-03-30 21:27 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel

"Thompson, David" <dthompson2@worcester.edu> skribis:

> On Wed, Mar 30, 2016 at 9:28 AM, Cyril Roelandt <tipecaml@gmail.com> wrote:
>> On 03/28/2016 03:22 AM, David Thompson wrote:
>>> +            ;; Set a reasonable default PS1.
>>> +            (setenv "PS1" "[ENV] \\u@\\h \\w\\$ ")
>>> +
>> Would it be an acceptable feature to let the user ask for their own PS1?
>> I very often have to make sure my code works on both Python 2.7 and
>> Python 3.4, and it would be very helpful to have environments named
>> "(py27)" and "(py34)" instead of just "[ENV]".
>
> I should have made the commit message better.  This change only
> applies to containers.  If you want to set your own PS1 there, source
> a script in the container.

Specifically, you can have something like this in ~/.bashrc (this is the
default on GuixSD):

--8<---------------cut here---------------start------------->8---
# Adjust the prompt depending on whether we're in 'guix environment'.
if [ -n "$GUIX_ENVIRONMENT" ]
then
    export PS1='\u@\h \w [env]\$ '
else
    export PS1='\u@\h \w\$ '
fi
--8<---------------cut here---------------end--------------->8---

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-30 21:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-28  1:22 [PATCH] environment: Set a default value for PS1 David Thompson
2016-03-28 16:39 ` Ludovic Courtès
2016-03-30 13:10   ` Thompson, David
2016-03-30 13:28 ` Cyril Roelandt
2016-03-30 13:32   ` Thompson, David
2016-03-30 21:27     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.