ffead-cpp-apache.sh 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. RETCODE=$(fw_exists ${IROOT}/ffead-cpp-apache.installed)
  3. [ ! "$RETCODE" == 0 ] || { return 0; }
  4. fw_get -o unixODBC-2.3.4.tar.gz ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.4.tar.gz
  5. fw_untar unixODBC-2.3.4.tar.gz
  6. cd unixODBC-2.3.4
  7. ./configure --enable-stats=no --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --sysconfdir=/etc
  8. sudo make install
  9. sudo apt-get install build-essential
  10. sudo apt-get install -y uuid-dev libmyodbc odbc-postgresql
  11. #fw_get -o ffead-cpp-2.0.tar.gz https://github.com/sumeetchhetri/ffead-cpp/releases/download/2.0/ffead-cpp-2.0-te-bin.tar.gz
  12. fw_get -o ffead-cpp-2.0.tar.gz http://localhost:8000/ffead-cpp-2.0-te-bin.tar.gz
  13. fw_untar ffead-cpp-2.0.tar.gz
  14. sudo rm -rf /var/www/ffead-cpp-2.0
  15. sudo cp -R ffead-cpp-2.0-bin/ /var/www
  16. sudo mv /var/www/ffead-cpp-2.0-bin /var/www/ffead-cpp-2.0
  17. rm -rf ffead-cpp-2.0/
  18. sudo sed -i 's|localhost|'${DBHOST}'|g' ${TROOT}/ffead-cpp-2.0/web/te-benchmark/config/sdorm*
  19. sudo rm -f /etc/odbcinst.ini
  20. sudo rm -f /etc/odbc.ini
  21. sudo cp ${TROOT}/ffead-cpp-2.0/resources/sample-odbcinst.ini /etc/odbcinst.ini
  22. sudo cp ${TROOT}/ffead-cpp-2.0/resources/sample-odbc.ini /etc/odbc.ini
  23. sudo sed -i 's|localhost|'${DBHOST}'|g' /etc/odbc.ini
  24. #fw_get -o mongo-c-driver-1.4.0.tar.gz https://github.com/mongodb/mongo-c-driver/releases/download/1.4.0/mongo-c-driver-1.4.0.tar.gz
  25. fw_get -o mongo-c-driver-1.4.0.tar.gz http://localhost:8000/mongo-c-driver-1.4.0.tar.gz
  26. fw_untar mongo-c-driver-1.4.0.tar.gz
  27. cd mongo-c-driver-1.4.0/
  28. ./configure --prefix=${IROOT} --libdir=${IROOT} --disable-automatic-init-and-cleanup
  29. make && sudo make install
  30. FFEADROOT=/var/www/ffead-cpp-2.0
  31. ETROOT=${FFEADROOT//\//\\/}
  32. EIROOT=${IROOT//\//\\/}
  33. sudo sed -i 's/.*Listen 80.*/#Listen 80/' /etc/apache2/ports.conf
  34. sudo sed -i '/^export FFEAD_CPP_PATH=/{h;s/=.*/='"${ETROOT}"'/};${x;/^$/{s//export FFEAD_CPP_PATH='"${ETROOT}"'/;H};x}' /etc/apache2/envvars
  35. sudo sed -i '/^export LD_LIBRARY_PATH=/{h;s/=.*/='"${EIROOT}"':$FFEAD_CPP_PATH\/lib:$LD_LIBRARY_PATH/};${x;/^$/{s//export LD_LIBRARY_PATH='"${EIROOT}"':$FFEAD_CPP_PATH\/lib:$LD_LIBRARY_PATH/;H};x}' /etc/apache2/envvars
  36. sudo bash -c 'rm -f /etc/apache2/sites-enabled/ffead-site.conf'
  37. sudo bash -c 'cat > /etc/apache2/sites-enabled/ffead-site.conf <<EOL
  38. LoadModule ffead_cpp_module '"${FFEADROOT}"'/mod_ffeadcpplib.so
  39. Listen 8080
  40. FFEAD_CPP_PATH '"${FFEADROOT}"'
  41. <VirtualHost *:8080>
  42. DocumentRoot '"${FFEADROOT}"'/web
  43. SetHandler ffead_cpp_module
  44. <Directory '"${FFEADROOT}"'>
  45. Options FollowSymLinks
  46. AllowOverride None
  47. Require all denied
  48. </Directory>
  49. <Directory '"${FFEADROOT}"'/web/>
  50. Options -Indexes +FollowSymLinks +MultiViews
  51. AllowOverride All
  52. Require all granted
  53. </Directory>
  54. </VirtualHost>
  55. EOL'
  56. sudo chown -R www-data:www-data ${FFEADROOT}
  57. sudo chmod -R g+rw ${FFEADROOT}
  58. touch ${IROOT}/ffead-cpp-apache.installed