X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:subject:to:references:message-id:date
	:mime-version:in-reply-to:content-type; q=dns; s=default; b=XT7E
	GqBGgUYWrDXA7ZGBfdhYzml3OvUJVgzRaH0wEfpgdjfb14YnNL8Y9k42K20mYF4W
	aHF2pIG6HUJY5w3FdPu4tD2CyzgHe+iiIBm5X15o4O8FLH/0xk7Qr02uyVsioAkB
	pcdGL/Tf/D830b9TQvitQwajImrsGSnvCsiHtSA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:subject:to:references:message-id:date
	:mime-version:in-reply-to:content-type; s=default; bh=5/VjSTRpG2
	fWtN4W1Uy1tvmmICc=; b=lvohIqVuJwaHGm94zatGJd6vH+Zjz107np5L4ENPLg
	kWx2stFW/oyUi4JhGxX+Bdb8xZ9luqCV/zql+f/8Heq9c+L5Xfhb6RCyNNdrrUjY
	VhhWrshmVDwdVgPNMJMilhVOcL5OGgYaSD5RvJcKQGeRcRrBsOFAYNWujgGgz/Ty
	0=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=HX-Envelope-From:sk:Christi, bat, TERM, BAT
X-HELO: mailout10.t-online.de
From: Christian Franke <Christian.Franke@t-online.de>
Subject: Re: Proposal for new cygwin.bat which is independent from install directory
To: cygwin@cygwin.com
References: <57C06CFA.4060405@t-online.de> <20160830131653.GD28244@calimero.vinschen.de>
Message-ID: <57C66C81.4020508@t-online.de>
Date: Wed, 31 Aug 2016 07:34:57 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40
MIME-Version: 1.0
In-Reply-To: <20160830131653.GD28244@calimero.vinschen.de>
Content-Type: multipart/mixed; boundary="------------040106070303000700010502"
X-IsSubscribed: yes

--------------040106070303000700010502
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

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


--------------040106070303000700010502
Content-Type: text/x-patch;
 name="base-files-4.2-4-Cygwin.bat.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="base-files-4.2-4-Cygwin.bat.patch"

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 @@
+Cygwin.bat
 etc/profile.d/lang.sh
 etc/profile.d/lang.csh
 etc/profile.d/tzset.sh



--------------040106070303000700010502
Content-Type: text/plain; charset=us-ascii

--
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
--------------040106070303000700010502--
