forked from lapoigne/borg-cygwin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-cygwin.bat
88 lines (66 loc) · 2.82 KB
/
build-cygwin.bat
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
set CYGSETUP=setup-x86_64.exe
set TARGETPATH=.
set POWERSHELL=%windir%\System32\WindowsPowerShell\v1.0\powershell.exe
REM --- Fetch Cygwin setup from internet using powershell
"%POWERSHELL%" -Command "(New-Object Net.WebClient).DownloadFile('https://cygwin.com/%CYGSETUP%', '%CYGSETUP%')"
REM --- Install build version of CygWin in a subfolder
echo Install build version of Cygwin...
set OURPATH=%cd%
set CYGBUILD=%OURPATH%\CygWin
set CYGMIRROR=http://mirrors.kernel.org/sourceware/cygwin/
set BUILDPKGS=python3,python3-devel,binutils,gcc-g++,libssl,libssl-devel,git,make,openssh,liblz4-devel,liblz4_1,libzstd1,libzstd-devel,libcrypt-devel
%CYGSETUP% -q -B -o -n -g -R %CYGBUILD% -L -D -l %OURPATH% -s %CYGMIRROR% -P %BUILDPKGS%
REM --- Build borgbackup
cd %CYGBUILD%
bin\bash --login -c 'easy_install-3.6 pip'
bin\bash --login -c 'pip install -U pip'
bin\bash --login -c 'pip install -U borgbackup borgmatic b2'
cd %OURPATH%
REM --- Install release version of CygWin in a subfolder
echo Install release version of Cygwin...
set CYGPATH=%OURPATH%\Borg-installer
del /s /q %CYGPATH% >nul
set INSTALLPKGS=python3,openssh,python3-setuptools,liblz4_1,libzstd1,gcc-core,libssl,libcrypt2
set REMOVEPKGS=csih,gawk,lynx,man-db,groff,vim-minimal,tzcode,ncurses,info,util-linux
%CYGSETUP% -q -B -o -n -L -R %CYGPATH% -l %OURPATH% -P %INSTALLPKGS% -x %REMOVEPKGS%
REM --- Adjust final CygWin environment
echo @"%TARGETPATH%\bin\bash" --login -c "cd $(cygpath '%cd%'); /bin/borg %%*" >%CYGPATH%\borg.bat
copy nsswitch.conf %CYGPATH%\etc\
copy fstab %CYGPATH%\etc\
REM --- Copy built packages into release path
cd %CYGBUILD%
copy bin\borg %CYGPATH%\bin
copy bin\borgmatic %CYGPATH%\bin
copy bin\validate-borgmatic-config %CYGPATH%\bin
copy bin\upgrade-borgmatic-config %CYGPATH%\bin
copy bin\generate-borgmatic-config %CYGPATH%\bin
copy bin\b2 %CYGPATH%\bin
for /d %%d in (lib\python3.6\site-packages) do xcopy /s /y %%d %CYGPATH%\%%d\
REM --- Remove all locales except EN (borg does not use them)
del /s /q %CYGPATH%\usr\share\locale\ >nul
for /d %%d in (usr\share\locale\en*) do xcopy /s /y %%d %CYGPATH%\%%d\
REM --- Remove all documentation
echo Remove all documentation...
del /s /q %CYGPATH%\usr\share\doc\ >nul
del /s /q %CYGPATH%\usr\share\info\ >nul
del /s /q %CYGPATH%\usr\share\man\ >nul
REM --- Remove gcc libs (gcc is installed only for ldconfig support)
echo Remove gcc libs...
del /s /q %CYGPATH%\lib\gcc >nul
del /s /q %CYGPATH%\lib\w32api >nul
del /s /q %CYGPATH%\usr\include\w32api >nul
REM --- Remove extra files
echo Remove extra files...
del /s /q %CYGPATH%\*.h >nul
del /s /q %CYGPATH%\var\log >nul
del /s /q %CYGPATH%\var\cache >nul
del /s /q %CYGPATH%\lib\groff >nul
del /s /q %CYGPATH%\usr\share\groff >nul
cd %OURPATH%
echo "Cygwin Setup Done!"
goto :EOF
:ERROR
echo Don't launch this script use build32.bat or build64.bat instead
pause
exit