delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/08/21/06:17:26

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Achim Gratz <Stromeko AT NexGo DOT DE>
Subject: /etc/profile
Date: Tue, 21 Aug 2012 10:16:28 +0000 (UTC)
Lines: 71
Message-ID: <loom.20120821T114938-389@post.gmane.org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I'm removing the Windows PATH in my startup scripts since there's nothing in
there that I think should be accessible from Cygwin.

For (t)csh this is easy enough to do with dropping a script into /etc/profile.d
that gets executed first, but there's no such provision for sh and the ilk since
PATH is set up already before it get there.  Now, unless profile gets changed I
can still cut off "/usr/local/bin:/usr/bin:" with a profile.d script, but I
think it might be preferrable that the Windows path gets recorded into
ORIGINAL_PATH or some similar name at the beginning of profile.  It would then
be a simple matter to later add the Windows path where appropriate, but I don't
think the default path should have it at all.

Also, there are two things in profile that may admit slight improvement (a place
where LC_COLLATE is specified just for one command and better guarding against a
missing or non-cdable /etc/skel).

Patch:
--- /etc/defaults/etc/profile   2012-02-27 22:03:33.000000000 +0100
+++ /etc/profile        2012-08-21 12:12:42.617969800 +0200
@@ -29,7 +29,8 @@
 # software to override 'system' software.
 # Modifying these default path settings can be done in different ways.
 # To learn more about startup files, refer to your shell's man page.
-PATH="/usr/local/bin:/usr/bin:${PATH}"
+ORIGINAL_PATH=$PATH
+PATH="/usr/local/bin:/usr/bin"
 MANPATH="/usr/local/man:/usr/share/man:/usr/man:${MANPATH}"
 INFOPATH="/usr/local/info:/usr/share/info:/usr/info:${INFOPATH}"

@@ -75,14 +76,17 @@
     echo
     echo "They will never be overwritten nor automatically updated."
     echo
-    cd /etc/skel || echo "WARNING: Failed attempt to cd into /etc/skel!"
-    /usr/bin/find . -type f | while read f; do
-      fDest=${f#.}
-      if [ ! -e "${HOME}${fDest}" -a ! -L "${HOME}${fDest}" ]; then
-        /usr/bin/install -D -p -v "${f}" "${HOME}/${fDest}"
-      fi
-    done
-    unset fDest
+    if ! cd /etc/skel ; then
+      echo "WARNING: Failed attempt to cd into /etc/skel!"
+    else
+      /usr/bin/find . -type f | while read f; do
+       fDest=${f#.}
+       if [ ! -e "${HOME}${fDest}" -a ! -L "${HOME}${fDest}" ]; then
+          /usr/bin/install -D -p -v "${f}" "${HOME}/${fDest}"
+       fi
+      done
+      unset fDest
+    fi
   else
     echo "${HOME} could not be created."
     { [ -d "${TEMP}" ] && HOME="${TEMP}"; } ||
@@ -103,7 +107,7 @@
 # Shell dependent settings
 profile_d ()
 {
-  for file in $(export LC_COLLATE=C; echo /etc/profile.d/*.$1); do
+  for file in $(LC_COLLATE=C echo /etc/profile.d/*.$1); do
     [ -e "${file}" ] && . "${file}"
   done
   unset file



Regards,
Achim.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019