3 # Copyright (C) 2016 Georgia Public Library Service
4 # Chris Sharp <csharp@georgialibraries.org>
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.
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.
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/>.
19 # A script to automate installation of the report-creator feature.
21 if [ "$(whoami)" != "root" ]; then
22 echo "Must be root to run this script." && exit 1
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
31 PREREQS="php7.0 php7.0-gd php7.0-pgsql php-memcache php-pear"
32 APACHE_RESTART="systemctl restart apache2.service"
35 PREREQS="php5 php5-gd php5-pgsql php5-memcache php-pear"
36 APACHE_RESTART="service apache2 restart"
39 echo "You do not appear to be running Ubuntu. Please install manually."
43 # install prerequisites
44 $APT_TOOL install -y $PREREQS
46 # restart apache to activate PHP
49 # create the report-creator directory
50 mkdir $OSRF_WEB_ROOT/report-creator
51 chown -R opensrf:opensrf $OSRF_WEB_ROOT/report-creator
53 echo "DirectoryIndex index.php" > $OSRF_WEB_ROOT/report-creator/.htaccess
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."
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
62 echo "Now browse to https://www.yourdomain.tld/report-creator to complete setup."
63 echo "Refer to docs/Installation_Instructions.txt for details."