Skip to content

Add NSIS installer as final build step #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Borg-installer
CygWin
http*
ftp*
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# borg-cygwin
Automated installation of [borg backup](https://github.com/borgbackup/borg) under Windows/CygWin

* Create a temporary build folder and place the files from this repository there
* Download `setup-x86_64.exe` from [CygWin Home Page](https://cygwin.com/setup-x86_64.exe) into build folder
* Run `install.bat`, after a while you should end up with CygWin installation in `Borg` subfolder
* To install, copy the `Borg` subfolder into `C:\Program Files\` (this will require Administrator rights)
* Optionally, add `C:\Program Files\Borg` into your Windows `PATH` variable
* Delete completely the build folder
This creates a standard Windows installer for Borg Backup on 64bit Windows 7 and above.

To install into other folder or prepare 32-bit build, edit `install.bat` and use different CygWin setup executable.
* The only prerequisite is NSIS installed, available at http://nsis.sourceforge.net/Download
* About 1 GB free disk space required to build installer
* Borg install itself will only require about 150 MB
* Tested on Windows 7 64-bit

After installation, use borg like this:
---

Create the installer by running install.bat. After creating the installer, run it to install Borg.

Then use borg like this, noting that all file paths are in Cygwin notation e.g. /cygdrive/c/path/to/my/files

```
borg init /cygdrive/D/Borg
borg create -C lz4 /cygdrive/D/Borg::Test /cygdrive/C/Photos/
```

The install script first builds borg inside temporary CygWin subfolder, then installs much smaller release version into Borg subfolder. Built packages are copied over, unnecessary files removed.
The install script first builds borg inside temporary CygWin subfolder, then installs a much smaller release version into the Borg-installer subfolder. Built packages are copied over, unnecessary files removed, and then NSIS is run.

Tested with CygWin 2.4.1, borgbackup 1.0.0 on Windows 7 64-bit.
Binary file added bin/borg-installer-1.0.7.exe
Binary file not shown.
17 changes: 17 additions & 0 deletions bin/borg-installer-1.0.7.exe.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAABAgAGBQJX2dlMAAoJEPEha5OO4qe20p8P/iM8EpkK1v39592poUaQk7lP
aUJ85wGl1z3Kn0DighLUolJ2Wfvu+IzfdWIxPrpLq2oWmc/HZYr6A0OVP7rLKHXN
41uN6QOwJwUpYyNcnkX4b6T4toPpVh6F8vLmr3FAmFVg5A8IEvR6yiUtqPvkldHz
9KeoZFXltq6GZ1d+UgWafq2n9ika7dWGqovqVoCG3HNr2LGzDdPKgNmlSxSzg2iK
43dUaBZrB7anpxf83+Gru2h5AKVZfmoX2wPw1moES7Gi33JndxT8m8jR4lPoeVtG
NhQKJO8pyuHjeWHZfe5rmgPdiDCUEIT7PNAFy1UaM8ovu1JVU8QIh5/eXM9gxuCx
bZcTERWjb9O0sYg4PnU1L/DMQiHWrWVYGp/KpBYQLF8YVsrI+tO0G4jfgk3wQpbc
gSKANczM1rs4Vgy3OPUj+WhL2nyyExr9P0bU3PiYbSC8KgyrY92baGSrcCD4gv6w
Kt/iYGbnq07Wffv/0pci21mk0q2iXq/MYFFjuphRfCHgFbGrS53YfWV8uu7Qa0q/
YRZ0puYimlMnbLN5JnOL4pmFSYOI9oP5xbQB4h3gHn11pNv7c1+D6j2QmKVLzpm6
cY47pB/DQIrSeoDOfk8MSQbXaVc94TNHNDARfoHGmKvzJsrYm2+GkYfkl+LII5bE
aarwdBbU4uI7GOV3v3ZT
=b/Pl
-----END PGP SIGNATURE-----
70 changes: 70 additions & 0 deletions build-installer.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
REM --- Change to use different CygWin platform and final install path

set CYGSETUP=setup-x86_64.exe
set TARGETPATH=.

REM --- NSIS must be installed! Get NSIS from http://nsis.sourceforge.net/Download

set MAKENSIS=C:\Program Files (x86)\NSIS\makensis.exe
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/setup-x86_64.exe', 'setup-x86_64.exe')"

REM --- Install build version of CygWin in a subfolder

set OURPATH=%cd%
set CYGBUILD=%OURPATH%\CygWin
set CYGMIRROR=http://mirrors.kernel.org/sourceware/cygwin/
set BUILDPKGS=python3,python3-devel,python3-setuptools,binutils,gcc-g++,libopenssl,openssl-devel,git,make,openssh,liblz4-devel,liblz4_1

%CYGSETUP% -q -B -o -n -R %CYGBUILD% -L -D -s %CYGMIRROR% -P %BUILDPKGS%

REM --- Build borgbackup

cd %CYGBUILD%
bin\bash --login -c 'easy_install-3.6 pip'
bin\bash --login -c 'pip install borgbackup'
cd %OURPATH%

REM --- Install release version of CygWin in a subfolder

set CYGPATH=%OURPATH%\Borg-installer
set INSTALLPKGS=python3,openssh,liblz4_1,python3-setuptools
set REMOVEPKGS=csih,gawk,lynx,man-db,groff,vim-minimal,tzcode,ncurses,info,util-linux

%CYGSETUP% -q -B -o -n -L -R %CYGPATH% -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
for /d %%d in (lib\python3.6\site-packages\borg*) do xcopy /s %%d %CYGPATH%\%%d\
for /d %%d in (lib\python3.6\site-packages\msgpack*) do xcopy /s %%d %CYGPATH%\%%d\
for /d %%d in (lib\python3.6\site-packages\pkg_resources) do xcopy /s %%d %CYGPATH%\%%d\

REM --- Remove all locales except EN (borg does not use them)

del /s /q %CYGPATH%\usr\share\locale\
for /d %%d in (usr\share\locale\en*) do xcopy /s %%d %CYGPATH%\%%d\

REM --- Remove all documentation

del /s /q %CYGPATH%\usr\share\doc\
del /s /q %CYGPATH%\usr\share\info\
del /s /q %CYGPATH%\usr\share\man\

REM --- Build Installer using NSIS

cd %OURPATH%

"%MAKENSIS%" nsis-installer.nsi

8 changes: 8 additions & 0 deletions fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# /etc/fstab
#
# This file is read once by the first process in a Cygwin process tree.
# To pick up changes, restart all Cygwin processes. For a description
# see https://cygwin.com/cygwin-ug-net/using.html#mount-table

# BORG INSTALLER: moved drive mount point from /cygdrive to /
none / cygdrive binary,posix=0,user 0 0
53 changes: 0 additions & 53 deletions install.bat

This file was deleted.

Loading