2011-05-31 23:14:05 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
confirm() {
|
|
|
|
echo "Press RETURN to continue, or ^C to cancel.";
|
|
|
|
read -e ignored
|
|
|
|
}
|
|
|
|
|
2021-09-04 21:48:31 +02:00
|
|
|
INSTALL_URI=" https://we.phorge.it/book/phorge/article/installation_guide/"
|
|
|
|
CONFIG_URI=" https://we.phorge.it/book/phorge/article/configuration_guide/"
|
|
|
|
REPOSITORY_URI="https://we.phorge.it/source"
|
|
|
|
NAME_MAIN="phorge"
|
|
|
|
NAME_ARC="arcanist"
|
|
|
|
|
|
|
|
NAME_UPPER="$(echo $NAME_MAIN | tr a-z A-Z)"
|
2018-04-21 06:42:18 +02:00
|
|
|
|
|
|
|
failed() {
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "Installation has failed."
|
|
|
|
echo "Text above this message might be useful to understanding what exactly failed."
|
|
|
|
echo
|
|
|
|
echo "Please follow this guide to manually complete installation:"
|
|
|
|
echo
|
|
|
|
echo $INSTALL_URI
|
|
|
|
echo
|
|
|
|
echo "We apologize for the inconvenience."
|
|
|
|
exit 3
|
|
|
|
}
|
2011-10-15 02:06:12 +02:00
|
|
|
|
2011-05-31 23:14:05 +02:00
|
|
|
ISSUE=`cat /etc/issue`
|
|
|
|
if [[ $ISSUE != Ubuntu* ]]
|
|
|
|
then
|
|
|
|
echo "This script is intended for use on Ubuntu, but this system appears";
|
|
|
|
echo "to be something else. Your results may vary.";
|
|
|
|
echo
|
|
|
|
confirm
|
|
|
|
fi
|
|
|
|
|
2021-09-04 21:48:31 +02:00
|
|
|
echo "$NAME_UPPER UBUNTU INSTALL SCRIPT";
|
|
|
|
echo "This script will install Apache, $NAME_MAIN and its core dependencies.";
|
2011-05-31 23:14:05 +02:00
|
|
|
echo "Run it from the directory you want to install into.";
|
|
|
|
echo
|
|
|
|
|
|
|
|
echo "Testing sudo..."
|
|
|
|
sudo true
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "ERROR: You must be able to sudo to run this script.";
|
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2018-04-21 06:42:18 +02:00
|
|
|
echo 'Testing Ubuntu version...'
|
2011-05-31 23:14:05 +02:00
|
|
|
|
2018-04-21 06:42:18 +02:00
|
|
|
VERSION=`lsb_release -rs`
|
|
|
|
MAJOR=`expr match "$VERSION" '\([0-9]*\)'`
|
2011-05-31 23:14:05 +02:00
|
|
|
|
2018-04-21 06:42:18 +02:00
|
|
|
if [ "$MAJOR" -lt 16 ]
|
|
|
|
then
|
|
|
|
echo 'This script is intented to install on modern operating systems; Your '
|
|
|
|
echo 'operating system is too old for this script.'
|
2021-09-04 21:48:31 +02:00
|
|
|
echo 'You can still install $NAME_MAIN manually - please consult the'
|
|
|
|
echo 'installation guide to see how:'
|
2018-04-21 06:42:18 +02:00
|
|
|
echo
|
|
|
|
echo $INSTALL_URI
|
|
|
|
echo
|
|
|
|
exit 2
|
|
|
|
fi
|
2012-09-10 16:53:49 +02:00
|
|
|
|
2018-04-21 06:42:18 +02:00
|
|
|
# Ubuntu 16.04 LTS only has php 7.0 in their repos, so they need this extra ppa.
|
|
|
|
# Ubuntu 17.4 and up have official 7.2 builds.
|
|
|
|
if [ "$MAJOR" -eq 16 ]
|
2011-05-31 23:14:05 +02:00
|
|
|
then
|
2018-04-21 06:42:18 +02:00
|
|
|
echo 'This version of Ubuntu requires additional resources in order to install'
|
2021-09-04 21:48:31 +02:00
|
|
|
echo 'and run $NAME_MAIN.'
|
2018-04-21 06:42:18 +02:00
|
|
|
echo 'We will now add a the following package repository to your system:'
|
|
|
|
echo ' https://launchpad.net/~ondrej/+archive/ubuntu/php'
|
2011-05-31 23:14:05 +02:00
|
|
|
echo
|
2018-04-21 06:42:18 +02:00
|
|
|
echo 'This repository is generally considered safe to use.'
|
|
|
|
confirm
|
|
|
|
|
|
|
|
sudo add-apt-repository -y ppa:ondrej/php || failed
|
2011-05-31 23:14:05 +02:00
|
|
|
fi
|
|
|
|
|
2018-04-21 06:42:18 +02:00
|
|
|
ROOT=`pwd`
|
2021-09-04 21:48:31 +02:00
|
|
|
echo "$NAME_MAIN will be installed to: ${ROOT}.";
|
2018-04-21 06:42:18 +02:00
|
|
|
confirm
|
|
|
|
|
|
|
|
echo "Installing dependencies: git, apache, mysql, php...";
|
|
|
|
echo
|
|
|
|
sudo apt-get -qq update
|
|
|
|
sudo apt-get install \
|
|
|
|
git mysql-server apache2 libapache2-mod-php \
|
|
|
|
php php-mysql php-gd php-curl php-apcu php-cli php-json php-mbstring \
|
|
|
|
|| failed
|
|
|
|
|
|
|
|
echo "Enabling mod_rewrite in Apache..."
|
|
|
|
echo
|
|
|
|
sudo a2enmod rewrite || failed
|
|
|
|
|
2021-09-04 21:48:31 +02:00
|
|
|
echo "Downloading $NAME_MAIN and dependencies..."
|
2018-04-21 06:42:18 +02:00
|
|
|
echo
|
2011-05-31 23:14:05 +02:00
|
|
|
|
2021-09-04 21:48:31 +02:00
|
|
|
if [ ! -e "$NAME_ARC" ]
|
2011-05-31 23:14:05 +02:00
|
|
|
then
|
2021-09-04 21:48:31 +02:00
|
|
|
git clone "$REPOSITORY_URI/$NAME_ARC.git"
|
2011-05-31 23:14:05 +02:00
|
|
|
else
|
2021-09-04 21:48:31 +02:00
|
|
|
(cd "$NAME_ARC" && git pull --rebase)
|
2011-05-31 23:14:05 +02:00
|
|
|
fi
|
|
|
|
|
2021-09-04 21:48:31 +02:00
|
|
|
if [ ! -e "$NAME_MAIN" ]
|
2011-05-31 23:14:05 +02:00
|
|
|
then
|
2021-09-04 21:48:31 +02:00
|
|
|
git clone "$REPOSITORY_URI/$NAME_MAIN.git"
|
2011-05-31 23:14:05 +02:00
|
|
|
else
|
2021-09-04 21:48:31 +02:00
|
|
|
(cd "$NAME_MAIN" && git pull --rebase)
|
2011-05-31 23:14:05 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':";
|
|
|
|
echo
|
2021-09-04 21:48:31 +02:00
|
|
|
echo $CONFIG_URI
|
2011-05-31 23:14:05 +02:00
|
|
|
echo
|
2018-04-21 06:42:18 +02:00
|
|
|
echo 'Next step is "Configuring Apache webserver".'
|