-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-haproxy.bat
More file actions
56 lines (42 loc) · 1.85 KB
/
Copy pathbuild-haproxy.bat
File metadata and controls
56 lines (42 loc) · 1.85 KB
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
@echo off
:: Downloads and installs cygwin64 for windows and
:: invokes the child Unix script using cygwin (for the Unix script, we replace the extension to .sh)
::
:: Version 2024-05-23
:: https://github.com/sergejskozlovics/unix-script-in-windows.git
::
:: Copyright (c) Sergeks Kozlovics AND Institute of Mathematics and Computer Science, University of Latvia
:: Licence: MIT
:: Contributors:
:: Sergejs Kozlovics, 2022-2024
if exist C:\cygwin64\bin\dos2unix.exe goto DOS2UNIX_OK
set CYGWIN_INSTALLER_PATH=cygwin_installer
set CYGWIN_SITE=http://ftp.ntua.gr/pub/pc/cygwin/
::set CYGWIN_SITE=https://ftp.fsn.hu/pub/cygwin/
mkdir %CYGWIN_INSTALLER_PATH%
pushd %CYGWIN_INSTALLER_PATH%
:: download cygwin installer
if not exist setup-x86_64.exe curl.exe -o setup-x86_64.exe https://www.cygwin.com/setup-x86_64.exe
:: install default cygwin packages
if not exist C:\cygwin64\bin setup-x86_64.exe -q --wait --site %CYGWIN_SITE%
:: install additional cygwin packages
setup-x86_64.exe -q --wait -P dos2unix dirname libssl-devel ninja
:: ^^^ dos2unix is needed if git added Windows CR+LF; we need to convert them back to Unix style (for Cygwin bash)
popd
:: === cygwin64 and packages installed ====
:DOS2UNIX_OK
C:\cygwin64\bin\dos2unix -q "%~dp0\\%~n0.sh"
:: replace backslashes with forward slashes
setlocal enabledelayedexpansion
set "UNIX_SCRIPT=%~dp0\%~n0.sh"
set "UNIX_SCRIPT=!UNIX_SCRIPT:\=/!"
:: converting Windows PATH to Cygwin PATH variable (backslashes to slashes; C: to /cygdrive/c; ";" to ":" as path delimiter
set "W_PATH=%PATH%"
set "W_PATH=!W_PATH:\=/!"
set "W_PATH=!W_PATH:C:=/cygdrive/c!"
set "W_PATH=!W_PATH:c:=/cygdrive/c!"
set "W_PATH=!W_PATH:D:=/cygdrive/d!"
set "W_PATH=!W_PATH:d:=/cygdrive/d!"
set "W_PATH=!W_PATH:;=:!"
set UNIX_SCRIPT_WITH_ARGS=%UNIX_SCRIPT% %*
C:\cygwin64\bin\bash -c "PATH='/usr/bin:/bin:/usr/local/bin:%W_PATH%' %UNIX_SCRIPT_WITH_ARGS%"