README.md 2.64 KB
Newer Older
noplanman's avatar
noplanman committed
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
# Borg Binary Builder

Build [BorgBackup] binaries on any platform, for any architecture, using docker.

## Usage

### Build image

`./build.sh <arch> [<version>]`

See the [list of available architectures] ([on GitHub][available-architectures-github])

*Examples:*
- Build version `1.1.7` for `aarch64`
`./build.sh aarch64 1.1.7`

- Build version `1.1.5` for Raspberry Pi 3
`./build.sh raspberrypi3 1.1.5`

### Extract borg binary

`./extract.sh <arch> [<binary_save_location>]`

**Note:** This will overwrite the file at `binary_save_location` if it already exists!

*Examples:*
- Extract borg binary for `aarch64` to `borg-aarch64` in current folder
`./extract.sh aarch64 borg-aarch64`

- Extract borg binary for Raspberry Pi 3 to `/homes/lemoi/borg`
`./extract.sh raspberrypi3 /homes/lemoi/borg`

## How this works

### Build

The `build.sh` script downloads the appropriate starter docker image that contains the necessary QEMU binary for building and registers it in the build agent.

For more details, check the [Hypriot blog post] that explains it in more depth.

Then, the docker image is built for the requested architecture.

This is basically done by following the flow of setting up a [BorgBackup development environment] and [creating the standalone binary]. (For more info on this, just have a look at the `Dockerfile`)

### Extract

The `extract.sh` script extracts the built binary from the image created using `build.sh`.

This basically starts a container from the built image for your selected architecture and writes the binary out to the file path you passed as a parameter.

noplanman's avatar
noplanman committed
51 52 53 54
## License

Borg Binary Builder is licensed under the terms of the [WTFPL]. See the [LICENSE] file.

noplanman's avatar
noplanman committed
55 56 57 58 59 60
[BorgBackup]: https://github.com/borgbackup/borg/ "BorgBackup on GitHub"
[BorgBackup development environment]: https://borgbackup.readthedocs.io/en/stable/development.html#building-a-development-environment "BorgBackup development environment"
[creating the standalone binary]: https://borgbackup.readthedocs.io/en/stable/development.html#creating-standalone-binaries "Create standalone binary"
[list of available architectures]: https://docs.resin.io/reference/base-images/base-images/ "List of available Architectures"
[available-architectures-github]: https://github.com/resin-io-library/base-images/tree/master/python "List of available Architectures on GitHub"
[Hypriot blog post]: https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/ "Setup a simple CI pipeline to build Docker images for ARM"
noplanman's avatar
noplanman committed
61 62
[WTFPL]: http://www.wtfpl.net/about/ "Do What the Fuck You Want to Public License"
[LICENSE]: https://git.feneas.org/noplanman/borg-binary-builder/blob/master/LICENSE "View License"