| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | confirm() { | 
					
						
							|  |  |  |   echo "Press RETURN to continue, or ^C to cancel."; | 
					
						
							|  |  |  |   read -e ignored | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07:00
										 |  |  | INSTALL_URI="   https://phurl.io/u/install" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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-14 17:06:12 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | ISSUE=`cat /etc/issue` | 
					
						
							| 
									
										
										
										
											2013-10-20 22:37:58 +02:00
										 |  |  | if [[ ($ISSUE != Ubuntu*) && ($ISSUE != Debian*) ]]; | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | 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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo "PHABRICATOR UBUNTU INSTALL SCRIPT"; | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07:00
										 |  |  | echo "This script will install Apache, Phabricator and its core dependencies."; | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07: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-20 21:42:18 -07:00
										 |  |  | echo 'Testing Ubuntu version...' | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07:00
										 |  |  | VERSION=`lsb_release -rs` | 
					
						
							|  |  |  | MAJOR=`expr match "$VERSION" '\([0-9]*\)'` | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07: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.' | 
					
						
							|  |  |  |   echo 'You can still install Phabricator manually - please consult the installation' | 
					
						
							|  |  |  |   echo 'guide to see how:' | 
					
						
							|  |  |  |   echo | 
					
						
							|  |  |  |   echo $INSTALL_URI | 
					
						
							|  |  |  |   echo | 
					
						
							|  |  |  |   exit 2 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2012-09-10 07:53:49 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07: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 14:14:05 -07:00
										 |  |  | then | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07:00
										 |  |  |   echo 'This version of Ubuntu requires additional resources in order to install' | 
					
						
							|  |  |  |   echo 'and run Phabricator.' | 
					
						
							|  |  |  |   echo 'We will now add a the following package repository to your system:' | 
					
						
							|  |  |  |   echo '  https://launchpad.net/~ondrej/+archive/ubuntu/php' | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  |   echo | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07:00
										 |  |  |   echo 'This repository is generally considered safe to use.' | 
					
						
							|  |  |  |   confirm | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   sudo add-apt-repository -y ppa:ondrej/php  || failed | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07:00
										 |  |  | ROOT=`pwd` | 
					
						
							|  |  |  | echo "Phabricator will be installed to: ${ROOT}."; | 
					
						
							|  |  |  | 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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo "Downloading Phabricator and dependencies..." | 
					
						
							|  |  |  | echo | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | if [ ! -e libphutil ] | 
					
						
							|  |  |  | then | 
					
						
							| 
									
										
										
										
											2014-06-03 09:40:16 -07:00
										 |  |  |   git clone https://github.com/phacility/libphutil.git | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | else | 
					
						
							|  |  |  |   (cd libphutil && git pull --rebase) | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -e arcanist ] | 
					
						
							|  |  |  | then | 
					
						
							| 
									
										
										
										
											2014-06-03 09:40:16 -07:00
										 |  |  |   git clone https://github.com/phacility/arcanist.git | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | else | 
					
						
							|  |  |  |   (cd arcanist && git pull --rebase) | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -e phabricator ] | 
					
						
							|  |  |  | then | 
					
						
							| 
									
										
										
										
											2014-06-03 09:40:16 -07:00
										 |  |  |   git clone https://github.com/phacility/phabricator.git | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | else | 
					
						
							|  |  |  |   (cd phabricator && git pull --rebase) | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo | 
					
						
							|  |  |  | echo | 
					
						
							|  |  |  | echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':"; | 
					
						
							|  |  |  | echo | 
					
						
							| 
									
										
										
										
											2015-07-07 13:35:57 -07:00
										 |  |  | echo "    https://secure.phabricator.com/book/phabricator/article/configuration_guide/"; | 
					
						
							| 
									
										
										
										
											2011-05-31 14:14:05 -07:00
										 |  |  | echo | 
					
						
							| 
									
										
										
										
											2018-04-20 21:42:18 -07:00
										 |  |  | echo 'Next step is "Configuring Apache webserver".' |