Changeset View
Changeset View
Standalone View
Standalone View
scripts/install/install_ubuntu.sh
#!/bin/bash | #!/bin/bash | ||||
confirm() { | confirm() { | ||||
echo "Press RETURN to continue, or ^C to cancel."; | echo "Press RETURN to continue, or ^C to cancel."; | ||||
read -e ignored | read -e ignored | ||||
} | } | ||||
INSTALL_URI=" https://phurl.io/u/install" | 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)" | |||||
failed() { | failed() { | ||||
echo | echo | ||||
echo | echo | ||||
echo "Installation has failed." | echo "Installation has failed." | ||||
echo "Text above this message might be useful to understanding what exactly failed." | echo "Text above this message might be useful to understanding what exactly failed." | ||||
echo | echo | ||||
echo "Please follow this guide to manually complete installation:" | echo "Please follow this guide to manually complete installation:" | ||||
echo | echo | ||||
echo $INSTALL_URI | echo $INSTALL_URI | ||||
echo | echo | ||||
echo "We apologize for the inconvenience." | echo "We apologize for the inconvenience." | ||||
exit 3 | exit 3 | ||||
} | } | ||||
ISSUE=`cat /etc/issue` | ISSUE=`cat /etc/issue` | ||||
if [[ $ISSUE != Ubuntu* ]] | if [[ $ISSUE != Ubuntu* ]] | ||||
then | then | ||||
echo "This script is intended for use on Ubuntu, but this system appears"; | echo "This script is intended for use on Ubuntu, but this system appears"; | ||||
echo "to be something else. Your results may vary."; | echo "to be something else. Your results may vary."; | ||||
echo | echo | ||||
confirm | confirm | ||||
fi | fi | ||||
echo "PHABRICATOR UBUNTU INSTALL SCRIPT"; | echo "$NAME_UPPER UBUNTU INSTALL SCRIPT"; | ||||
echo "This script will install Apache, Phabricator and its core dependencies."; | echo "This script will install Apache, $NAME_MAIN and its core dependencies."; | ||||
echo "Run it from the directory you want to install into."; | echo "Run it from the directory you want to install into."; | ||||
echo | echo | ||||
echo "Testing sudo..." | echo "Testing sudo..." | ||||
sudo true | sudo true | ||||
if [ $? -ne 0 ] | if [ $? -ne 0 ] | ||||
then | then | ||||
echo "ERROR: You must be able to sudo to run this script."; | echo "ERROR: You must be able to sudo to run this script."; | ||||
exit 1; | exit 1; | ||||
fi; | fi; | ||||
echo 'Testing Ubuntu version...' | echo 'Testing Ubuntu version...' | ||||
VERSION=`lsb_release -rs` | VERSION=`lsb_release -rs` | ||||
MAJOR=`expr match "$VERSION" '\([0-9]*\)'` | MAJOR=`expr match "$VERSION" '\([0-9]*\)'` | ||||
if [ "$MAJOR" -lt 16 ] | if [ "$MAJOR" -lt 16 ] | ||||
then | then | ||||
echo 'This script is intented to install on modern operating systems; Your ' | echo 'This script is intented to install on modern operating systems; Your ' | ||||
echo 'operating system is too old for this script.' | echo 'operating system is too old for this script.' | ||||
echo 'You can still install Phabricator manually - please consult the installation' | echo 'You can still install $NAME_MAIN manually - please consult the installation' | ||||
Lint: Line Too Long: This line is 84 characters long, but the convention is 80 characters. | |||||
echo 'guide to see how:' | echo 'guide to see how:' | ||||
echo | echo | ||||
echo $INSTALL_URI | echo $INSTALL_URI | ||||
echo | echo | ||||
exit 2 | exit 2 | ||||
fi | fi | ||||
# Ubuntu 16.04 LTS only has php 7.0 in their repos, so they need this extra ppa. | # 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. | # Ubuntu 17.4 and up have official 7.2 builds. | ||||
if [ "$MAJOR" -eq 16 ] | if [ "$MAJOR" -eq 16 ] | ||||
then | then | ||||
echo 'This version of Ubuntu requires additional resources in order to install' | echo 'This version of Ubuntu requires additional resources in order to install' | ||||
echo 'and run Phabricator.' | echo 'and run $NAME_MAIN.' | ||||
echo 'We will now add a the following package repository to your system:' | echo 'We will now add a the following package repository to your system:' | ||||
echo ' https://launchpad.net/~ondrej/+archive/ubuntu/php' | echo ' https://launchpad.net/~ondrej/+archive/ubuntu/php' | ||||
echo | echo | ||||
echo 'This repository is generally considered safe to use.' | echo 'This repository is generally considered safe to use.' | ||||
confirm | confirm | ||||
sudo add-apt-repository -y ppa:ondrej/php || failed | sudo add-apt-repository -y ppa:ondrej/php || failed | ||||
fi | fi | ||||
ROOT=`pwd` | ROOT=`pwd` | ||||
echo "Phabricator will be installed to: ${ROOT}."; | echo "$NAME_MAIN will be installed to: ${ROOT}."; | ||||
confirm | confirm | ||||
echo "Installing dependencies: git, apache, mysql, php..."; | echo "Installing dependencies: git, apache, mysql, php..."; | ||||
echo | echo | ||||
sudo apt-get -qq update | sudo apt-get -qq update | ||||
sudo apt-get install \ | sudo apt-get install \ | ||||
git mysql-server apache2 libapache2-mod-php \ | git mysql-server apache2 libapache2-mod-php \ | ||||
php php-mysql php-gd php-curl php-apcu php-cli php-json php-mbstring \ | php php-mysql php-gd php-curl php-apcu php-cli php-json php-mbstring \ | ||||
|| failed | || failed | ||||
echo "Enabling mod_rewrite in Apache..." | echo "Enabling mod_rewrite in Apache..." | ||||
echo | echo | ||||
sudo a2enmod rewrite || failed | sudo a2enmod rewrite || failed | ||||
echo "Downloading Phabricator and dependencies..." | echo "Downloading $NAME_MAIN and dependencies..." | ||||
echo | echo | ||||
if [ ! -e arcanist ] | if [ ! -e "$NAME_ARC" ] | ||||
then | then | ||||
git clone https://github.com/phacility/arcanist.git | git clone "$REPOSITORY_URI/$NAME_ARC.git" | ||||
else | else | ||||
(cd arcanist && git pull --rebase) | (cd "$NAME_ARC" && git pull --rebase) | ||||
fi | fi | ||||
if [ ! -e phabricator ] | if [ ! -e "$NAME_MAIN" ] | ||||
Not Done Inline ActionsCould we pull the name/repo/url into variables at the top of the script? speck: Could we pull the name/repo/url into variables at the top of the script? | |||||
then | then | ||||
git clone https://github.com/phacility/phabricator.git | git clone "$REPOSITORY_URI/$NAME_MAIN.git" | ||||
else | else | ||||
(cd phabricator && git pull --rebase) | (cd "$NAME_MAIN" && git pull --rebase) | ||||
fi | fi | ||||
echo | echo | ||||
echo | echo | ||||
echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':"; | echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':"; | ||||
echo | echo | ||||
echo " https://secure.phabricator.com/book/phabricator/article/configuration_guide/"; | echo $CONFIG_URI | ||||
echo | echo | ||||
echo 'Next step is "Configuring Apache webserver".' | echo 'Next step is "Configuring Apache webserver".' |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
This line is 84 characters long, but the convention is 80 characters.