Why is this DOS batch file that installs Cygwin unattended failing?

2

After assembling information from all over the Internet, I've managed to come up with a DOS batch script that should be working AFAICT, but after the Cygwin setup executable finishes (seemingly successfully), there is no bin directory in the Cygwin root folder.

Why is it failing? Fixes welcome! :)

NB: It attempts to cleanly install in a directory called cyg64 in the current user's home directory.

setlocal

if exist %HOMEDRIVE%%HOMEPATH%\cyg64 rmdir /s /q %HOMEDRIVE%%HOMEPATH%\cyg64
mkdir %HOMEDRIVE%%HOMEPATH%\cyg64

set CYGSETUP=%HOMEDRIVE%%HOMEPATH%\cyg64\cygsetup64.exe

for /f "tokens=4-7 delims=[.] " %%i in ('ver') do (if %%i==Version (set v=%%j.%%k) else (set v=%%i.%%j))
if %v%==6.1 (
  bitsadmin /transfer "CygwinDownload" https://www.cygwin.com/setup-x86_64.exe %CYGSETUP%
) else (
  powershell -command "& { iwr https://www.cygwin.com/setup-x86_64.exe -OutFile $env:CYGSETUP } "
)

%CYGSETUP% -D -q -R %HOMEDRIVE%%HOMEPATH%\cyg64 -a x86_64 -l %HOMEDRIVE%%HOMEPATH%\cyg64 -s http://cygwin.mirror.constant.com -P openssh,autossh,nano,vim,git

endlocal

Matthew Adams

Posted 2016-01-26T18:37:36.463

Reputation: 163

Check the setup.log and setup.log.full in your Cygwin download directory for clues. – DavidPostill – 2016-01-26T19:48:34.293

Make sure to install the cygwin package. See this question cygwin1.dll not available error when installing Cygwin

– DavidPostill – 2016-01-26T19:50:19.570

@DavidPostill: WRT response #1: Of course I checked the logs. Nothing unusual, no error messages. – Matthew Adams – 2016-01-26T23:36:43.200

@DavidPostill: WRT response #2: I added cygwin to the list of packages to install. The command was %CYGSETUP% -D -q -R %HOMEDRIVE%%HOMEPATH%\cyg64 -a x86_64 -l %HOMEDRIVE%%HOMEPATH%\cyg64 -s http://cygwin.mirror.constant.com -P cygwin,openssh,autossh,nano,vim,git and it resulted in no difference. Still no bin directory. – Matthew Adams – 2016-01-26T23:39:01.733

Sorry, no more ideas. I always use the interactive setup ... – DavidPostill – 2016-01-26T23:42:05.003

remove "-D" as it just download not install. Additional "-l" should specify a cache directory different from installation – matzeri – 2016-02-11T21:07:15.137

@matzeri Thanks, it was the -D argument! Removing it worked; I must've misunderstood the docs. If you answer this question instead of commenting on it, I'll be happy to mark it as the answer. FYI, I've never had a problem having my cache directory be inside the cygwin installation directory. It makes for easy uninstallation later, which is especially what I want in this case. – Matthew Adams – 2016-02-12T15:23:22.213

Answers

1

remove "-D" as it just download not install

matzeri

Posted 2016-01-26T18:37:36.463

Reputation: 1 662