Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Script to automate gitian builds for Dogecoin.
- # Credit goes to Andymeows for sorting out my stupidity.
- #
- # I don't like how checking the dependencies are a bunch of if statements.
- # If anyone has a better way of doing so, please change it or tell stapler117@github.
- #
- # todo: download deps and check their integrity
- export USE_LXC=1
- function deps_check ()
- {
- while [ $# -gt 0 ]
- do
- command -V "$1" > /dev/null
- if [ $? != 0 ]
- then
- echo "you are missing $1"
- echo "To install all the needed dependencies: sudo apt-get install zip git apt-acher-ng python-vm-builder ruby libvirt-bin debootstrap gpg ssh"
- exit 1
- fi
- shift
- done
- }
- deps_check zip git apache2 apt-cacher-ng vmbuilder ruby debootstrap gpg ssh lxc-create
- echo "Good. It looks like you have everything you need!"
- echo ""
- echo "Testing github readyness."
- if [ ! -e ~/.ssh/id_rsa.pub ] #if keypair has not been made, then git is not ready
- then
- ssh-keyen -t rsa
- cat ~/.ssh/id_rsa.pub
- echo "Please add your new ssh public key to github before continuing."
- exit 1
- fi
- ssh -T git@github.com
- echo "Did you see a welcome mesage from Github with your username in it? (Y/n)"
- read confirm
- case "$confirm" in
- "N"|"n" )
- echo "You need to add your ssh public key to github."
- cat ~/.ssh/id_rsa.pub
- exit 2
- ;;
- *)
- echo "Great!"
- ;;
- esac
- function make_gpg_key ()
- {
- echo "Now lets deal with gpg"
- gpg --list-keys
- echo "You should have seen a key listed with the uid starting with your github"
- echo "username in the format 'github.com/username' followed by the email in the"
- echo "format <username@users.noreply.github.com> here is an example:"
- echo "pub 4096R/6D852A36 2014-07-16"
- echo "uid github.com/stapler117 <stapler117@users.noreply.github.com>"
- echo "sub 4096R/7C614536 2014-07-16"
- echo ""
- echo "Is that close to what you saw?(Y/n)"
- read confirm
- case "$confirm" in
- "N"|"n" )
- echo "Lets create one then."
- echo "The defalts are fine. The 'Real name' needs to be your github username and the "
- echo "email should be your github username followed by users.noreply.github.com"
- echo "Ready? (Y/y)"
- read confirm
- gpg --gen-key
- echo "You just created a gpg key!"
- gpg --list
- echo "Scroll up and see if that looks similar to the example. Is it? (Y/n)"
- read confirm
- if [ "$confirm" != "Y" ] -o [ "$confirm" != "y" ]
- then
- echo "That's fine. Lets try again."
- else
- echo "Fantastic!"
- fi
- ;;
- * )
- echo "Great!"
- ;;
- esac
- }
- make_gpg_key
- while [ "$confirm" != "Y" ] -o [ "$confirm" != "y" ]
- do
- make_gpg_key
- done
- echo "How much memory do you want to allocate in MiB?"
- read alloc_memory
- echo "how many cpu cores do you want to allocate? (1 GiB per core please)"
- read alloc_cpu
- echo "What version will you be building?"
- read VERSION
- echo "Who will be signing this? (github username)"
- read SIGNER
- cd ../..
- if [ ! -e ./gitian-builder/bin/make-base-vm ]
- then
- git clone git://github.com/devrandom/gitian-builder
- fi
- cd gitian-builder
- if [ ! -e base-precise-i386.qcow2 ]
- then
- echo "Building base i386 VM. This will take some time."
- ./bin/make-base-vm --lxc --arch i386 --suite precise
- fi
- if [ ! -e base-precise-amd64.qcow2 ]
- then
- echo "Building base amd64 VM. This will take some time."
- ./bin/make-base-vm --lxc --arch amd64 --suite precise
- fi
- echo "Base VM's have finished! Now to build Dogecoin's dependencies"
- mkdir inputs &2> /dev/null
- cd inputs
- if [ ! -e boost_1_55_0.tar.bz2 ]
- then
- wget 'https://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2'
- fi
- if [ ! -e boost-mingw-gas-cross-compile-2013-03-03.patch ]
- then
- wget 'https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch' -O boost-mingw-gas-cross-compile-2013-03-03.patch
- fi
- if [ ! -e db-5.1.29.NC.tar.gz ]
- then
- wget 'http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz'
- fi
- if [ ! -e libpng-1.6.8.tar.gz ]
- then
- wget 'https://downloads.sourceforge.net/project/libpng/libpng16/older-releases/1.6.8/libpng-1.6.8.tar.gz'
- fi
- if [ ! -e miniupnpc-1.9.tar.gz ]
- then
- wget 'http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.9.tar.gz' -O miniupnpc-1.9.tar.gz
- fi
- if [ ! -e openssl-1.0.1h.tar.gz ]
- then
- wget 'https://www.openssl.org/source/openssl-1.0.1h.tar.gz'
- fi
- if [ ! -e protobuf-2.5.0.tar.bz2 ]
- then
- wget 'https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2'
- fi
- if [ ! -e qrencode-3.4.3.tar.bz2 ]
- then
- wget 'https://fukuchi.org/works/qrencode/qrencode-3.4.3.tar.bz2'
- fi
- if [ ! -e qt-everywhere-opensource-src-4.6.4.tar.gz ]
- then
- wget 'https://download.qt-project.org/archive/qt/4.6/qt-everywhere-opensource-src-4.6.4.tar.gz'
- fi
- if [ ! -e qt-everywhere-opensource-src-5.2.0.tar.gz ]
- then
- wget 'https://download.qt-project.org/official_releases/qt/5.2/5.2.0/single/qt-everywhere-opensource-src-5.2.0.tar.gz'
- fi
- if [ ! -e zlib-1.2.8.tar.gz ]
- then
- wget 'http://zlib.net/zlib-1.2.8.tar.gz'
- fi
- echo "Building gitian dependencies."
- cd ..
- pwd
- ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/boost-linux.yml
- mv build/out/boost-*.zip inputs/
- exit 100
- ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/deps-linux.yml
- mv build/out/dogecoin-deps-*.zip inputs/
- ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/qt-linux.yml
- mv build/out/qt-*.tar.gz inputs/
- ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/boost-win.yml
- mv build/out/boost-*.zip inputs/
- ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/deps-win.yml
- mv build/out/dogecoin-deps-*.zip inputs/
- ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/qt-win.yml
- mv build/out/qt-*.zip inputs/
- ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/protobuf-win.yml
- mv build/out/protobuf-*.zip inputs/
- ./bin/gbuild --commit dogecoin=v${VERSION} --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/gitian-linux.yml
- ./bin/gsign --signer $SIGNER --release ${VERSION} --destination ../gitian.sigs/ ../dogecoin/contrib/gitian-descriptors/gitian-linux.yml
- cd build/out
- zip -r dogecoin-${VERSION}-linux-gitian.zip *
- mv dogecoin-${VERSION}-linux-gitian.zip ../../../
- cd ../..
- ./bin/gbuild --commit dogecoin=v${VERSION} --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/gitian-win.yml
- ./bin/gsign --signer $SIGNER --release ${VERSION}-win --destination ../gitian.sigs/ ../dogecoin/contrib/gitian-descriptors/gitian-win.yml
- cd build/out
- zip -r dogecoin-${VERSION}-win-gitian.zip *
- mv dogecoin-${VERSION}-win-gitian.zip ../../../
- cd ../..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement