Skip to content

Instantly share code, notes, and snippets.

@fpelliccioni
Last active February 23, 2020 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fpelliccioni/a6291db40f36c1f75b6402576fa4105e to your computer and use it in GitHub Desktop.
Save fpelliccioni/a6291db40f36c1f75b6402576fa4105e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Tested on Ubuntu 16.04 (Xenial)
# surely it can be run on Debian, Fedora and others with some changes
export LC_ALL=C
set -e
# User to setup for building. Vagrant is the default
export BUILDUSER=${BUILDUSER:-bchn}
### CREATE $BUILDUSER HERE IF YOU DIDN'T ALREADY
apt-get update
apt-get install -y git ruby sudo apt-cacher-ng qemu-utils docker.io python-vm-builder
# IMPORTANT!: maybe you can use the docker installation instructions instead of installing the docker.io package:
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
usermod -a -G docker ${BUILDUSER}
# chdir into build user home directory
cd /home/${BUILDUSER}/
# clone the bchn repo
git clone --depth 1 https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node.git bchn
## Install Gitian
git clone --depth 1 https://github.com/devrandom/gitian-builder.git
cd gitian-builder
cat << EOF > /home/${BUILDUSER}/.gitconfig
[user]
email = bchn@example.com
name = bch
EOF
chown -R ${BUILDUSER}:${BUILDUSER} /home/${BUILDUSER}
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! Provisioning Complete !!!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
echo "As the user ${BUILDUSER} run the following commands to produce a linux build:"
echo "export COMMIT=HEAD"
echo "export URL=https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node.git"
echo "cd gitian-builder"
echo "./bin/make-base-vm --docker --suite stretch --arch amd64"
echo "export USE_DOCKER=1"
echo "you could adapt -j and -m flag according to your number of core and the amount of RAM to dedicate to the process"
echo "./bin/gbuild -j8 -m 15000 --commit bitcoin=\${COMMIT} --url bitcoin=\${URL} /home/\${BUILDUSER}/bchn/contrib/gitian-descriptors/gitian-linux.yml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment