Advertisement
opexxx

novaInstallHelper.sh

Apr 29th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.73 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. PWD=`pwd`
  4.  
  5. SAVE=$PWD'/'
  6.  
  7. NEW_PERM=$SUDO_USER:$SUDO_USER
  8.  
  9. if [ -z $BUILDDIR ]; then
  10.     BUILDDIR=~/nova-build
  11. fi
  12.  
  13. if [ -z $1 ]; then
  14.     BRANCH="master"
  15. else
  16.     BRANCH="$1"
  17. fi
  18.  
  19. echo "Build Dir is $BUILDDIR"
  20.  
  21. check_err() {
  22.     ERR=$?
  23.     if [ "$ERR" -ne "0" ] ; then
  24.         echo "Error occurred during build process; terminating script!"
  25.         exit $ERR
  26.     fi
  27. }
  28.  
  29. mkdir -p ${BUILDDIR}
  30.  
  31. echo "##############################################################################"
  32. echo "#                          NOVA DEPENDENCY CHECK                             #"
  33. echo "##############################################################################"
  34. apt-get -y install git build-essential libann-dev libpcap0.8-dev libboost-program-options-dev libboost-serialization-dev sqlite3 libsqlite3-dev libcurl3 libcurl4-gnutls-dev iptables libevent-dev libprotoc-dev protobuf-compiler libdumbnet-dev libpcap-dev libpcre3-dev libedit-dev bison flex libtool automake libcap2-bin libboost-system-dev libboost-filesystem-dev python perl tcl liblinux-inotify2-perl libfile-readbackwards-perl
  35. check_err
  36.  
  37. echo "##############################################################################"
  38. echo "#                         DOWNLOADING NOVA FROM GIT                          #"
  39. echo "##############################################################################"
  40. cd ${BUILDDIR}
  41. rm -fr Honeyd
  42. rm -fr Nova
  43. git clone git://github.com/DataSoft/Honeyd.git
  44. check_err
  45. git clone git://github.com/DataSoft/Nova.git
  46. check_err
  47.  
  48. echo "##############################################################################"
  49. echo "#                              BUILDING HONEYD                               #"
  50. echo "##############################################################################"
  51. cd ${BUILDDIR}/Honeyd
  52. git checkout -f $BRANCH
  53. ./autogen.sh
  54. check_err
  55. automake
  56. check_err
  57. ./configure
  58. check_err
  59. make -j2
  60. check_err
  61. make install
  62. check_err
  63.  
  64. cd ${BUILDDIR}/Nova
  65. git checkout -f $BRANCH
  66. git submodule init
  67. git submodule update
  68. check_err
  69.  
  70. echo "##############################################################################"
  71. echo "#                             BUILDING NOVA                                  #"
  72. echo "##############################################################################"
  73. cd ${BUILDDIR}/Nova/Quasar
  74. bash getDependencies.sh
  75. check_err
  76. chown -R -f $NEW_PERM node-v0.8.5/
  77. chown -f $NEW_PERM node-v0.8.5.tar.gz
  78. cd ${HOME}
  79. chown -R $NEW_PERM .npm/
  80. check_err
  81. cd ${BUILDDIR}/Nova/Quasar
  82. npm install -g forever
  83. check_err
  84.  
  85. cd ${BUILDDIR}/Nova
  86. make -j2 debug
  87. check_err
  88. make uninstall-files
  89. make install
  90. check_err
  91.  
  92. bash ${BUILDDIR}/Nova/Installer/nova_init
  93.  
  94. echo "##############################################################################"
  95. echo "#                             FETCHING NMAP 6                                #"
  96. echo "##############################################################################"
  97. version=$(nmap --version | sed -n '2p')
  98. if [ "$version" != "Nmap version 6.01 ( http://nmap.org )" ]; then
  99.     cd ${BUILDDIR}
  100.     wget http://nmap.org/dist/nmap-6.01.tar.bz2
  101.     check_err
  102.     tar -xf nmap-6.01.tar.bz2
  103.     check_err
  104.     chown -R nova:nova nmap-6.01
  105.     cd nmap-6.01
  106.     ./configure
  107.     check_err
  108.     make -j2
  109.     check_err
  110.     make install
  111.     check_err
  112. else
  113.   echo "Nmap version already matches required version. Skipping step."
  114. fi
  115.  
  116. cd $SAVE
  117. chown -R -f $NEW_PERM nova-build/
  118. cd $HOME
  119. chown -R -f $NEW_PERM .node-gyp/
  120.  
  121. cd /usr/share/honeyd/scripts/
  122. chown -R -f $NEW_PERM misc/
  123.  
  124. echo "##############################################################################"
  125. echo "#                                    DONE                                    #"
  126. echo "##############################################################################"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement