This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: using cygpath for setting $HOME in multiuser and multicomputer environment
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: cygwin-xfree at cygwin dot com
- Date: Mon, 24 Mar 2003 14:57:24 -0500 (EST)
- Subject: Re: using cygpath for setting $HOME in multiuser and multicomputer environment
- Reply-to: cygwin-xfree at cygwin dot com
On Mon, 24 Mar 2003, Stefan Schiebeler wrote:
> Hi,
> since I plan to distribute LyX in my universitiy's department I have to
> consider a very inhomogenous computer environment, ranging from PCs with
> network, without, from Win9x to XP, with homedirs on servers, to
> what-ever-you-want.
>
> I want to set $HOME to the value stored in
> \HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
> Folders\AppData
>
> my /etc/profile looks this way:
>
> snipp----------------
>
> PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
>
> USER="`id -un`"
>
> # Set up USER's home directory
> # if [ -z "$HOME" ]; then
> # HOME="/home/$USER"
> # fi
>
> APPDATA=`regtool get "\HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\AppData"`
> FOO=`cygpath -ws "$APPDATA"`
> HOME=`cygpath -u "$FOO"`
>
> if [ ! -d "$HOME" ]; then
> mkdir -p "$HOME"
> fi
>
> export HOME USER
>
> for i in /etc/profile.d/*.sh ; do
> if [ -f $i ]; then
> . $i
> fi
> done
>
> export MAKE_MODE=unix
> export PS1='\[\033]0;\w\007
> \033[32m\]\u at \h \[\033[33m\w\033[0m\]
> $ '
>
> cd "$HOME"
>
> snapp----------------
>
> starting bash (cygwin.bat) with user Admin on SCHIEBELER1 cygwin sets $HOME
> correctly to
>
> /cygdrive/f/DOKUME~1/ADMIN~1.SCH/ANWEND~1
>
> To tart LyX I used the provided startlyx.bat
>
> snipp----------------
>
> @echo off
> SET DISPLAY=127.0.0.1:0.0
> SET CYGWIN_ROOT=E:\Programme\office\cygwin
> SET PATH=.;%CYGWIN_ROOT%\bin;%CYGWIN_ROOT%\usr\X11R6\bin;%PATH%
>
> if not exist %CYGWIN_ROOT%\tmp\.X11-unix\X0 goto CLEANUP-FINISH
> attrib -s %CYGWIN_ROOT%\tmp\.X11-unix\X0
> del %CYGWIN_ROOT%\tmp\.X11-unix\X0
>
> :CLEANUP-FINISH
> if exist %CYGWIN_ROOT%\tmp\.X11-unix rmdir %CYGWIN_ROOT%\tmp\.X11-unix
>
> if "%OS%" == "Windows_NT" goto USE-B-SWITCH
>
> echo startxwin.bat - Starting on Windows 95/98/Me
>
> start XWin
>
> run xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e
> /usr/bin/bash
>
> run twm
>
> goto END
>
> :USE-B-SWITCH
>
> echo startlyx.bat - Starting LyX on Windows NT/2000
>
> start XWin -screen 0 1250 940
>
> run twm
>
> run lyxwin32.exe -geometry 1250x900+0+0 %1 %2 %3 %4 %5
>
>
> :END
>
> run xsetroot -solid aquamarine4
>
> snapp----------------
>
> if I do so unfortunately nothing appears except an empty anquamarine-colored
> Cygwin/Xfree86 rl window.
>
> if I click and start an xterm, HOME is set to /home/Admin (which doesn't
> exist) and ps shows a cygpath process. After killing that process there is one
> bash process more than before and another cygpath process running - killing
> that LyX starts but without a proper set $HOME.
>
> Can enyone point me to my mistake?
>
> regards
> Stefan
Stefan,
Any particular reason you use the -s option to cygpath? The following
should work (quoting adjusted as well):
APPDATA="`regtool get '\HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\AppData'`"
HOME="`cygpath -u "$APPDATA"`"
Also be aware that bash doesn't read /etc/profile unless it's a login
shell (i.e., has the --login option). You can also pass the "-ls" option
to the xterm for that effect.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha at cs dot nyu dot edu
ZZZzz /,`.-'`' -. ;-;;,_ igor at watson dot ibm dot com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
-- /usr/games/fortune