This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin 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: $HOME Directory Relocation


Michael A Chase wrote:
 >> Since no login occurs, place it in your batch file calling bash, or in
 >> /etc/profile like I do. Here is my /etc/profile that correct many such
 >> environment variable problems I found over the time:

 > The problem with setting HOME to a fixed value in cygwin.bat or
 > /etc/profile is that limits your cygwin installation to a single user.
 > That's why the default /etc/profile allows $HOME to be passed
 > through from the user's Windows environment.

I never understood this about the default /etc/profile. If I run a 
mkpasswd -d (since I'm in a domain) I see the home field properly 
formatted from the NT domain controller (except I change it to 
/home/$USER and use a mount for /home under Cygwin). Thus my 
/etc/profile is:

USER="`id -un`"
HOME=`grep ^$USER: /etc/passwd | cut -f6 -d:`
SHELL=`grep ^$USER: /etc/passwd | cut -f7 -d:`

# Set up USER's home directory
if [ -z "$HOME" ]; then
  echo "WARNING: HOME not set! Defaulting to /home/$USER."
  HOME="/home/$USER"
fi

if [ ! -d "$HOME" ]; then
  echo "WARNING: HOME directory did not exist! Logging in with HOME = /tmp"
  HOME="/tmp"
fi

export HOME USER SHELL


-- 
Salira <http://www.salira.com>

Ethernet Simple, Fiber Fast

------------------------------------------------------------------------
5751 Patrick Henry Drive
Santa Clara, California 95054
Phone: (408)-855-8860x121
Email: ADeFaria@Salira.com 
<mailto:Andrew%20DeFaria%20%3CADeFaria@Salira.com%3E>
Web: http://www.salira.com

Andrew DeFaria <http://www.defaria.com>

Clearcase Administrator
Email: Andrew@DeFaria.com <mailto:Andrew@DeFaria.com>
Home http://www.defaria.com




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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