]> git.evergreen-ils.org Git - contrib/pines/report-creator.git/blob - install-ubuntu.sh
Exclude transits for items miscataloged at the system level.
[contrib/pines/report-creator.git] / install-ubuntu.sh
1 #!/bin/bash
2 #
3 # Copyright (C) 2016 Georgia Public Library Service
4 # Chris Sharp <csharp@georgialibraries.org>
5 #    
6 #    This program is free software: you can redistribute it and/or modify
7 #    it under the terms of the GNU General Public License as published by
8 #    the Free Software Foundation, either version 3 of the License, or
9 #    (at your option) any later version.
10 #
11 #    This program is distributed in the hope that it will be useful,
12 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #    GNU General Public License for more details.
15 #
16 #    You should have received a copy of the GNU General Public License
17 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19 # A script to automate installation of the report-creator feature.
20
21 if [ "$(whoami)" != "root" ]; then
22     echo "Must be root to run this script." && exit 1
23 fi
24
25 DISTRO="$(lsb_release -i | awk '{print $3}')"
26 RELEASE="$(lsb_release -r | awk '{print $2}')"
27 OSRF_WEB_ROOT="/openils/var/web"
28 if [ "$DISTRO" == "Ubuntu" ]; then
29         if [ "$RELEASE" == "16.04" ]; then
30                 APT_TOOL="apt"
31                 PREREQS="php7.0 php7.0-gd php7.0-pgsql php-memcache php-pear"
32                 APACHE_RESTART="systemctl restart apache2.service"
33         else
34                 APT_TOOL="apt-get"
35                 PREREQS="php5 php5-gd php5-pgsql php5-memcache php-pear"
36                 APACHE_RESTART="service apache2 restart"
37         fi
38 else
39         echo "You do not appear to be running Ubuntu.  Please install manually."
40         exit 1
41 fi
42
43 # install prerequisites
44 $APT_TOOL install -y $PREREQS
45
46 # restart apache to activate PHP
47 $APACHE_RESTART
48
49 # create the report-creator directory
50 mkdir $OSRF_WEB_ROOT/report-creator
51 chown -R opensrf:opensrf $OSRF_WEB_ROOT/report-creator
52
53 echo "DirectoryIndex index.php" > $OSRF_WEB_ROOT/report-creator/.htaccess
54
55 echo "This script will not create the required tables in the database."
56 echo "Please run sql/quick_reports_setup.sql ONLY if you haven't already."
57
58 echo "Copying report-creator files into $OSRF_WEB_ROOT/report-creator."
59 rsync -auv --exclude="install*.sh" --exclude=".git" ./ $OSRF_WEB_ROOT/report-creator/
60 chown -R opensrf:opensrf $OSRF_WEB_ROOT/report-creator
61
62 echo "Now browse to https://www.yourdomain.tld/report-creator to complete setup."
63 echo "Refer to docs/Installation_Instructions.txt for details."