problems with XFree

Nicholas Wourms nwourms@yahoo.com
Thu Jul 25 05:05:00 GMT 2002


Jehan,

As a rule of thumb, packages should *never* modify the /etc/profile
script (even if you do back it up).  This is a big no-no, as most
*nix people would tell you.  If you insist on getting into a
discussion on why this is, then so be it.  Instead, create 2 scripts
(a csh and a sh) and drop them into the /etc/profile.d/ directory. 
This way we play it safe and every one is happy.  Also, your scripts
should check to see if the path has already been set, if it has, then
don't set it again.  Remeber, the more entries in the path, the
slower Cygwin will operate.

Cheers,
Nicholas
--- Jehan <nahor@bravobrava.com> wrote:
> Harold Hunt wrote:
> > Jehan,
> > 
> > Excellent summarization of the thread regarding how we can add
> > /usr/X11R6/bin to the path.
> > 
> > Looks like we had Dave Cook and Robert Collins discussing the
> best way to do
> > things but then the thread died.
> > 
> > I don't really think that I know how to implement the best
> solution here, so
> > I will just have to leave this up to others.
> 
> Here is an attempt to add the path into /etc/profile using a 
> post-install script.
> I first try to see if /etc/profile already sets the X path for
> people 
> who have customized it. So I grep for something of the form
> 	PATH=..../usr/X11R6/bin....
> 
> If I find such a line then I do nothing.
> If the line isn't here, I create a new /etc/profile with the lines:
> 	if ! echo $PATH | /bin/grep -q "/usr/X11R6/bin" ; then
>   	  PATH="$PATH:/usr/X11R6/bin"
>   	fi
> at the top of the file, as suggested in the old thread.
> Just to be safe, the old profile is renamed /etc/profile.old.
> 
> 	Jehan
> > #!/bin/bash
> 
> TMP_PROFILE=/etc/profile.new
> 
> if ! /bin/grep -q "PATH=.*/usr/X11R6/bin" /etc/profile; then
> 
>   cat > $TMP_PROFILE << EOF
> if ! echo \$PATH | /bin/grep -q "/usr/X11R6/bin" ; then
>   PATH="\$PATH:/usr/X11R6/bin"
> fi
> 
> EOF
> 
>   cat /etc/profile >> $TMP_PROFILE
>   
>   /bin/mv /etc/profile /etc/profile.old
>   /bin/mv $TMP_PROFILE /etc/profile
> fi
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



More information about the Cygwin-xfree mailing list