This is the mail archive of the cygwin 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: Proposal for new cygwin.bat which is independent from install directory

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

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

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.


diff -Nru cygwin-base-files-4.2-4-1ffe2dd.orig/etc/defaults/Cygwin.bat cygwin-base-files-4.2-4-1ffe2dd/etc/defaults/Cygwin.bat
--- cygwin-base-files-4.2-4-1ffe2dd.orig/etc/defaults/Cygwin.bat	1970-01-01 01:00:00.000000000 +0100
+++ cygwin-base-files-4.2-4-1ffe2dd/etc/defaults/Cygwin.bat	2016-08-30 08:55:42.883139300 +0200
@@ -0,0 +1,4 @@
+@echo off
+setlocal enableextensions
+set TERM=
+cd /d "%~dp0bin" && .\bash --login -i
diff -Nru cygwin-base-files-4.2-4-1ffe2dd.orig/etc/preremove/base-files-manifest.lst cygwin-base-files-4.2-4-1ffe2dd/etc/preremove/base-files-manifest.lst
--- cygwin-base-files-4.2-4-1ffe2dd.orig/etc/preremove/base-files-manifest.lst	2015-09-26 09:31:45.000000000 +0200
+++ cygwin-base-files-4.2-4-1ffe2dd/etc/preremove/base-files-manifest.lst	2016-08-30 08:57:15.584588800 +0200
@@ -1,3 +1,4 @@

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]