This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problems with XFree


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]