dominique120

Untitled

Jan 7th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.40 KB | None | 0 0
  1.  
  2. debianDeps() {
  3.     apt-get install git cmake build-essential liblua5.2-dev \
  4.         libgmp3-dev libmysqlclient-dev libboost-system-dev
  5. }
  6.  
  7. fedoraDeps() {
  8.     yum install git cmake gcc-c++ boost-devel \
  9.         gmp-devel community-mysql-devel lua-devel
  10. }
  11.  
  12. bsdDeps() {
  13.     cd /usr/ports/shells/bash && make install clean BATCH=yes
  14.     cd /usr/ports/devel/git && make install clean BATCH=yes
  15.     cd /usr/ports/devel/cmake && make install clean BATCH=yes
  16.     cd /usr/ports/lang/gcc47 && make install clean BATCH=yes
  17.     cd /usr/ports/lang/luajit && make install clean BATCH=yes
  18.     cd /usr/ports/devel/boost-libs && make install clean BATCH=yes
  19.     cd /usr/ports/math/gmp && make install clean BATCH=yes
  20.     cd /usr/ports/databases/mysql-connector-c && make install clean BATCH=yes
  21. }
  22.  
  23. libInstall() {
  24.     echo "Libraries and Build Tools... Installed"
  25. }
  26.  
  27. bsdBuild() {
  28.     echo "Building on FreeBSD"
  29.     mkdir build && cd build
  30.     CXX=g++47 cmake ..
  31.     echo "Build on $cpuCores threads with $coreBuild processes? (experimental but loads faster) y or n "
  32.         read $ans1_4
  33.             if [[ $ans1_4 = "y" ]]; then
  34.                 echo -e $greenText"Building on $cpuCores threads with $coreBuild ."$none
  35.                 make -j $coreBuild
  36.             elif [[ $ans1_4 = "n" ]]; then
  37.                 echo -e $blueText"Building on a single thread."$none
  38.                 make
  39.             else
  40.                 echo "answer y or n"
  41.                 echo -e $redText"Answer y or n"$none
  42.             fi
  43. }  
  44.  
  45. genBuild() {
  46.     echo "Building..."
  47.     mkdir build && cd build
  48.     cmake ..
  49.         echo "Build on $cpuCores threads with $coreBuild processes? (experimental but loads faster) y or n "
  50.         read $ans1_4
  51.             if [[ $ans1_4 = "y" ]]; then
  52.                 echo -e $greenText"Building on $cpuCores threads with $coreBuild ."$none
  53.                 make -j $coreBuild
  54.             elif [[ $ans1_4 = "n" ]]; then
  55.                 echo -e $blueText"Building on a single thread."$none
  56.                 make
  57.             else
  58.                 echo -e $redText"Answer y or n"$none
  59.             fi             
  60. }
  61.  
  62. clean() {
  63.     mkdir objs/
  64.     mv *.o objs/
  65.     echo "There might be a few leftover files."
  66. }
  67.  
  68. ###
  69. ### Script starts here
  70. ###
  71.  
  72. #check if root
  73. if [[ $EUID -ne 0 ]]; then
  74.     echo "You must be root to use this script, press enter to exit."
  75.     read end
  76.     exit 1
  77. fi
  78. #OS dependencies and other stuff
  79. echo "Chose your Operating System. {Supported OS: Debian, Ubuntu, Fedora, CentOS, FreeBSD} "
  80. read ans1
  81.            
  82. if [[ $ans1 = "Fedora" ]] || [[ $nas1 = "CentOS" ]]; then
  83.     echo -n "Should the script install dependencies? y or n"
  84.     read ans1_1
  85.     if [[ $ans1_1 = "y" ]]; then
  86.         fedoraDeps
  87.     elif [[ $ans1_1 = "n" ]]; then
  88.         break
  89.     else
  90.         echo "Answer 'y' or 'n' "
  91.     fi
  92. elif [[ $ans1 = "Debian" ]] || [[ $ans1 = "Ubuntu" ]]; then
  93.     echo -n "Should the script install dependencies? y or n"
  94.     read ans1_1
  95.     if [[ $ans1_1 = "y" ]]; then
  96.         debianDeps
  97.     elif [[ $ans1_1 = "n" ]]; then
  98.         break
  99.     else
  100.         echo "Answer 'y' or 'n' "
  101.     fi
  102. elif [[ $ans1 = "FreeBSD" ]]; then
  103.     echo -n "Should the script install dependencies? y or n"
  104.     read ans1_1
  105.         if [[ $ans1_1 = "y" ]]; then
  106.             bsdDeps
  107.         elif [[ $ans1_1 = "n" ]]; then
  108.             break
  109.         else
  110.             echo "Answer 'y' or 'n' "
  111.         fi             
  112.         else
  113.             echo "Pick a valid OS"     
  114.         fi
  115.        
  116. #Compiling here
  117.  
  118. echo -n "Are we on FreeBSD? y or n"
  119. read ans1_2
  120.     if [[ $ans1_2 = "y" ]]; then
  121.         bsdbuild
  122.     elif [[ $ans1_2 = "n" ]]; then
  123.         genBuild
  124.     else
  125.         echo "Answer y or n"
  126.     fi
  127.    
  128. echo "Should the folder be cleaned? y or n"
  129.     read ans1_3
  130.     if [[ $ans1_3 = "y" ]]; then
  131.         clean
  132.     elif [[ $ans1_3 = "n" ]]; then
  133.         echo "Exiting..."
  134.         exit 1
  135.     else
  136.         echo "Answer y or n"
  137.     fi
Advertisement
Add Comment
Please, Sign In to add comment