Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Fix #239 - Ubuntu script incompatibility #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions install_hackthis_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ function isPackageInstalled {
return $?
}

function addRepositoryForPHP5 {
echo -e '\t Adding ondrej/php PPA in order to install php5.'
sudo add-apt-repository ppa:ondrej/php
# If the command was not found, install software-properties-common
if [ $? != 0 ]; then
echo -e '\t Adding ondrej/php PPA unsuccessful, installing dependency and retrying.'
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
fi
sudo apt-get update
}

function installMissingPackages {

isPackageInstalled $1
Expand Down Expand Up @@ -93,6 +105,13 @@ git_root_dir=`pwd`

# Package installation
required_packages="apache2 php5 libapache2-mod-php5 mysql-server php5-mysql php5-ldap"

# Check if the Ubuntu release is >= 16.04 and change php5 to php5.6
if [ $(lsb_release -r | tr -dc '0-9') -ge 1604 ]; then
addRepositoryForPHP5
required_packages="apache2 php5.6 libapache2-mod-php5.6 mysql-server php5.6-mysql php5.6-ldap"
fi

echo Checking installed packages
for package in $required_packages; do
installMissingPackages $package
Expand Down Expand Up @@ -195,3 +214,4 @@ a2enmod rewrite
service apache2 restart

echo Done!