Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.93 KB | None | 0 0
  1. #!/bin/bash
  2. # Script to automate gitian builds for Dogecoin.
  3. # Credit goes to Andymeows for sorting out my stupidity.
  4. #
  5. # I don't like how checking the dependencies are a bunch of if statements.
  6. # If anyone has a better way of doing so, please change it or tell stapler117@github.
  7. #
  8. # todo: download deps and check their integrity
  9.  
  10. export USE_LXC=1
  11.  
  12. function deps_check ()
  13. {
  14. while [ $# -gt 0 ]
  15. do
  16. command -V "$1" > /dev/null
  17. if [ $? != 0 ]
  18. then
  19. echo "you are missing $1"
  20. 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"
  21. exit 1
  22. fi
  23. shift
  24. done
  25. }
  26.  
  27. deps_check zip git apache2 apt-cacher-ng vmbuilder ruby debootstrap gpg ssh lxc-create
  28.  
  29. echo "Good. It looks like you have everything you need!"
  30. echo ""
  31.  
  32. echo "Testing github readyness."
  33. if [ ! -e ~/.ssh/id_rsa.pub ] #if keypair has not been made, then git is not ready
  34. then
  35. ssh-keyen -t rsa
  36. cat ~/.ssh/id_rsa.pub
  37. echo "Please add your new ssh public key to github before continuing."
  38. exit 1
  39. fi
  40. ssh -T git@github.com
  41. echo "Did you see a welcome mesage from Github with your username in it? (Y/n)"
  42. read confirm
  43. case "$confirm" in
  44. "N"|"n" )
  45. echo "You need to add your ssh public key to github."
  46. cat ~/.ssh/id_rsa.pub
  47. exit 2
  48. ;;
  49. *)
  50. echo "Great!"
  51. ;;
  52. esac
  53.  
  54. function make_gpg_key ()
  55. {
  56.  
  57. echo "Now lets deal with gpg"
  58. gpg --list-keys
  59.  
  60. echo "You should have seen a key listed with the uid starting with your github"
  61. echo "username in the format 'github.com/username' followed by the email in the"
  62. echo "format <username@users.noreply.github.com> here is an example:"
  63. echo "pub 4096R/6D852A36 2014-07-16"
  64. echo "uid github.com/stapler117 <stapler117@users.noreply.github.com>"
  65. echo "sub 4096R/7C614536 2014-07-16"
  66. echo ""
  67. echo "Is that close to what you saw?(Y/n)"
  68.  
  69. read confirm
  70. case "$confirm" in
  71. "N"|"n" )
  72.  
  73. echo "Lets create one then."
  74. echo "The defalts are fine. The 'Real name' needs to be your github username and the "
  75. echo "email should be your github username followed by users.noreply.github.com"
  76. echo "Ready? (Y/y)"
  77.  
  78. read confirm
  79. gpg --gen-key
  80. echo "You just created a gpg key!"
  81. gpg --list
  82. echo "Scroll up and see if that looks similar to the example. Is it? (Y/n)"
  83. read confirm
  84. if [ "$confirm" != "Y" ] -o [ "$confirm" != "y" ]
  85. then
  86. echo "That's fine. Lets try again."
  87. else
  88. echo "Fantastic!"
  89. fi
  90. ;;
  91. * )
  92. echo "Great!"
  93. ;;
  94. esac
  95. }
  96. make_gpg_key
  97. while [ "$confirm" != "Y" ] -o [ "$confirm" != "y" ]
  98. do
  99. make_gpg_key
  100. done
  101.  
  102. echo "How much memory do you want to allocate in MiB?"
  103. read alloc_memory
  104. echo "how many cpu cores do you want to allocate? (1 GiB per core please)"
  105. read alloc_cpu
  106. echo "What version will you be building?"
  107. read VERSION
  108. echo "Who will be signing this? (github username)"
  109. read SIGNER
  110.  
  111. cd ../..
  112. if [ ! -e ./gitian-builder/bin/make-base-vm ]
  113. then
  114. git clone git://github.com/devrandom/gitian-builder
  115. fi
  116. cd gitian-builder
  117.  
  118. if [ ! -e base-precise-i386.qcow2 ]
  119. then
  120. echo "Building base i386 VM. This will take some time."
  121. ./bin/make-base-vm --lxc --arch i386 --suite precise
  122. fi
  123.  
  124. if [ ! -e base-precise-amd64.qcow2 ]
  125. then
  126. echo "Building base amd64 VM. This will take some time."
  127. ./bin/make-base-vm --lxc --arch amd64 --suite precise
  128. fi
  129. echo "Base VM's have finished! Now to build Dogecoin's dependencies"
  130.  
  131. mkdir inputs &2> /dev/null
  132. cd inputs
  133.  
  134. if [ ! -e boost_1_55_0.tar.bz2 ]
  135. then
  136. wget 'https://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2'
  137. fi
  138. if [ ! -e boost-mingw-gas-cross-compile-2013-03-03.patch ]
  139. then
  140. wget 'https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch' -O boost-mingw-gas-cross-compile-2013-03-03.patch
  141. fi
  142. if [ ! -e db-5.1.29.NC.tar.gz ]
  143. then
  144. wget 'http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz'
  145. fi
  146. if [ ! -e libpng-1.6.8.tar.gz ]
  147. then
  148. wget 'https://downloads.sourceforge.net/project/libpng/libpng16/older-releases/1.6.8/libpng-1.6.8.tar.gz'
  149. fi
  150. if [ ! -e miniupnpc-1.9.tar.gz ]
  151. then
  152. wget 'http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.9.tar.gz' -O miniupnpc-1.9.tar.gz
  153. fi
  154. if [ ! -e openssl-1.0.1h.tar.gz ]
  155. then
  156. wget 'https://www.openssl.org/source/openssl-1.0.1h.tar.gz'
  157. fi
  158. if [ ! -e protobuf-2.5.0.tar.bz2 ]
  159. then
  160. wget 'https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2'
  161. fi
  162. if [ ! -e qrencode-3.4.3.tar.bz2 ]
  163. then
  164. wget 'https://fukuchi.org/works/qrencode/qrencode-3.4.3.tar.bz2'
  165. fi
  166. if [ ! -e qt-everywhere-opensource-src-4.6.4.tar.gz ]
  167. then
  168. wget 'https://download.qt-project.org/archive/qt/4.6/qt-everywhere-opensource-src-4.6.4.tar.gz'
  169. fi
  170. if [ ! -e qt-everywhere-opensource-src-5.2.0.tar.gz ]
  171. then
  172. wget 'https://download.qt-project.org/official_releases/qt/5.2/5.2.0/single/qt-everywhere-opensource-src-5.2.0.tar.gz'
  173. fi
  174. if [ ! -e zlib-1.2.8.tar.gz ]
  175. then
  176. wget 'http://zlib.net/zlib-1.2.8.tar.gz'
  177. fi
  178.  
  179. echo "Building gitian dependencies."
  180. cd ..
  181. pwd
  182. ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/boost-linux.yml
  183. mv build/out/boost-*.zip inputs/
  184. exit 100
  185. ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/deps-linux.yml
  186. mv build/out/dogecoin-deps-*.zip inputs/
  187.  
  188. ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/qt-linux.yml
  189. mv build/out/qt-*.tar.gz inputs/
  190.  
  191. ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/boost-win.yml
  192. mv build/out/boost-*.zip inputs/
  193.  
  194. ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/deps-win.yml
  195. mv build/out/dogecoin-deps-*.zip inputs/
  196.  
  197. ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/qt-win.yml
  198. mv build/out/qt-*.zip inputs/
  199.  
  200. ./bin/gbuild --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/protobuf-win.yml
  201. mv build/out/protobuf-*.zip inputs/
  202.  
  203.  
  204. ./bin/gbuild --commit dogecoin=v${VERSION} --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/gitian-linux.yml
  205. ./bin/gsign --signer $SIGNER --release ${VERSION} --destination ../gitian.sigs/ ../dogecoin/contrib/gitian-descriptors/gitian-linux.yml
  206. cd build/out
  207. zip -r dogecoin-${VERSION}-linux-gitian.zip *
  208. mv dogecoin-${VERSION}-linux-gitian.zip ../../../
  209. cd ../..
  210.  
  211. ./bin/gbuild --commit dogecoin=v${VERSION} --memory $alloc_memory --num-make $alloc_cpus ../dogecoin/contrib/gitian-descriptors/gitian-win.yml
  212. ./bin/gsign --signer $SIGNER --release ${VERSION}-win --destination ../gitian.sigs/ ../dogecoin/contrib/gitian-descriptors/gitian-win.yml
  213. cd build/out
  214. zip -r dogecoin-${VERSION}-win-gitian.zip *
  215. mv dogecoin-${VERSION}-win-gitian.zip ../../../
  216. cd ../..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement