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


Hi Laurence,

I tried to correlate Window's home and Cygwin's home by the following lines
in /etc/profile. I end up mounting /home to the "Profile" directory of
Windows (wherever it may be in the different versions) and set home
according to $USERPROFILE that is set by the system. This gives a quite
natural Unix feeling for "ls /home", although "ls ~<User>" just works for my
own account.

====== snip = snap =========
COMMON_DESKTOP=`regtool get
'\HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders\Common Desktop'`
ALLHOME=`cygpath -u "$COMMON_DESKTOP/../.."`
ALLHOME=`cygpath -wsa "$ALLHOME" | tr [a-z] [A-Z]`
if [ ! -d /home ]; then
	mkdir /home
fi
if [ "$ALLHOME" != "`cygpath -wsa /home`" ]; then
	echo Mounting `cygpath -wsa $ALLHOME` to /home
	mount -s -b -f "`cygpath -wsa $ALLHOME`" /home > /dev/null 2>&1
fi
unset ALLHOME COMMON_DESKTOP

USER="`id -un`"

# Set up USER's home directory
if [ -z "$HOME" ]; then
	HOME=`cygpath -ua "$USERPROFILE"`
fi
HOME=`cygpath -wsa "$USERPROFILE"`
HOME=`cygpath -ua "$HOME"`
export HOME USER
====== snip = snap =========

Another benefit: Your settings are part of the Window's profile, i.e. can be
shared for your account automatically in a server environment for different
machines.

Regards,
Jörg

--
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]