<commit_before>#!/bin/bash

mkdir ~/feathur-install/
touch ~/feathur-install/install.log
exec 3>&1 > ~/feathur-install/install.log 2>&1

function status {
	echo $1;
	echo $1 >&3
}

function check_installs {
	if ! type -p $1 > /dev/null; then
		status "Unfortunately $1 failed to install. Feathur install aborting."
		exit 1
	fi
}

function check_sanity {
	# Do some sanity checking.
	if [ $(/usr/bin/id -u) != "0" ]
	then
		status "Feathur must be installed as root. Please log in as root and try again."
		die 'Feathur must be installed as root. Please log in as root and try again.'
	fi

	if [ ! -f /etc/centos-release ]
	then
		status "Feathur must be installed on CentOS 6."
		die "Feathur must be installed on CentOS 6."
	fi

	if [ ! 6 == $(awk '{print $3}' /etc/centos-release | awk -F. '{print $1}') ]
	then
		status "Feathur must be installed on CentOS 6."
		die "Feathur must be installed on CentOS 6."
	fi
}

function die {
	echo "ERROR: $1" > /dev/null 1>&2
	exit 1
}

check_sanity


status "====================================="
status "     Welcome to Feathur Installation"
status "====================================="
status " "
status "Feathur master server installation."
status " "
status "Feathur will remove any existing apache,"
status "nginx, mysql or php services you have"
status "installed upon this server. It will"
status "also delete all custom config files"
status "that you may have."
status " "
status "It is recommended that you run this"
status "installer in a screen."
status " "
status "This script will begin installing"
status "Feathur in 10 seconds. If you wish to"
status "cancel the install press CTRL + C"
sleep 10
status "Feathur needs a bit of information before"
status "beginning the installation."
status " "
status "What hostname would you like to use (Example: manage.yourdomain.com):"
read user_host
status " "
status "What email would you like to use for your administrative account?"
read user_email

status " "
status "Removing excess programs..."
service httpd stop
yum -y remove httpd mysql* php* nginx lighttpd php-fpm vsftpd proftpd exim qmail postfix sendmail git pdns*

status "Installing essential programs..."
echo '[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1' > /etc/yum.repos.d/nginx.repo
status "Install: 1 of 2"

yum -y install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y update
yum -y install php php-fpm nginx mysql-server vim openssl php-mysql zip unzip pdns pdns-backend-mysql sendmail php-mcrypt rsync wget gcc make gcc-c++ zlib-devel perl-ExtUtils-Embed gettext curl-devel php-mbstring git vixie-cron crontabs

status "Install: 2 of 2"

service mysqld stop
service php-fpm stop

status " "
status "Installing and configuring Feathur..."
cd ~
git clone -b develop https://github.com/BlueVM/Feathur.git /var/feathur
mkdir -p /var/feathur/data/{templates/{openvz,kvm},keys}
touch /var/feathur/data/log.txt
mkdir /home/root/
status "Configuring: 1 of 4"

cd ~/feathur-install/
ssh-keygen -t rsa -N "" -f ~/feathur-install/id_rsa
mkdir ~/.ssh/
cat id_rsa.pub >> ~/.ssh/authorized_keys
cp id_rsa /var/feathur/data/
cd /var/feathur/
chown -R nginx *<commit_msg>Updates to installer.<commit_after>#!/bin/bash

mkdir ~/feathur-install/
touch ~/feathur-install/install.log
exec 3>&1 > ~/feathur-install/install.log 2>&1

function status {
	echo $1;
	echo $1 >&3
}

function check_installs {
	if ! type -p $1 > /dev/null; then
		status "Unfortunately $1 failed to install. Feathur install aborting."
		exit 1
	fi
}

function check_sanity {
	# Do some sanity checking.
	if [ $(/usr/bin/id -u) != "0" ]
	then
		status "Feathur must be installed as root. Please log in as root and try again."
		die 'Feathur must be installed as root. Please log in as root and try again.'
	fi

	if [ ! -f /etc/centos-release ]
	then
		status "Feathur must be installed on CentOS 6."
		die "Feathur must be installed on CentOS 6."
	fi

	if [ ! 6 == $(awk '{print $3}' /etc/centos-release | awk -F. '{print $1}') ]
	then
		status "Feathur must be installed on CentOS 6."
		die "Feathur must be installed on CentOS 6."
	fi
}

function die {
	echo "ERROR: $1" > /dev/null 1>&2
	exit 1
}

check_sanity


status "====================================="
status "     Welcome to Feathur Installation"
status "====================================="
status " "
status "Feathur master server installation."
status " "
status "Feathur will remove any existing apache,"
status "nginx, mysql or php services you have"
status "installed upon this server. It will"
status "also delete all custom config files"
status "that you may have."
status " "
status "It is recommended that you run this"
status "installer in a screen."
status " "
status "This script will begin installing"
status "Feathur in 10 seconds. If you wish to"
status "cancel the install press CTRL + C"
sleep 10
status "Feathur needs a bit of information before"
status "beginning the installation."
status " "
status "What hostname would you like to use (Example: manage.yourdomain.com):"
read user_host
status " "
status "What email would you like to use for your administrative account?"
read user_email

status " "
status "Removing excess programs..."
service httpd stop
yum -y remove httpd mysql* php* nginx lighttpd php-fpm vsftpd proftpd exim qmail postfix sendmail git pdns*

status "Installing essential programs..."
echo '[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1' > /etc/yum.repos.d/nginx.repo
status "Install: 1 of 2"

yum -y install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y update
yum -y install php php-fpm nginx mysql-server vim openssl php-mysql zip unzip pdns pdns-backend-mysql sendmail php-mcrypt rsync wget gcc make gcc-c++ zlib-devel perl-ExtUtils-Embed gettext curl-devel php-mbstring git screen vixie-cron crontabs

status "Install: 2 of 2"

service mysqld stop
service php-fpm stop

status " "
status "Installing and configuring Feathur..."
cd ~
git clone -b develop https://github.com/BlueVM/Feathur.git /var/feathur
mkdir -p /var/feathur/data/{templates/{openvz,kvm},keys}
touch /var/feathur/data/log.txt
mkdir /home/root/
status "Configuring: 1 of 4"

cd ~/feathur-install/
ssh-keygen -t rsa -N "" -f ~/feathur-install/id_rsa
mkdir ~/.ssh/
cat id_rsa.pub >> ~/.ssh/authorized_keys
cp id_rsa /var/feathur/data/
cd /var/feathur/
chown -R nginx *
{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.012997060188766826, 'mean_word_length': 3.923076923076923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6065108', 'n_tokens_mistral': 2324, 'n_tokens_neox': 2182, 'n_words': 801}