-
Notifications
You must be signed in to change notification settings - Fork 0
/
CygInstall.cmd
executable file
·65 lines (53 loc) · 1.59 KB
/
CygInstall.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@echo off
rem TODO proxy
rem TODO args
setlocal EnableDelayedExpansion
:init
rem PATH might be different (e.g. cygwin).
set bin="%SYSTEMROOT%\System32"
set rootDir="C:\cygwin"
set setupDir="%HOMEDRIVE%%HOMEPATH%\cygwin"
set downloadSite="http://ftp.inf.tu-dresden.de/software/windows/cygwin"
set pkgList="%~dp0\pkg-list"
set pkgDir="%setupDir%\pkg"
md %pkgDir% >nul 2>&1
rem Get Windows system type.
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" ^
| %bin%\find /i "x86" >nul
if errorlevel 1 (
set arch=x86_64
) else (
set arch=x86
)
set cygUrl="https://www.cygwin.com/setup-%arch%.exe"
set installer="%setupDir%\setup-%arch%.exe"
if exist %installer% goto install
:downloadInstaller
echo Downloading installer...
powershell -Command "Invoke-WebRequest %cygUrl% -OutFile %installer%" >nul 2>&1
if errorlevel 1 (
echo Error: Failed to download %cygUrl% 1>&2
) else (
goto install
)
:readInstaller
set /p installer="Path to installer: "
if not exist %installer% goto readInstaller
:install
rem Read package list comma seperated in 'pkgs'.
for /f "usebackq delims=" %%p in (%pkgList%) do (
set pkgs=!pkgs!,%%p
)
rem Remove leading ','.
set pkgs=%pkgs:~1%
rem Run the installer.
%installer% ^
--site %downloadSite% ^
--root %rootDir% ^
--packages %pkgs% ^
--categories base ^
--arch %arch% ^
--quiet-mode ^
--local-package-dir %pkgDir% ^
--no-desktop ^
--upgrade-also