Proposal for new cygwin.bat which is independent from install directory
Christian Franke
Christian.Franke@t-online.de
Wed Aug 31 11:41:00 GMT 2016
Corinna Vinschen wrote:
> On Aug 26 18:23, Christian Franke wrote:
>> Traditionally setup.exe creates the /cygwin.bat file as follows if C:\cygwin
>> is the install directory:
>> -----
>> @echo off
>>
>> C:
>> chdir C:\cygwin\bin
>>
>> bash --login -i
>> -----
>>
>>
>> The following should work since WinXP regardless of install directory:
>> -----
>> @echo off
>>
>> cd /d %~dp0
>> if errorlevel 1 exit /b 1
>> cd bin
>> if errorlevel 1 exit /b 1
>>
>> bash --login -i
>> -----
>>
>> I would suggest to add something like the above as
>> "/etc/defaults/cygwin.bat" to base-files package. The postinstall script
>> should copy it to "/cygwin.bat" if new. The creation of this file could
>> later be removed from setup.exe.
> Apart from the complexity discussion, which is largly irrelevant, I like
> the idea of moving this functionality out of setup and into a postinstall
> script.
>
> Please send patches. I'm sure Achim will thoughtfully consider them.
Attached is a patch for current base-files package. Tested on WinXP and
Win10. $TERM is cleared as suggested by Thomas Wolff.
Cygwin.bat is now somewhat shorter because meantime I found an old WinXP
VM to test backward compatibility of "new" CMD syntax.
After applying the patch, please run "unix2dos
.../etc/defaults/Cygwin.bat". BAT files with '\n' line endings run
properly even on XP, but could not be edited with older versions of notepad.
There is no need to change setup.exe because it runs postinstall scripts
before creating a still missing Cygwin.bat.
Please note one break of backward compatibility: The new Cygwin.bat
preserves %CD% of parent CMD instead of changing to Cygwin's bin
directory. Could possibly be considered as a feature.
Thanks,
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: base-files-4.2-4-Cygwin.bat.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20160831/d0724c8e/attachment.bin>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list