Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # This Source Code Form is subject to the terms of the Mozilla Public
  4. # License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. # You can obtain one at http://mozilla.org/MPL/2.0/.
  6. #
  7. # Copyright (C) 2014 Star2Billing S.L.
  8. #
  9. # The Initial Developer of the Original Code is
  10. # Arezqui Belaid <info@star2billing.com>
  11. #
  12.  
  13. DATETIME=$(date +"%Y%m%d%H%M%S")
  14. KERNELARCH=$(uname -p)
  15. SCRIPT_NOTICE="This script is only intended to run on Ubuntu 12.04 / 14.04"
  16.  
  17.  
  18. # Identify Linux Distribution type
  19. func_identify_os() {
  20.  
  21. if [ -f /etc/debian_version ] ; then
  22. DIST='DEBIAN'
  23. if [ "$(lsb_release -cs)" != "lucid" ] && [ "$(lsb_release -cs)" != "precise" ] && [ "$(lsb_release -cs)" != "trusty" ]; then
  24. echo $SCRIPT_NOTICE
  25.  
  26. fi
  27. # elif [ -f /etc/redhat-release ] ; then
  28. # DIST='CENTOS'
  29. # if [ "$(awk '{print $3}' /etc/redhat-release)" != "6.2" ] ; then
  30. # echo $SCRIPT_NOTICE
  31. # exit 255
  32. # fi
  33. else
  34. echo $SCRIPT_NOTICE
  35. exit 1
  36. fi
  37.  
  38. #Prepare settings for installation
  39. case $DIST in
  40. 'DEBIAN')
  41. SCRIPT_VIRTUALENVWRAPPER="/usr/local/bin/virtualenvwrapper.sh"
  42. APACHE_CONF_DIR="/etc/apache2/sites-enabled/"
  43. APACHE_USER="www-data"
  44. APACHE_SERVICE='apache2'
  45. WSGI_ADDITIONAL=""
  46. WSGIApplicationGroup=""
  47. ;;
  48. 'CENTOS')
  49. SCRIPT_VIRTUALENVWRAPPER="/usr/bin/virtualenvwrapper.sh"
  50. APACHE_CONF_DIR="/etc/httpd/conf.d/"
  51. APACHE_USER="apache"
  52. APACHE_SERVICE='httpd'
  53. #WSGI_ADDITIONAL="WSGISocketPrefix run/wsgi"
  54. WSGI_ADDITIONAL="WSGISocketPrefix /var/run/wsgi"
  55. WSGIApplicationGroup="WSGIApplicationGroup %{GLOBAL}"
  56. ;;
  57. esac
  58. }
  59.  
  60.  
  61. #Function mysql db setting
  62. func_get_mysql_database_setting_asteriskcdrdb() {
  63. if mysql -u$MYSQLUSER -p$MYSQLPASSWORD -P$MYHOSTPORT -h$MYHOST $DATABASENAME -e ";" ; then
  64. #Database settings correct
  65. echo "Mysql settings correct!"
  66. else
  67. echo ""
  68. echo "Configure Mysql Settings to connect to the A2Billing Database..."
  69. echo ""
  70.  
  71. echo "Enter Mysql hostname (default:localhost)"
  72. read MYHOST
  73. if [ -z "$MYHOST" ]; then
  74. MYHOST="localhost"
  75. fi
  76. echo "Enter Mysql port (default:3306)"
  77. read MYHOSTPORT
  78. if [ -z "$MYHOSTPORT" ]; then
  79. MYHOSTPORT="3306"
  80. fi
  81. echo "Enter Mysql Username (default:root)"
  82. read MYSQLUSER
  83. if [ -z "$MYSQLUSER" ]; then
  84. MYSQLUSER="root"
  85. fi
  86. echo "Enter Mysql Password (default:password)"
  87. read MYSQLPASSWORD
  88. if [ -z "$MYSQLPASSWORD" ]; then
  89. MYSQLPASSWORD="password"
  90. fi
  91. echo "Enter Database name (default:asteriskcdrdb)"
  92. read DATABASENAME
  93. if [ -z "$DATABASENAME" ]; then
  94. DATABASENAME="asteriskcdrdb"
  95. fi
  96. fi
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement