unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2]: system: Cleanup bash startup files
@ 2014-12-07  4:11 宋文武
  2014-12-07 20:40 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: 宋文武 @ 2014-12-07  4:11 UTC (permalink / raw)
  To: guix-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-system-Cleanup-bash-startup-files.patch --]
[-- Type: text/x-patch, Size: 3792 bytes --]

From feba8aac3e4b0ae0255e034b2b7cc12b405ce675 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Fri, 5 Dec 2014 20:01:07 +0800
Subject: [PATCH 1/2] system: Cleanup bash startup files.

* gnu/system.scm (etc-directory) (bashrc): Rename to (profile).
  'LC_ALL': Change to 'LANG'.
  'CPATH', 'LIBRARY_PATH': Remove.
  'PS1', 'alias ls', 'alias ll': Move to ...
* gnu/system/shadow.scm (default-skeletons):
  (.bashrc): ... here. Don't source /etc/profile.
  (.bash_profile): New skeleton.
---
 gnu/system.scm        | 15 +++++----------
 gnu/system/shadow.scm | 13 +++++++++----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index e1ed1a2..9b8cf87 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -384,11 +384,10 @@ This is the GNU system.  Welcome.\n")
        (nsswitch   (text-file "nsswitch.conf"
                               "hosts: files dns\n"))
 
-       ;; TODO: Generate bashrc from packages' search-paths.
-       (bashrc    (text-file* "bashrc"  "
-export PS1='\\u@\\h \\w\\$ '
-
-export LC_ALL=\"" locale "\"
+       ;; Startup file for POSIX-compliant login shells, which set system-wide
+       ;; environment variables.
+       (profile    (text-file* "profile"  "\
+export LANG=\"" locale "\"
 export TZ=\"" timezone "\"
 export TZDIR=\"" tzdata "/share/zoneinfo\"
 
@@ -397,11 +396,7 @@ export LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
 
 export PATH=$HOME/.guix-profile/bin:/run/current-system/profile/bin
 export PATH=/run/setuid-programs:/run/current-system/profile/sbin:$PATH
-export CPATH=$HOME/.guix-profile/include:" profile "/include
-export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib
 export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
-alias ls='ls -p --color'
-alias ll='ls -l'
 "))
        (skel      (skeleton-directory skeletons)))
     (file-union "etc"
@@ -414,7 +409,7 @@ alias ll='ls -l'
                   ("nsswitch.conf" ,#~#$nsswitch)
                   ("skel" ,#~#$skel)
                   ("shells" ,#~#$shells)
-                  ("profile" ,#~#$bashrc)
+                  ("profile" ,#~#$profile)
                   ("hosts" ,#~#$hosts-file)
                   ("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
                                                  #$timezone))
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 6970021..4a2322b 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -115,9 +115,13 @@
         (copy-file (car (find-files #$guile-wm "wm-init-sample.scm"))
                    #$output)))
 
-  (mlet %store-monad ((bashrc (text-file "bashrc" "\
-# Allow non-login shells such as an xterm to get things right.
-test -f /etc/profile && source /etc/profile\n"))
+  (mlet %store-monad ((profile (text-file "bash_profile" "\
+# Honor per-interactive-shell startup file
+if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n"))
+                      (bashrc (text-file "bashrc" "\
+PS1='\\u@\\h \\w\\$ '
+alias ls='ls -p --color'
+alias ll='ls -l'\n"))
                       (guile-wm (gexp->derivation "guile-wm" copy-guile-wm
                                                   #:modules
                                                   '((guix build utils))))
@@ -127,7 +131,8 @@ XTerm*metaSendsEscape: true\n"))
                       (gdbinit   (text-file "gdbinit" "\
 # Tell GDB where to look for separate debugging files.
 set debug-file-directory ~/.guix-profile/lib/debug\n")))
-    (return `((".bashrc" ,bashrc)
+    (return `((".bash_profile" ,profile)
+              (".bashrc" ,bashrc)
               (".Xdefaults" ,xdefaults)
               (".guile-wm" ,guile-wm)
               (".gdbinit" ,gdbinit)))))
-- 
2.1.2

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

* Re: [PATCH 1/2]: system: Cleanup bash startup files
  2014-12-07  4:11 [PATCH 1/2]: system: Cleanup bash startup files 宋文武
@ 2014-12-07 20:40 ` Ludovic Courtès
  2014-12-08 11:05   ` 宋文武
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2014-12-07 20:40 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> From feba8aac3e4b0ae0255e034b2b7cc12b405ce675 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Fri, 5 Dec 2014 20:01:07 +0800
> Subject: [PATCH 1/2] system: Cleanup bash startup files.
>
> * gnu/system.scm (etc-directory) (bashrc): Rename to (profile).

Should be:

* gnu/system.scm (etc-directory)[bashrc]: Rename to 'profile'.

>   'LC_ALL': Change to 'LANG'.
>   'CPATH', 'LIBRARY_PATH': Remove.
>   'PS1', 'alias ls', 'alias ll': Move to ...
> * gnu/system/shadow.scm (default-skeletons):
>   (.bashrc): ... here. Don't source /etc/profile.
>   (.bash_profile): New skeleton.

Just:

* gnu/system/shadow.scm (default-skeletons): Rename '.bashrc' to
  '.bash_profile'.  Don't source /etc/profile.

OK to push with these changes.

(We’ll see what to do with CPATH/LIBRARY_PATH afterwards.)

Ludo’.

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

* Re: [PATCH 1/2]: system: Cleanup bash startup files
  2014-12-07 20:40 ` Ludovic Courtès
@ 2014-12-08 11:05   ` 宋文武
  2014-12-08 20:39     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: 宋文武 @ 2014-12-08 11:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> From feba8aac3e4b0ae0255e034b2b7cc12b405ce675 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
>> Date: Fri, 5 Dec 2014 20:01:07 +0800
>> Subject: [PATCH 1/2] system: Cleanup bash startup files.
>>
>> * gnu/system.scm (etc-directory) (bashrc): Rename to (profile).
>
> Should be:
>
> * gnu/system.scm (etc-directory)[bashrc]: Rename to 'profile'.
>
>>   'LC_ALL': Change to 'LANG'.
>>   'CPATH', 'LIBRARY_PATH': Remove.
>>   'PS1', 'alias ls', 'alias ll': Move to ...
>> * gnu/system/shadow.scm (default-skeletons):
>>   (.bashrc): ... here. Don't source /etc/profile.
>>   (.bash_profile): New skeleton.
>
> Just:
>
> * gnu/system/shadow.scm (default-skeletons): Rename '.bashrc' to
>   '.bash_profile'.  Don't source /etc/profile.
>
> OK to push with these changes.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-system-Cleanup-bash-startup-files.patch --]
[-- Type: text/x-patch, Size: 3662 bytes --]

From e660764aebc524b1ed22c594aa45784b510de3e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Fri, 5 Dec 2014 20:01:07 +0800
Subject: [PATCH] system: Cleanup bash startup files.

* gnu/system.scm (etc-directory) (bashrc): Rename to 'profile'.
* gnu/system/shadow.scm (default-skeletons): Rename '.bashrc' to
  '.bash_profile'. Don't source /etc/profile.
---
 gnu/system.scm        | 15 +++++----------
 gnu/system/shadow.scm | 13 +++++++++----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index 899a16d..5cb6c9e 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -386,11 +386,10 @@ This is the GNU system.  Welcome.\n")
        (nsswitch   (text-file "nsswitch.conf"
                               "hosts: files dns\n"))
 
-       ;; TODO: Generate bashrc from packages' search-paths.
-       (bashrc    (text-file* "bashrc"  "
-export PS1='\\u@\\h \\w\\$ '
-
-export LC_ALL=\"" locale "\"
+       ;; Startup file for POSIX-compliant login shells, which set system-wide
+       ;; environment variables.
+       (profile    (text-file* "profile"  "\
+export LANG=\"" locale "\"
 export TZ=\"" timezone "\"
 export TZDIR=\"" tzdata "/share/zoneinfo\"
 
@@ -399,11 +398,7 @@ export LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
 
 export PATH=$HOME/.guix-profile/bin:/run/current-system/profile/bin
 export PATH=/run/setuid-programs:/run/current-system/profile/sbin:$PATH
-export CPATH=$HOME/.guix-profile/include:" profile "/include
-export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib
 export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
-alias ls='ls -p --color'
-alias ll='ls -l'
 "))
        (skel      (skeleton-directory skeletons)))
     (file-union "etc"
@@ -416,7 +411,7 @@ alias ll='ls -l'
                   ("nsswitch.conf" ,#~#$nsswitch)
                   ("skel" ,#~#$skel)
                   ("shells" ,#~#$shells)
-                  ("profile" ,#~#$bashrc)
+                  ("profile" ,#~#$profile)
                   ("hosts" ,#~#$hosts-file)
                   ("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
                                                  #$timezone))
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 6970021..4a2322b 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -115,9 +115,13 @@
         (copy-file (car (find-files #$guile-wm "wm-init-sample.scm"))
                    #$output)))
 
-  (mlet %store-monad ((bashrc (text-file "bashrc" "\
-# Allow non-login shells such as an xterm to get things right.
-test -f /etc/profile && source /etc/profile\n"))
+  (mlet %store-monad ((profile (text-file "bash_profile" "\
+# Honor per-interactive-shell startup file
+if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n"))
+                      (bashrc (text-file "bashrc" "\
+PS1='\\u@\\h \\w\\$ '
+alias ls='ls -p --color'
+alias ll='ls -l'\n"))
                       (guile-wm (gexp->derivation "guile-wm" copy-guile-wm
                                                   #:modules
                                                   '((guix build utils))))
@@ -127,7 +131,8 @@ XTerm*metaSendsEscape: true\n"))
                       (gdbinit   (text-file "gdbinit" "\
 # Tell GDB where to look for separate debugging files.
 set debug-file-directory ~/.guix-profile/lib/debug\n")))
-    (return `((".bashrc" ,bashrc)
+    (return `((".bash_profile" ,profile)
+              (".bashrc" ,bashrc)
               (".Xdefaults" ,xdefaults)
               (".guile-wm" ,guile-wm)
               (".gdbinit" ,gdbinit)))))
-- 
2.1.2


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

Is this fine?
>
> (We’ll see what to do with CPATH/LIBRARY_PATH afterwards.)
OK, personlly, I won't install libraries as system packages.
For user profile, setting the desired vars in ~/.bashrc is just a
trivial step for me.
>
> Ludo’.

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

* Re: [PATCH 1/2]: system: Cleanup bash startup files
  2014-12-08 11:05   ` 宋文武
@ 2014-12-08 20:39     ` Ludovic Courtès
  2014-12-09 10:54       ` 宋文武
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2014-12-08 20:39 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> From e660764aebc524b1ed22c594aa45784b510de3e2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Fri, 5 Dec 2014 20:01:07 +0800
> Subject: [PATCH] system: Cleanup bash startup files.
>
> * gnu/system.scm (etc-directory) (bashrc): Rename to 'profile'.
> * gnu/system/shadow.scm (default-skeletons): Rename '.bashrc' to
>   '.bash_profile'. Don't source /etc/profile.

OK to push!

Thank you,
Ludo’.

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

* Re: [PATCH 1/2]: system: Cleanup bash startup files
  2014-12-08 20:39     ` Ludovic Courtès
@ 2014-12-09 10:54       ` 宋文武
  0 siblings, 0 replies; 5+ messages in thread
From: 宋文武 @ 2014-12-09 10:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> From e660764aebc524b1ed22c594aa45784b510de3e2 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
>> Date: Fri, 5 Dec 2014 20:01:07 +0800
>> Subject: [PATCH] system: Cleanup bash startup files.
>>
>> * gnu/system.scm (etc-directory) (bashrc): Rename to 'profile'.
>> * gnu/system/shadow.scm (default-skeletons): Rename '.bashrc' to
>>   '.bash_profile'. Don't source /etc/profile.
>
> OK to push!
Pushed, thanks for the review!
>
> Thank you,
> Ludo’.

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

end of thread, other threads:[~2014-12-09 10:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-07  4:11 [PATCH 1/2]: system: Cleanup bash startup files 宋文武
2014-12-07 20:40 ` Ludovic Courtès
2014-12-08 11:05   ` 宋文武
2014-12-08 20:39     ` Ludovic Courtès
2014-12-09 10:54       ` 宋文武

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).