Portable Cygwin: Hard-Coded Paths in a Restored Cygwin.bat File?

Matthew Sheets via Cygwin-apps <[email protected]>
Newsgroups gmane.os.cygwin.applications
Message-ID <DM4P223MB0542249C0AE077A5B3964BD5C823A@DM4P223MB0542.NAMP223.PROD.OUTLOOK.COM>
Are there two different versions of Cygwin.bat that Cygwin Setup could create depending on the context in which Cygwin Setup is executed?

If Cygwin setup is being used to create a new installation, the installed Cygwin.bat is fairly path independent:
@echo off
setlocal enableextensions
set TERM=
cd /d "%~dp0bin" && .\bash --login -i


However, if Cygwin setup is being executed for an already-existing installation and restores a deleted Cygwin.bat, that restored Cygwin.bat contains hard-coded paths:
@echo off
C:
chdir C:\Portable\Cygwin\arch-x86_64\bin
bash --login -i


For a portable setup, I am intending to remove and wrap Cygwin.bat and have _zero_ issue with Cygwin Setup restoring it (I was actually hoping Cygwin Setup _did_ restore Cygwin.bat so that any updates to Cygwin.bat could be incorporated), but the challenge here is that a completely different Cygwin.bat that contains hard-coded paths is created upon restoration.  Is this file content difference expected?  Could the `cd /d "%~dp0bin"` syntax be used in both cases (in place of the hardcoded paths)?


As reference, the Cygwin Setup --version is 2.934 an the arguments passed to Cygwin Setup are as follows (PortableRoot and ARCH are set by the wrapper batch file that facilitates portability):
` --no-admin --no-shortcuts --no-write-registry --no-replaceonreboot --package-manager --root "%PortableRoot%\Cygwin\arch-%ARCH%"  --local-package-dir "%PortableRoot%\Cygwin\packages" --wait`


Thank you,
Matthew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.