<commit_before>#!/usr/bin/env bash

###########################################################
# Turbine Appliance Installer Script for Ubuntu 12.04 LTS #
# http://bobsta63.github.io/turbine/                      #
# Created by: <NAME> (<EMAIL>)          #
###########################################################

TURBINE_VERSION='0.1.1 dev'
NGINX_USER='www-data'
HOSTNAME=$(cat /etc/hostname)

echo "Turbine Installer (v.$TURBINE_VERSION)"
echo -e "====================================\n"
echo -e "Welcome to the Turbine installer, this installer will automatically "
echo -e "install and configure the required packages and dependencies required"
echo -e " to run the Turbine software. It is recommended that you only install"
echo -e "this on a clean server with no other web servers installed and running!\n"
echo -e "Please tell this installer where it can find the extracted download"
echo -e "directory for example eg. /home/jdoe/downloads/turbine_1.0.0.\n"
echo -e "If you wish to cancel this installer, please press CTRL+C now!\n"
echo -n "Install from: "
read EXTRACTED_FILES
echo -e "\n"

# LLets see if the directory does not exist..
if [ ! -d "$EXTRACTED_FILES" ]; then
    echo -e 'That specified directory does not exist, please try again by re-running this'
    echo -e 'install script!\n'
    exit
fi

# Just as another check we'll see if the composer.json file exists in the root of this directory otherwise
# they've probably given us the wrong directory!
if [ ! -f "$EXTRACTED_FILES/composer.json" ]; then
    echo 'It would appear that the folder you have specified is incorrect, it should'
    echo 'be the path to the root of the extracted tar.gz file (no trailing slash),'
    echo 'eg. the folder that contains the composer.json file, please try again'
    echo -e 'by re-running this install script!\n'
    exit
fi

# We now install the main packages required by the Turbine software.
echo "Installing required packages..."
apt-get update
apt-get -y install nginx php5-fpm php5-curl php5-json php5-sqlite php5-mcrypt

echo "Configuring Nginx..."
# We now need to make some changes to the default nginx.conf file...
sed -i "s/include \/etc\/nginx\/sites-enabled\/\*/include \/etc\/turbine\/configs\/common\/turbine_nginx\.conf/g" /etc/nginx/nginx.conf

echo "Configuring PHP-FPM for Nginx..."<commit_msg>Removal of server_tokens by default in the installer.<commit_after>#!/usr/bin/env bash

###########################################################
# Turbine Appliance Installer Script for Ubuntu 12.04 LTS #
# http://bobsta63.github.io/turbine/                      #
# Created by: <NAME> (<EMAIL>)          #
###########################################################

TURBINE_VERSION='0.1.1 dev'
NGINX_USER='www-data'
HOSTNAME=$(cat /etc/hostname)

echo "Turbine Installer (v.$TURBINE_VERSION)"
echo -e "====================================\n"
echo -e "Welcome to the Turbine installer, this installer will automatically "
echo -e "install and configure the required packages and dependencies required"
echo -e " to run the Turbine software. It is recommended that you only install"
echo -e "this on a clean server with no other web servers installed and running!\n"
echo -e "Please tell this installer where it can find the extracted download"
echo -e "directory for example eg. /home/jdoe/downloads/turbine_1.0.0.\n"
echo -e "If you wish to cancel this installer, please press CTRL+C now!\n"
echo -n "Install from: "
read EXTRACTED_FILES
echo -e "\n"

# LLets see if the directory does not exist..
if [ ! -d "$EXTRACTED_FILES" ]; then
    echo -e 'That specified directory does not exist, please try again by re-running this'
    echo -e 'install script!\n'
    exit
fi

# Just as another check we'll see if the composer.json file exists in the root of this directory otherwise
# they've probably given us the wrong directory!
if [ ! -f "$EXTRACTED_FILES/composer.json" ]; then
    echo 'It would appear that the folder you have specified is incorrect, it should'
    echo 'be the path to the root of the extracted tar.gz file (no trailing slash),'
    echo 'eg. the folder that contains the composer.json file, please try again'
    echo -e 'by re-running this install script!\n'
    exit
fi

# We now install the main packages required by the Turbine software.
echo "Installing required packages..."
apt-get update
apt-get -y install nginx php5-fpm php5-curl php5-json php5-sqlite php5-mcrypt

echo "Configuring Nginx..."
# We now need to make some changes to the default nginx.conf file...
sed -i "s/include \/etc\/nginx\/sites-enabled\/\*/include \/etc\/turbine\/configs\/common\/turbine_nginx\.conf/g" /etc/nginx/nginx.conf
sed -i "s/\; server_tokens off/server_tokens off/g" /etc/nginx/nginx.conf

echo "Configuring PHP-FPM for Nginx..."
{'fraction_non_alphanumeric': 0.15955667084901715, 'fraction_numerical': 0.007109995817649519, 'mean_word_length': 3.8167170191339377, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2712827', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1402, 'n_words': 579}