Skip to content

Instantly share code, notes, and snippets.

@fivepiece
Last active February 7, 2018 01:10
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 fivepiece/4c5cd8733973b9821dba9c9c42958209 to your computer and use it in GitHub Desktop.
Save fivepiece/4c5cd8733973b9821dba9c9c42958209 to your computer and use it in GitHub Desktop.
gitian-debian9
# install debian 9 (netinstall is good)
# do not set a password for root
# packages : standard system utilities, ssh server
# log in as gitianuser with password
mkdir -p ~/.ssh
chmod 700 ~/.ssh
tee -a <<EOF ~/.ssh/authorized_keys
ssh-rsa MY-SSH-PUBKEY
EOF
sudo su - root
mkdir -p ~/.ssh
chmod 700 ~/.ssh
tee -a <<EOF ~/.ssh/authorized_keys
ssh-rsa MY-SSH-PUBKEY
EOF
apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get autoclean
# snapshot 1
apt-get install --no-install-recommends -y git ruby sudo apt-cacher-ng qemu-utils debootstrap lxc parted kpartx bridge-utils make ubuntu-archive-keyring curl virtualenv vim htop p7zip-full sleuthkit python-pip python-setuptools net-tools
# snapshot 2
tee <<EOF /etc/sudoers.d/gitian-lxc
%sudo ALL=NOPASSWD: /usr/bin/lxc-start
%sudo ALL=NOPASSWD: /usr/bin/lxc-execute
EOF
tee <<EOF /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF
tee <<EOF /etc/rc.local
#!/bin/sh -e
brctl addbr br0
ip addr add 10.0.3.2/24 broadcast 10.0.3.255 dev br0
ip link set br0 up
firewall-cmd --zone=trusted --add-interface=br0
exit 0
EOF
chmod +x /etc/rc.local
unset my_iface
systemctl enable rc-local
systemctl start rc-local.service
# https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd
# snapshopt 3
# reboot and connect with gitianuser
tee <<EOF $HOME/.gitconfig
[user]
name = fivepiece
email = fivepiece@users.noreply.github.com
EOF
virtualenv --python=python2 genv1
cd genv1
tee -a <<'EOF' ./bin/activate
export USE_LXC=1
export GITIAN_HOST_IP=10.0.3.2
export LXC_GUEST_IP=10.0.3.5
export PATH="$PATH:$VIRTUAL_ENV/home/gitian-builder/libexec:$VIRTUAL_ENV/home/gitian-builder/bin"
EOF
source bin/activate
pip install VMbuilder Cheetah
mkdir home
cd home
# snapshot 4
git clone https://github.com/devrandom/gitian-builder.git
mkdir -p gitian-builder/inputs
# scp osx sdk tar from host to gitian-builder/inputs
git clone https://github.com/bitcoin-core/bitcoin-detached-sigs.git
cd bitcoin-detached-sigs
git checkout v0.16.0rc2
cd ..
git clone https://github.com/bitcoin-core/gitian.sigs.git
git clone https://github.com/bitcoin/bitcoin
./bitcoin/contrib/gitian-build.sh --setup --detach-sign -j 4 -m 4096 -b -o lxw fivepiece 0.16.0rc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment