| 1 |
@echo off |
| 2 |
rem Copyright (C): 2001, 2002, 2003, 2004, 2005 Earnie Boyd |
| 3 |
rem mailto:earnie@users.sf.net |
| 4 |
rem This file is part of Minimal SYStem |
| 5 |
rem http://www.mingw.org/msys.shtml |
| 6 |
rem |
| 7 |
rem File: msys.bat |
| 8 |
rem Revision: 2.4 |
| 9 |
rem Revision Date: December 8th, 2005 |
| 10 |
|
| 11 |
rem ember to set the "Start in:" field of the shortcut. |
| 12 |
rem A value similar to C:\msys\1.0\bin is what the "Start in:" field needs |
| 13 |
rem to represent. |
| 14 |
|
| 15 |
rem ember value of GOTO: is used to know recursion has happened. |
| 16 |
if "%1" == "GOTO:" goto %2 |
| 17 |
|
| 18 |
if NOT "x%WD%" == "x" set WD= |
| 19 |
|
| 20 |
rem ember command.com only uses the first eight characters of the label. |
| 21 |
goto _WindowsNT |
| 22 |
|
| 23 |
rem ember that we only execute here if we are in command.com. |
| 24 |
:_Windows |
| 25 |
|
| 26 |
if "x%COMSPEC%" == "x" set COMSPEC=command.com |
| 27 |
start /min %COMSPEC% /e:4096 /c %0 GOTO: _Resume %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 |
| 28 |
goto EOF |
| 29 |
|
| 30 |
rem ember that we execute here if we recursed. |
| 31 |
:_Resume |
| 32 |
for %%F in (1 2 3) do shift |
| 33 |
if NOT EXIST %WD%msys-1.0.dll set WD=.\bin\ |
| 34 |
|
| 35 |
rem ember that we get here even in command.com. |
| 36 |
:_WindowsNT |
| 37 |
|
| 38 |
rem Hopefully a temporary workaround for getting MSYS shell to run on x64 |
| 39 |
rem (WoW64 cmd prompt sets PROCESSOR_ARCHITECTURE to x86) |
| 40 |
if not "x%PROCESSOR_ARCHITECTURE%" == "xAMD64" goto _NotX64 |
| 41 |
set COMSPEC=%WINDIR%\SysWOW64\cmd.exe |
| 42 |
%COMSPEC% /c %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 |
| 43 |
goto EOF |
| 44 |
:_NotX64 |
| 45 |
|
| 46 |
if NOT EXIST %WD%msys-1.0.dll set WD=%~dp0\bin\ |
| 47 |
|
| 48 |
rem ember Set up option to use rxvt based on value of %1 |
| 49 |
set MSYSCON=unknown |
| 50 |
if "x%1" == "x-norxvt" set MSYSCON=sh.exe |
| 51 |
if "x%1" == "x--norxvt" set MSYSCON=sh.exe |
| 52 |
if "x%1" == "x-rxvt" set MSYSCON=rxvt.exe |
| 53 |
if "x%1" == "x--rxvt" set MSYSCON=rxvt.exe |
| 54 |
if "x%1" == "x-mintty" set MSYSCON=mintty.exe |
| 55 |
if "x%1" == "x--mintty" set MSYSCON=mintty.exe |
| 56 |
if NOT "x%MSYSCON%" == "xunknown" shift |
| 57 |
|
| 58 |
if "x%MSYSCON%" == "xunknown" set MSYSCON=sh.exe |
| 59 |
|
| 60 |
if "x%MSYSTEM%" == "x" set MSYSTEM=MINGW32 |
| 61 |
if "%1" == "MINGW32" set MSYSTEM=MINGW32 |
| 62 |
if "%1" == "MSYS" set MSYSTEM=MSYS |
| 63 |
|
| 64 |
if NOT "x%DISPLAY%" == "x" set DISPLAY= |
| 65 |
|
| 66 |
if "x%MSYSCON%" == "xmintty.exe" goto startmintty |
| 67 |
if "x%MSYSCON%" == "xrxvt.exe" goto startrxvt |
| 68 |
if "x%MSYSCON%" == "xsh.exe" goto startsh |
| 69 |
|
| 70 |
:unknowncon |
| 71 |
echo %MSYSCON% is an unknown option for msys.bat. |
| 72 |
pause |
| 73 |
exit 1 |
| 74 |
|
| 75 |
:notfound |
| 76 |
echo Cannot find the rxvt.exe or sh.exe binary -- aborting. |
| 77 |
pause |
| 78 |
exit 1 |
| 79 |
|
| 80 |
:startmintty |
| 81 |
if NOT EXIST %WD%mintty.exe goto startsh |
| 82 |
start %WD%mintty /bin/bash -l |
| 83 |
exit |
| 84 |
|
| 85 |
:startrxvt |
| 86 |
if NOT EXIST %WD%rxvt.exe goto startsh |
| 87 |
|
| 88 |
rem Setup the default colors for rxvt. |
| 89 |
if "x%MSYSBGCOLOR%" == "x" set MSYSBGCOLOR=White |
| 90 |
if "x%MSYSFGCOLOR%" == "x" set MSYSFGCOLOR=Black |
| 91 |
if "x%MINGW32BGCOLOR%" == "x" set MINGW32BGCOLOR=LightYellow |
| 92 |
if "x%MINGW32FGCOLOR%" == "x" set MINGW32FGCOLOR=Navy |
| 93 |
if "%MSYSTEM%" == "MSYS" set BGCOLOR=%MSYSBGCOLOR% |
| 94 |
if "%MSYSTEM%" == "MSYS" set FGCOLOR=%MSYSFGCOLOR% |
| 95 |
if "%MSYSTEM%" == "MINGW32" set BGCOLOR=%MINGW32BGCOLOR% |
| 96 |
if "%MSYSTEM%" == "MINGW32" set FGCOLOR=%MINGW32FGCOLOR% |
| 97 |
|
| 98 |
start %WD%rxvt -backspacekey -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr -fn Courier-12 -tn msys -geometry 80x25 -e /bin/sh --login -i |
| 99 |
exit |
| 100 |
|
| 101 |
:startsh |
| 102 |
if NOT EXIST %WD%sh.exe goto notfound |
| 103 |
start %WD%sh --login -i |
| 104 |
exit |
| 105 |
|
| 106 |
:EOF |
| 107 |
|
| 108 |
rem ChangeLog: |
| 109 |
rem 2002.03.07 Earnie Boyd mailto:earnie@users.sf.net |
| 110 |
rem * Move the @echo off to the top. |
| 111 |
rem * Change the binmode setting to nobinmode. |
| 112 |
rem * Remove the angle brackets around email address to workaround MS |
| 113 |
rem buggy command processor. |
| 114 |
rem |
| 115 |
rem 2002.03.12 Earnie Boyd mailto:earnie@users.sf.net |
| 116 |
rem * Add filter logic to find rxvt.exe |
| 117 |
rem |
| 118 |
rem 2002.03.13 Earnie Boyd mailto:earnie@users.sf.net |
| 119 |
rem * Revert the nobinmode change. |
| 120 |
rem |
| 121 |
rem 2002.03.20 Earnie Boyd mailto:earnie@users.sf.net |
| 122 |
rem * Add logic for stating bash. |
| 123 |
rem |
| 124 |
rem 2002.04.11 Earnie Boyd mailto;earnie@users.sf.net |
| 125 |
rem * Add logic for setting MSYSTEM value based on parameter. |
| 126 |
rem |
| 127 |
rem 2002.04.15 Olivier Gautherot mailto:olivier_gautherot@mentorg.com |
| 128 |
rem * Reduce number test conditions for finding an executable. |
| 129 |
rem |
| 130 |
rem 2002.04.15 Earnie Boyd mailto:earnie@users.sf.net |
| 131 |
rem * Unset DISPLAY if set before starting shell. |
| 132 |
rem |
| 133 |
rem 2002.04.16 Earnie Boyd mailto:earnie@users.sf.net |
| 134 |
rem * Remove use of DEFINED in conditional statments for variables for |
| 135 |
rem command.com support. |
| 136 |
rem * Add check for nonexistance of USERNAME variable for Win9x support. |
| 137 |
rem |
| 138 |
rem 2002.04.17 Earnie Boyd mailto:earnie@users.sf.net |
| 139 |
rem * Add foreground and background color defaults based on MSYSTEM value. |
| 140 |
rem |
| 141 |
rem 2002.04.22 Earnie Boyd mailto:earnie@users.sf.net |
| 142 |
rem * More Win 9x changes. |
| 143 |
rem |
| 144 |
rem 2002.05.04 Earnie Boyd mailto:earnie@users.sf.net |
| 145 |
rem * Remove the SET of USERNAME and HOME. |
| 146 |
rem |
| 147 |
rem 2002.11.18 Earnie Boyd mailto:earnie@users.sf.net |
| 148 |
rem * Add command.com detection and restart with a larger environment to |
| 149 |
rem avoid errors on w9x. |
| 150 |
rem Many thanks to Randy W. Sims mailto:RandyS@ThePierianSpring.org. |
| 151 |
rem See Randy's response to "RE: [Mingw-msys] Installation on WindowsME" |
| 152 |
rem from 11/06/2002 in the archives of mingw-msys@lists.sf.net. |
| 153 |
rem |
| 154 |
rem 2002.11.19 Paul Garceau mailto:pgarceau@attbi.com |
| 155 |
rem * Fix a typo: Change COMPSPEC to COMSPEC. |
| 156 |
rem |
| 157 |
rem 2002.11.25 Earnie Boyd mailto:earnie@users.sf.net |
| 158 |
rem * Remove the SET CYGWIN since it doesn't matter any longer. |
| 159 |
rem |
| 160 |
rem 2003.02.03 Earnie Boyd mailto:earnie@users.sf.net |
| 161 |
rem * Win9x doesn't like ``EXISTS dir'' so change it to ``EXISTS dir\nul''. |
| 162 |
rem Thanks to Nicolas Weber mailto:nicolasweber@gmx.de. |
| 163 |
rem |
| 164 |
rem 2003.03.06 Earnie Boyd mailto:earnie@users.sf.net |
| 165 |
rem * Add -backspacekey switch to rxvt startup. |
| 166 |
rem * Move RXVT color setup to startrxvt label |
| 167 |
rem |
| 168 |
rem 2004.01.30 Earnie Boyd mailto:earnie@users.sf.net |
| 169 |
rem * Add -geometry parameter to work around an off by one issue with |
| 170 |
rem the default values. |
| 171 |
rem Thanks to Dave Schuyler mailto:parameter@users.sf.net |
| 172 |
rem |
| 173 |
rem 2004.03.28 Earnie Boyd mailto:earnie@users.sf.net |
| 174 |
rem * Add -norxvt or --norxvt switch argument. |
| 175 |
rem Thanks to Keith Marshall mailto:Keith.Marshall@total.com. |
| 176 |
rem * Add method to determine absolute path of msys.bat so that we no |
| 177 |
rem longer need to change to the bin directory. This allows msys.bat to be |
| 178 |
rem called from any working directory. |
| 179 |
rem Thanks to Kevin Mack mailto:kevin.mack@us.cd-adapco.com |
| 180 |
rem |
| 181 |
rem 2005.07.06 Max TE Woodbury mailto:mtew@users.sf.net |
| 182 |
rem * Fixed WD check for command.com systems. |
| 183 |
rem * Minimized intermediate CMD window to reduce startup flashyness. |
| 184 |
rem * If rxvt.exe cannot be found, try sh.exe. |
| 185 |
rem |
| 186 |
rem 2005.12.06 Tuomo Latto mailto:nonperson@users.sf.net |
| 187 |
rem * Added a temporary workaround for getting MSYS shell to run on x64. |
| 188 |
rem |
| 189 |
rem 2005.12.07 Keith Marshall mailto:keithmarshall@users.sf.net |
| 190 |
rem * ``EXISTS %WD%\sh.exe'' should be ``EXISTS %WD%sh.exe''; corrected. |
| 191 |
rem * Modified Tuomo's patch, to avoid trashing Window settings in Win32. |
| 192 |
rem |
| 193 |
rem 2005.12.08 Tuomo Latto mailto:nonperson@users.sf.net |
| 194 |
rem * Keith's modified patch fails on x64; start did funny things. |
| 195 |
rem Reworked, for correct behaviour on both platforms. |
| 196 |
rem |
| 197 |
rem 2009.03.17 Keith Marshall mailto:keithmarshall@users.sf.net |
| 198 |
rem * Add -rxvt or --rxvt switch; start in --norxvt mode by default. |
| 199 |
rem Make it deterministic; (do not inherit MSYSCON from parent). |
| 200 |
rem |