<commit_before>#!/bin/bash
# Installer for Ebot-CSGO and Ebot-WEB by Vince52

# This script will work on Debian and Ubuntu
# This is not bullet-proof. So I'm not responsible
# of anything if you use this script.
# If you see anything, please let me know here:
# http://forum.esport-tools.net/d/35-automatic-script-not-ready


# Detect Debian users running the script with "sh" instead of bash
if readlink /proc/$$/exe | grep -qs "dash"; then
	echo "This script needs to be run with bash, not sh"
	exit 1
fi

if [[ "$EUID" -ne 0 ]]; then
	echo "Sorry, you need to run this as root"
	exit 2
fi

if [[ ! -e /dev/net/tun ]]; then
	echo "TUN is not available"
	exit 3
fi

if [[ -e /etc/debian_version ]]; then
	OS=debian
	GROUPNAME=nogroup
	RCLOCAL='/etc/rc.local'
else
	echo "Looks like you aren't running this installer on Debian or Ubuntu"
	exit 5
fi

# Try to get our IP from the system and fallback to the Internet.
# CHECK NAT
IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
if [[ "$IP" = "" ]]; then
		echo '1'
		IP=$(wget -qO- ipv4.icanhazip.com)
fi

if [[ -e /home/ebot/ebot-csgo/config/config.ini ]]; then
	while :
	do
	
		echo "Looks like Ebot-CSGO is already on your server"
		echo ""
		echo "What do you want to do?"
		echo "   1) Start Ebot-CSGO Daemon"
		echo "   2) Stop Ebot-CSGO Daemon"
		echo "   3) Restart Ebot-CSGO daemon"
		echo "   4) Clear cache Ebot-web"	
		echo "   5) Secure mysql"
		echo "   6) Delete EBOT (coming soon)"
		echo "   7) Update Ebot (coming soon)"		
		echo "   8) Exit"
		read -p "Select an option [1-5]: " option
		case $option in
			1) 
			echo ""
			echo "Staring Ebot-CSGO... (need to be set)"
			service ebot start
			exit
			;;
			2)
			echo "Stoping Ebot-CSGO"
			service ebot stop
			exit
			;;
			3) 
			echo "Restarting Ebot-CSGO"
			service ebot restart
			exit
			;;
			4) 
			echo "Clearing Cache"
			service ebot clear-cache
			exit
			;;
			5) 
			echo "Securing mysql"
			mysql_secure_installation
			exit
			;;
			6) 
			echo "(coming soon)"
			exit
			;;
			7) 
			echo "(coming soon)"
			exit
			;;
			8) exit;;
		esac
	done
else
	clear
	echo 'Welcome to Ebot 3.2 installer by vince52'
	echo ""
	# Some questions for users
	echo "I need to ask you a few questions before starting the setup"
	echo "You can leave the default options and just press enter if you are ok with them"
	echo ""
	echo "First I need to know the IPv4 address of the network interface you want Ebot"
	echo "listening to."
	read -p "IP address: " -e -i $IP IP
	echo ""
	echo "Install ebot on sub domain or not?"
	echo "   1) On my own Sub-domain"
	echo "   2) On my public IP"
	read -p "your choice [1-2]: " -e -i 1 SUBORIP
	echo ""
	if [[ "$SUBORIP" -eq 1 ]]; then
		echo "Finally, tell me your sub-domain you where you want to install ebot"
		echo "Please, replace your it by your domain"
		read -p "Sub-domain name: " -e -i ebot.yourdomain.com SUBDOMAIN
	fi
	echo ""
	echo "Okay, I will ask you other questions later."
	read -n1 -r -p "Press any key to continue..."
	
	# 2) Install SERVER-REQUIREMENTS
	apt-get update
	apt-get install apache2 gcc make libxml2-dev autoconf ca-certificates unzip nodejs curl libcurl4-openssl-dev pkg-config libssl-dev screen -y
	
	# 3) INSTALL PHP
	
	# If PHP is already installed, removing it.
	apt-get autoremove php php-dev php-cli 
		
	# COMPILE AND INSTALL THE NEW PHP VERSION:
	mkdir /home/install
	cd /home/install
	wget http://be2.php.net/get/php-5.6.26.tar.bz2/from/this/mirror -O php-5.6.26.tar.bz2
	tar -xjvf php-5.6.26.tar.bz2
	cd php-5.6.26
	./configure --prefix /usr/local --with-mysql --enable-maintainer-zts --enable-sockets --with-openssl --with-pdo-mysql 
	make
	make install
	cd /home/install
	wget http://pecl.php.net/get/pthreads-2.0.10.tgz
	tar -xvzf pthreads-2.0.10.tgz
	cd pthreads-2.0.10
	/usr/local/bin/phpize<commit_msg>Updating php version to 5.6.27<commit_after>#!/bin/bash
# Installer for Ebot-CSGO and Ebot-WEB by Vince52

# This script will work on Debian and Ubuntu
# This is not bullet-proof. So I'm not responsible
# of anything if you use this script.
# If you see anything, please let me know here:
# http://forum.esport-tools.net/d/35-automatic-script-not-ready


# Detect Debian users running the script with "sh" instead of bash
if readlink /proc/$$/exe | grep -qs "dash"; then
	echo "This script needs to be run with bash, not sh"
	exit 1
fi

if [[ "$EUID" -ne 0 ]]; then
	echo "Sorry, you need to run this as root"
	exit 2
fi

if [[ ! -e /dev/net/tun ]]; then
	echo "TUN is not available"
	exit 3
fi

if [[ -e /etc/debian_version ]]; then
	OS=debian
	GROUPNAME=nogroup
	RCLOCAL='/etc/rc.local'
else
	echo "Looks like you aren't running this installer on Debian or Ubuntu"
	exit 5
fi

# Try to get our IP from the system and fallback to the Internet.
# CHECK NAT
IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
if [[ "$IP" = "" ]]; then
		echo '1'
		IP=$(wget -qO- ipv4.icanhazip.com)
fi

if [[ -e /home/ebot/ebot-csgo/config/config.ini ]]; then
	while :
	do
	
		echo "Looks like Ebot-CSGO is already on your server"
		echo ""
		echo "What do you want to do?"
		echo "   1) Start Ebot-CSGO Daemon"
		echo "   2) Stop Ebot-CSGO Daemon"
		echo "   3) Restart Ebot-CSGO daemon"
		echo "   4) Clear cache Ebot-web"	
		echo "   5) Secure mysql"
		echo "   6) Delete EBOT (coming soon)"
		echo "   7) Update Ebot (coming soon)"		
		echo "   8) Exit"
		read -p "Select an option [1-5]: " option
		case $option in
			1) 
			echo ""
			echo "Staring Ebot-CSGO... (need to be set)"
			service ebot start
			exit
			;;
			2)
			echo "Stoping Ebot-CSGO"
			service ebot stop
			exit
			;;
			3) 
			echo "Restarting Ebot-CSGO"
			service ebot restart
			exit
			;;
			4) 
			echo "Clearing Cache"
			service ebot clear-cache
			exit
			;;
			5) 
			echo "Securing mysql"
			mysql_secure_installation
			exit
			;;
			6) 
			echo "(coming soon)"
			exit
			;;
			7) 
			echo "(coming soon)"
			exit
			;;
			8) exit;;
		esac
	done
else
	clear
	echo 'Welcome to Ebot 3.2 installer by vince52'
	echo ""
	# Some questions for users
	echo "I need to ask you a few questions before starting the setup"
	echo "You can leave the default options and just press enter if you are ok with them"
	echo ""
	echo "First I need to know the IPv4 address of the network interface you want Ebot"
	echo "listening to."
	read -p "IP address: " -e -i $IP IP
	echo ""
	echo "Install ebot on sub domain or not?"
	echo "   1) On my own Sub-domain"
	echo "   2) On my public IP"
	read -p "your choice [1-2]: " -e -i 1 SUBORIP
	echo ""
	if [[ "$SUBORIP" -eq 1 ]]; then
		echo "Finally, tell me your sub-domain you where you want to install ebot"
		echo "Please, replace your it by your domain"
		read -p "Sub-domain name: " -e -i ebot.yourdomain.com SUBDOMAIN
	fi
	echo ""
	echo "Okay, I will ask you other questions later."
	read -n1 -r -p "Press any key to continue..."
	
	# 2) Install SERVER-REQUIREMENTS
	apt-get update
	apt-get install apache2 gcc make libxml2-dev autoconf ca-certificates unzip nodejs curl libcurl4-openssl-dev pkg-config libssl-dev screen -y
	
	# 3) INSTALL PHP
	
	# If PHP is already installed, removing it.
	apt-get autoremove php php-dev php-cli 
		
	# COMPILE AND INSTALL THE NEW PHP VERSION:
	mkdir /home/install
	cd /home/install
	wget http://be2.php.net/get/php-5.6.27.tar.bz2/from/this/mirror -O php-5.6.27.tar.bz2
	tar -xjvf php-5.6.27.tar.bz2
	cd php-5.6.27
	./configure --prefix /usr/local --with-mysql --enable-maintainer-zts --enable-sockets --with-openssl --with-pdo-mysql 
	make
	make install
	cd /home/install
	wget http://pecl.php.net/get/pthreads-2.0.10.tgz
	tar -xvzf pthreads-2.0.10.tgz
	cd pthreads-2.0.10
	/usr/local/bin/phpize
{'fraction_non_alphanumeric': 0.1258723512244639, 'fraction_numerical': 0.028676563887831494, 'mean_word_length': 2.765886287625418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '456011', 'n_tokens_mistral': 3331, 'n_tokens_neox': 2981, 'n_words': 1061}