<commit_before>#!/bin/bash
###############################################################################
# ASTPP - Open Source VoIP Billing Solution
#
# Copyright (C) 2016 iNextrix Technologies Pvt. Ltd.
# ASTPP Version 3.5
# License https://www.gnu.org/licenses/agpl-3.0.html
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
###############################################################################


#################################
##########  variables ###########
#################################
TEMP_USER_ANSWER="no"
INSTALL_ASTPP="no"
CURRENT_DIR="${PWD}"
DOWNLOAD_DIR="/usr/src"
ASTPP_SOURCE_DIR=/usr/src/latest
ASTPP_HOST_DOMAIN_NAME="host.domain.tld"

#ASTPP Configuration
ASTPPDIR=/var/lib/astpp/
ASTPPEXECDIR=/usr/local/astpp/
ASTPPLOGDIR=/var/log/astpp/
LOCALE_DIR=/usr/local/share/locale

#Freeswich Configuration
FS_DIR=/usr/local/freeswitch
FS_SOUNDSDIR=${FS_DIR}/sounds/en/us/callie
FS_SCRIPTS=${FS_DIR}/scripts
WWWDIR=/var/www/html

ASTPP_USING_FREESWITCH="no"
ASTPP_USING_ASTERISK="no"
INSTALL_ASTPP_WEB_INTERFACE="no"

ASTPP_DATABASE_NAME="astpp"

ASTPP_DB_USER="astppuser"

MYSQL_ROOT_PASSWORD=""
ASTPPUSER_MYSQL_PASSWORD=""


#################################
####  general functions #########
#################################

# task of function: ask to user yes or no
# usage: ask_to_user_yes_or_no "your question"
# return TEMP_USER_ANSWER variable filled with "yes" or "no"
ask_to_user_yes_or_no () 
{
		# default answer = no
		TEMP_USER_ANSWER="no"
		clear
		echo ""
		echo -e ${1}
		read -n 1 -p "(y/n)? :"
		if [ "${REPLY}" = "y" ]; then
			TEMP_USER_ANSWER="yes"
		else
			TEMP_USER_ANSWER="no"
		fi
}

# Determine the OS architecture
get_os_architecture () 
{
		if [ ${HOSTTYPE} == "x86_64" ]; then
			ARCH=x64
		else
			ARCH=x32
		fi
}
get_os_architecture

# Linux Distribution CentOS or Debian
get_linux_distribution ()
{ 
	V1=`cat /etc/*release | head -n1 | tail -n1 | cut -c 14- | cut -c1-18`
	V2=`cat /etc/*release | head -n7 | tail -n1 | cut -c 14- | cut -c1-14`
	PHPV=`php -v |sed -n 1p|awk '{ print $1 $2 }'|cut -c 1-4`
	if [ "$V1" = "Debian GNU/Linux 8" ]; then
		DIST="DEBIAN"
		else if [ "$V2" = "CentOS Linux 7" ]; then
			DIST="CENTOS"
		else
			DIST="OTHER"
			echo 'Opps!! Quick Installation does not support your distribution'
			exit 1
		fi
	fi
}														
get_linux_distribution


install_epel () 
{
		yum install epel-release
}

remove_epel () 
{
		# only on CentOS<commit_msg>added install php7 repos of deb and cent<commit_after>#!/bin/bash
###############################################################################
# ASTPP - Open Source VoIP Billing Solution
#
# Copyright (C) 2016 iNextrix Technologies Pvt. Ltd.
# ASTPP Version 3.5
# License https://www.gnu.org/licenses/agpl-3.0.html
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
###############################################################################


#################################
##########  variables ###########
#################################
TEMP_USER_ANSWER="no"
INSTALL_ASTPP="no"
CURRENT_DIR="${PWD}"
DOWNLOAD_DIR="/usr/src"
ASTPP_SOURCE_DIR=/usr/src/latest
ASTPP_HOST_DOMAIN_NAME="host.domain.tld"

#ASTPP Configuration
ASTPPDIR=/var/lib/astpp/
ASTPPEXECDIR=/usr/local/astpp/
ASTPPLOGDIR=/var/log/astpp/
LOCALE_DIR=/usr/local/share/locale

#Freeswich Configuration
FS_DIR=/usr/local/freeswitch
FS_SOUNDSDIR=${FS_DIR}/sounds/en/us/callie
FS_SCRIPTS=${FS_DIR}/scripts
WWWDIR=/var/www/html

ASTPP_USING_FREESWITCH="no"
ASTPP_USING_ASTERISK="no"
INSTALL_ASTPP_WEB_INTERFACE="no"

ASTPP_DATABASE_NAME="astpp"

ASTPP_DB_USER="astppuser"

MYSQL_ROOT_PASSWORD=""
ASTPPUSER_MYSQL_PASSWORD=""


#################################
####  general functions #########
#################################

# task of function: ask to user yes or no
# usage: ask_to_user_yes_or_no "your question"
# return TEMP_USER_ANSWER variable filled with "yes" or "no"
ask_to_user_yes_or_no () 
{
		# default answer = no
		TEMP_USER_ANSWER="no"
		clear
		echo ""
		echo -e ${1}
		read -n 1 -p "(y/n)? :"
		if [ "${REPLY}" = "y" ]; then
			TEMP_USER_ANSWER="yes"
		else
			TEMP_USER_ANSWER="no"
		fi
}

# Determine the OS architecture
get_os_architecture () 
{
		if [ ${HOSTTYPE} == "x86_64" ]; then
			ARCH=x64
		else
			ARCH=x32
		fi
}
get_os_architecture

# Linux Distribution CentOS or Debian
get_linux_distribution ()
{ 
	V1=`cat /etc/*release | head -n1 | tail -n1 | cut -c 14- | cut -c1-18`
	V2=`cat /etc/*release | head -n7 | tail -n1 | cut -c 14- | cut -c1-14`
	PHPV=`php -v |sed -n 1p|awk '{ print $1 $2 }'|cut -c 1-4`
	if [ "$V1" = "Debian GNU/Linux 8" ]; then
		DIST="DEBIAN"
		else if [ "$V2" = "CentOS Linux 7" ]; then
			DIST="CENTOS"
		else
			DIST="OTHER"
			echo 'Opps!! Quick Installation does not support your distribution'
			exit 1
		fi
	fi
}
get_linux_distribution
install_php7 ()
{
	if [ "$DIST" = "DEBIAN" ]; then
		echo "
deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all" > /etc/apt/sources.list.d/php7.list
		curl https://www.dotdeb.org/dotdeb.gpg | apt-key add -
		apt-get update
		else if [ "$DIST" = "CENTOS" ]; then
			yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
			yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
			yum install yum-utils
			yum-config-manager --enable remi-php70
		fi
	fi 
}

install_epel () 
{
		yum install epel-release
}

remove_epel () 
{
		# only on CentOS
{'fraction_non_alphanumeric': 0.20523229589535408, 'fraction_numerical': 0.014584273041647873, 'mean_word_length': 4.430204081632653, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 4, 'lorem ipsum': 0, 'www.': 7, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6902640', 'n_tokens_mistral': 2527, 'n_tokens_neox': 2308, 'n_words': 616}