#!/bin/bash
#
# Author: Imri Paloja
# Version: 0.2
# Website: http://www.eurobytes.nl/
#
notify-send --urgency=critical --icon=$PWD/corneillie-black-red.jpg "otrs install script (0.2)" "Please be patient..."
mkdir /tmp/otrs/
cd /tmp/otrs/
wget ftp://ftp.otrs.org/pub/otrs/otrs-3.2.3.tar.gz
tar xf otrs-3.2.3.tar.gz
echo moving to /opt/otrs
sudo mv otrs-3.2.3 /opt/otrs
# You will receive a message to input a password for the mysql database.
# choose a simple password for it like `mysql`
echo installing dependencies
notify-send --urgency=critical --icon=$PWD/corneillie-black-red.jpg "Installing otrs" "The dependencies are being installed"
sudo apt-get install -y libapache2-mod-perl2 libdbd-mysql-perl libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libpdf-api2-perl libsoap-lite-perl libgd-text-perl libgd-graph-perl libapache-dbi-perl mysql-server
# adding user and group
echo adding user en mod
sudo useradd -r -d /opt/otrs/ -c 'OTRS user' otrs
sudo usermod -g www-data otrs
cd /opt/otrs/Kernel
sudo cp Config.pm.dist Config.pm
sudo cp Config/GenericAgent.pm.dist Config/GenericAgent.pm
# setting the permision right
cd /opt/otrs
sudo bin/otrs.SetPermissions.pl --otrs-user=otrs --otrs-group=otrs --web-user=www-data --web-group=www-data /opt/otrs
sudo cp /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/conf.d/otrs.conf
# restarting apache
sudo service apache2 restart
# Opens your default browser.
xdg-open http://127.0.0.1/otrs/installer.pl
notify-send --urgency=critical --icon=$PWD/corneillie-black-red.jpg "otrs is installed" "You can now begin configuring otrs via firefox: http://127.0.0.1/otrs/installer.pl"