From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9801 invoked by alias); 30 May 2002 18:59:55 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 9790 invoked from network); 30 May 2002 18:59:54 -0000 Received: from unknown (HELO smtp.idealapps.com) (216.217.129.55) by sources.redhat.com with SMTP; 30 May 2002 18:59:54 -0000 Received: from ddcmail.detroitdiesel.com (ddcmail.detroitdiesel.com [12.47.84.11]) by smtp.idealapps.com (8.11.4/8.11.4) with SMTP id g4UJ0Lm24045 for ; Thu, 30 May 2002 15:00:21 -0400 (EDT) Received: from 148.99.32.99 by ddcmail.detroitdiesel.com with ESMTP ( Detroit Diesel Mail Relay (MMS v4.7)); Thu, 30 May 2002 14:55:41 -0400 X-Server-Uuid: 28431ec2-fd89-11d2-a089-00a0c9f498e6 Received: by ddcexch.ddcnet.detroitdiesel.com with Internet Mail Service (5.5.2653.19) id ; Thu, 30 May 2002 14:59:49 -0400 Message-ID: <0DB4E7930F5CD411AC93009027EE744C09345B74@ddcexch.ddcnet.detroitdiesel.com> From: "Kilroy, David" To: "'cygwin@cygwin.com'" Subject: RE: Bash Here - Start Cygwin from a folders context menu Date: Thu, 30 May 2002 17:54:00 -0000 MIME-Version: 1.0 X-WSS-ID: 10E8AA26324658-01-01 Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C2080C.29FAFEA0" X-SW-Source: 2002-05/txt/msg01891.txt.bz2 ------_=_NextPart_000_01C2080C.29FAFEA0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1666 >From the recent discussion, I thought it a little silly that all the different incantations only worked for a particular shell/window combo. After a read of some older mailing list stuff discussing different ways of doing things I came up with a few modifications to the files Gerrit posted [diffs attached] It allows you to do any of: ./install bash ./install rxvt ./install [batch] And goes off and sets up your registry (and start up files in the case of batch) to do things in your preferred method. It is relatively easy to add command line incantations for other shells so that they can be provided for as well. Also: 1) Tries to leverage any existing cygwin.bat to create cygwin_indir.bat, if thats what you want. 2) Stops repeated additions to ~/.bashrc for repeated installs 3) handles missing ~/.bashrc 4) Uses bare bones rxvt startup line so the users .Xdefaults are used Gerrit, would you be interested in adding these changes (or similar) to the file you're already hosting? The FAQ can then deal with "but I want Cygwin Prompt Here to start ?sh, not bash" [assuming appropriate incantations are added]. Dave. Old thread reference: http://sources.redhat.com/ml/cygwin/2002-04/msg00647.html > From: Gerrit P. Haase [mailto:freeweb@nyckelpiga.de] > Subject: Re: Bash Here - Start Cygwin from a folders context menu > > Fetch the original from Glen Coakley: > http://www.users.qwest.net/~weissj/Cygwin/CygwinAddons.html > > AND please fetch the diff here: > http://koeln.convey.de/cywgin/CygwinPromptHere/ > > Or fetch the ready patched package at my site. > http://koeln.convey.de/cywgin/CygwinPromptHere/CygwinPromptHere-20020528.tar .gz ------_=_NextPart_000_01C2080C.29FAFEA0 Content-Type: application/octet-stream; name=cphinf.diff Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=cphinf.diff Content-length: 659 --- CygwinPromptHere.inf.tpl.orig 2002-05-28 10:02:06.000000000 -0400=0A= +++ CygwinPromptHere.inf.tpl 2002-05-30 12:54:40.000000000 -0400=0A= @@ -63,5 +63,7 @@=0A= CygwinPromptHereName=3D"Cygwin Prompt Here PowerToy"=0A= CygwinPromptHereAccel=3D"Cy&gwin Prompt Here PowerToy"=0A= UDHERE=3D"Software\Microsoft\Windows\CurrentVersion\Uninstall\CygwinPrompt= Here"=0A= +BATCH_SHELL_CMD=3D"cygwin_indir.bat ""%1"""=0A= +CMD_BASH_SHELL_CMD=3D"bin\bash.exe --login -c ""cd '%1'; exec bash"""=0A= +RXVT_BASH_SHELL_CMD=3D"bin\rxvt.exe -e /bin/bash.exe --login -c ""cd '%1';= exec bash"""=0A= CYGWIN_ROOT=3D=0A= -CYGWIN_SHELL_CMD=3D"cygwin_indir.bat ""%1"""=0A= ------_=_NextPart_000_01C2080C.29FAFEA0 Content-Type: application/octet-stream; name=install.diff Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=install.diff Content-length: 6511 --- install.orig 2002-05-28 10:02:06.000000000 -0400=0A= +++ install 2002-05-30 13:45:17.000000000 -0400=0A= @@ -11,13 +11,27 @@=0A= =20=0A= This 'install' will adapt to the version of Windows that you are using and= =0A= locate your cygwin root directory. It will modify the registry entries for= =0A= -Drives and Directories under HKEY_CLASSES_ROOT, add a cygwin_indir.bat fil= e in=0A= +Drives and Directories under HKEY_CLASSES_ROOT.=20=0A= +=0A= +The following are valid options:=0A= + bash - start bash from the default command shell=0A= + rxvt - start bash under rxvt=0A= + batch - run a batch file based on the current /cygwin.bat (default)=0A= +=0A= +Under batch, I will add a cygwin_indir.bat file in=0A= your cygwin root directory and append a few lines to your .bashrc.=20=0A= =20=0A= The changes to your .bashrc will only be executed if you are running under= =0A= -cygwin (I share my .bashrc with my Unix box.)=20=0A= +cygwin (I share my .bashrc with my Unix box.) Also these changes will not= =20=0A= +be run under other user profiles.=0A= +=0A= +The advantage of using the options bash or rxvt is that no temporary files= are=0A= +used, and the extra command invocation in memory is spared. The rxvt comma= nd=0A= +used is a bare bones 'rxvt -e bash', so your preferences should go into=0A= +~/.Xdefaults=0A= =20=0A= EOF=0A= +# Add an odd apostrophe to stop the 'comment' leaking when viewing in xema= cs'=0A= =20=0A= #################### Are you sure you want to do this? ###################= #=0A= PROMPT=3D"Would you like to continue? [y/n]"=0A= @@ -35,14 +49,36 @@=0A= fi=0A= echo ""=0A= =20=0A= -CYGWIN_ROOT_DOS=3D`regtool get 'HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutio= ns\Cygwin\mounts v2\/\native'`=0A= -CYGWIN_ROOT_CYGWIN=3D`cygpath -u $CYGWIN_ROOT_DOS`=0A= -CYGWIN_ROOT_DOS=3D`cygpath -w $CYGWIN_ROOT_DOS`=0A= +CYGWIN_ROOT_CYGWIN=3D/=0A= +CYGWIN_ROOT_DOS=3D`cygpath -w $CYGWIN_ROOT_CYGWIN`=0A= =20=0A= -#################### Make necessary additions to .bashrc #################= ###=0A= +case $1 in=0A= +batch)=0A= + DESIRED_SHELL=3D%BATCH_SHELL_CMD%=0A= +;;=0A= +cmd-bash | bash)=0A= + DESIRED_SHELL=3D%CMD_BASH_SHELL_CMD%=0A= +;;=0A= +rxvt-bash | rxvt)=0A= + DESIRED_SHELL=3D%RXVT_BASH_SHELL_CMD%=0A= +;;=0A= +# Add you preferred windowing/shell combo here=0A= +# and then add appropriate start up line to .inf.tpl=0A= +*)=0A= + DESIRED_SHELL=3D%BATCH_SHELL_CMD%=0A= +;;=0A= +esac=0A= +=0A= +# Only modify/create ./bashrc and cygwin_indir.bat if running from a batch= file=0A= +# otherwise things are handled in the registry and this isn't required=0A= +if [ "$DESIRED_SHELL" =3D "%BATCH_SHELL_CMD%" ]=0A= +then=0A= =20=0A= -if [ `grep -c BPH_TEMP_FILE $HOME/.bashrc` =3D 0 ]; then=0A= - cat <> $HOME/.bashrc=0A= +#################### Make necessary additions to .bashrc #################= ###=0A= +# create it if necesary=0A= + touch $HOME/.bashrc=0A= + if [ `grep -c /tmp/bphdir.tmp $HOME/.bashrc` =3D 0 ]; then=0A= + cat <> $HOME/.bashrc=0A= =20=0A= # Additions for "Cygwin Prompt Here" functionality=0A= if [ -r /tmp/bphdir.tmp ]; then=0A= @@ -52,38 +88,36 @@=0A= # End of: Additions for "Cygwin Prompt Here" functionality=0A= =20=0A= EOF=0A= -fi=0A= -=0A= -#################### Create and install the .inf file ####################= =0A= -# sed/shell quoting -- Ugh!=0A= -CYGWIN_ROOT_DOS_ESCAPED=3D`echo "$CYGWIN_ROOT_DOS" | sed -e 's;\\\\;\\\\\\= \\;g'`=0A= -sed -e "s;\(CYGWIN_ROOT=3D\);\\1\"$CYGWIN_ROOT_DOS_ESCAPED\";g" \=0A= - < CygwinPromptHere.inf.tpl > CygwinPromptHere.inf=0A= -=0A= -CYG_COMSPEC=3D`cygpath -u $COMSPEC`=0A= -INSTALL_CMD=3D`regtool get 'HKEY_CLASSES_ROOT\inffile\shell\Install\comman= d\' \=0A= - | sed -e 's; %1;;g'`=0A= -DOS_PWD=3D`cygpath -w -a "$PWD"`=0A= -=0A= -# Windows (2000) looks for the exact filename specified in the .inf file.= =0A= -$CYG_COMSPEC /c start $INSTALL_CMD $DOS_PWD\\CygwinPromptHere.inf=0A= + fi=0A= =20=0A= #################### Create cygwin_indir.bat ####################=0A= =20=0A= # old CYGWIN_DRIVE=3D`echo $CYGWIN_ROOT_DOS | cut -d'\\' -f1`=0A= -CYGWIN_DRIVE=3D`echo $CYGWIN_ROOT_DOS | cut -d: -f1`:=0A= -CYGWIN_DIR=3D`echo $CYGWIN_ROOT_DOS | cut -d: -f2`=0A= + CYGWIN_DRIVE=3D`echo $CYGWIN_ROOT_DOS | cut -d: -f1`:=0A= + CYGWIN_DIR=3D`echo $CYGWIN_ROOT_DOS | cut -d: -f2`=0A= =20=0A= # Backup old file=0A= -if [ -r /cygwin_indir.bat ]=0A= -then=0A= + if [ -r /cygwin_indir.bat ]=0A= + then=0A= TODAY=3D`date +'%Y%m%d'`=0A= cp /cygwin_indir.bat /cygwin_indir.${TODAY}.bat=0A= echo "A copy of the existing file '/cygwin_indir.bat' has been saved a= s:"=0A= echo "/cygwin_indir.${TODAY}.bat."=0A= -fi=0A= + fi=0A= =20=0A= -cat < /cygwin_indir.bat=0A= +# if the standard cygwin.bat exists, pass it through sed to get cygwin_ind= ir.bat=0A= +# so we retain the users options/preferences. Try and cygpath after cding = to /bin=0A= +# else create it=0A= + if [ -x /cygwin.bat ]=0A= + then=0A= + cat < batch.sed=0A= +/\(\(cd\|chdir\).*bin\)[[:space:]]*$/I a\\=0A= +cygpath -u %1> ..\\\\tmp\\\\bphdir.tmp=0A= +EOF=0A= + sed -f batch.sed /cygwin.bat > /cygwin_indir.bat=0A= + rm batch.sed=0A= + else=0A= + cat < /cygwin_indir.bat=0A= @echo off=0A= title Cygwin Bash Shell=0A= =20=0A= @@ -91,12 +125,28 @@=0A= cd $CYGWIN_DIR\bin=0A= cygpath -u %1> $CYGWIN_ROOT_DOS\tmp\bphdir.tmp=0A= =20=0A= -rxvt -sr -sl 2500 -fg lightblue -geometry 90x30 -bg midnightblue -sb -tn r= xvt -fn "Lucida Console-14" -e /usr/bin/bash --login -i=0A= +bash --login -i=0A= =20=0A= exit=0A= EOF=0A= + fi=0A= + chmod a+x /cygwin_indir.bat=0A= +fi=0A= +=0A= +#################### Create and install the .inf file ####################= =0A= +# sed/shell quoting -- Ugh!=0A= +CYGWIN_ROOT_DOS_ESCAPED=3D`echo "$CYGWIN_ROOT_DOS" | sed -e 's;\\\\;\\\\\\= \\;g'`=0A= +sed -e "s;\(CYGWIN_ROOT=3D\);\\1\"$CYGWIN_ROOT_DOS_ESCAPED\";g" -e "s;%CYG= WIN_SHELL_CMD%;$DESIRED_SHELL;g" \=0A= + < CygwinPromptHere.inf.tpl > CygwinPromptHere.inf=0A= +=0A= +CYG_COMSPEC=3D`cygpath -u $COMSPEC`=0A= +INSTALL_CMD=3D`regtool get 'HKEY_CLASSES_ROOT\inffile\shell\Install\comman= d\' \=0A= + | sed -e 's; %1;;g'`=0A= +DOS_PWD=3D`cygpath -w -a "$PWD"`=0A= +=0A= +# Windows (2000) looks for the exact filename specified in the .inf file.= =0A= +$CYG_COMSPEC /c start $INSTALL_CMD $DOS_PWD\\CygwinPromptHere.inf=0A= =20=0A= -chmod a+x /cygwin_indir.bat=0A= =20=0A= #################### Installation Complete ####################=0A= =20=0A= =0A= ------_=_NextPart_000_01C2080C.29FAFEA0 Content-Type: text/plain; charset=us-ascii Content-length: 214 -- 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/ ------_=_NextPart_000_01C2080C.29FAFEA0--