Changeset View
Changeset View
Standalone View
Standalone View
contrib/gitian/provisioner.sh
#!/bin/bash -e | #!/bin/bash -e | ||||
# User to setup for building. Vagrant is the default | # User to setup for building. Vagrant is the default | ||||
export BUILDUSER=${BUILDUSER:-vagrant} | export BUILDUSER=${BUILDUSER:-vagrant} | ||||
apt-get update | apt-get update | ||||
apt-get install -y git ruby sudo apt-cacher-ng qemu-utils debootstrap \ | apt-get install -y git ruby sudo apt-cacher-ng qemu-utils debootstrap \ | ||||
lxc python-cheetah parted kpartx bridge-utils make curl | lxc python-cheetah parted kpartx bridge-utils make curl | ||||
# the version of lxc-start in Debian needs to run as root, so make sure | # the version of lxc-start in Debian needs to run as root, so make sure | ||||
# that the build script can execute it without providing a password | # that the build script can execute it without providing a password | ||||
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc | echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc | ||||
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" >> /etc/sudoers.d/gitian-lxc | echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" >> /etc/sudoers.d/gitian-lxc | ||||
# make sure that USE_LXC is always set when logging in as vagrant, | # make sure that USE_LXC is always set when logging in as vagrant, | ||||
# and configure LXC IP addresses | # and configure LXC IP addresses | ||||
echo 'export USE_LXC=1' >> /home/${BUILDUSER}/.profile | { | ||||
echo 'export LXC_BRIDGE=lxcbr0' >> /home/${BUILDUSER}/.profile | echo 'export USE_LXC=1' | ||||
echo 'export GITIAN_HOST_IP=10.0.3.1' >> /home/${BUILDUSER}/.profile | echo 'export LXC_BRIDGE=lxcbr0' | ||||
echo 'export LXC_GUEST_IP=10.0.3.5' >> /home/${BUILDUSER}/.profile | echo 'export GITIAN_HOST_IP=10.0.3.1' | ||||
echo 'export LXC_GUEST_IP=10.0.3.5' | |||||
} >> /home/${BUILDUSER}/.profile | |||||
# Setup bridge | # Setup bridge | ||||
echo 'USE_LXC_BRIDGE="true"' > /etc/default/lxc-net | echo 'USE_LXC_BRIDGE="true"' > /etc/default/lxc-net | ||||
echo 'lxc.network.type = veth' > /etc/lxc/default.conf | { | ||||
echo 'lxc.network.link = lxcbr0' >> /etc/lxc/default.conf | echo 'lxc.network.type = veth' | ||||
echo 'lxc.network.flags = up' >> /etc/lxc/default.conf | echo 'lxc.network.link = lxcbr0' | ||||
echo 'lxc.network.hwaddr = 00:16:3e:xx:xx:xx' >> /etc/lxc/default.conf | echo 'lxc.network.flags = up' | ||||
echo 'lxc.network.hwaddr = 00:16:3e:xx:xx:xx' | |||||
} > /etc/lxc/default.conf | |||||
service lxc-net restart | service lxc-net restart | ||||
# chdir into build user home directory | # chdir into build user home directory | ||||
cd /home/${BUILDUSER}/ | cd /home/${BUILDUSER}/ | ||||
## Install vm-builder | ## Install vm-builder | ||||
wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vm-builder/vm-builder_0.12.4+bzr494.orig.tar.gz | wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vm-builder/vm-builder_0.12.4+bzr494.orig.tar.gz | ||||
echo "76cbf8c52c391160b2641e7120dbade5afded713afaa6032f733a261f13e6a8e vm-builder_0.12.4+bzr494.orig.tar.gz" | sha256sum -c | echo "76cbf8c52c391160b2641e7120dbade5afded713afaa6032f733a261f13e6a8e vm-builder_0.12.4+bzr494.orig.tar.gz" | sha256sum -c | ||||
Show All 25 Lines |