4 # The purpose of this script is to setup a built ubuntu 10.04
5 # server as an auth server with next-to zero input from the user.
6 # This script will automagically download components
7 # from the ga4php site and install them locally on the machine
8 # it will also install all packages required for the system to work
11 echo "Usage: $0 dedicated|shared"
12 echo "Dedicated means the website will be hosted as /"
13 echo "Shared means the website will be hosted as /ga"
22 if [ "$USER" != "root" ]
24 echo "This script must be run as root in order to function"
30 echo "Installing as dedicated"
33 echo "Installing as shared"
40 # ok, we're ready to function, tell the user some stuff
41 echo "This script will now install packages required for the server to work"
42 echo "as well as install the auth server and start scripts into /opt/gaas and"
43 echo "/etc/init.d/. I will try to do this as quitely as possible"
45 read -p "are you sure [y/N]? " surity
47 if [ "x$surity" != "xy" ]
49 echo "Bailing, must hit y if you are sure"
53 # first install apt packages for apache and php
54 echo "Beginning install of apt-get packages"
55 apt-get install -y apache2 libapache2-mod-php5 php-soap php5-ldap php5-cli php5-adodb subversion qrencode > /dev/null 2>&1
59 echo "There was a problem during install of apt-get packages"
63 echo "Apt-get packages installed, getting auth server code"
65 # get the auth server code from svn
66 MYTMPDIR="/tmp/ga$RANDOM"
69 svn checkout http://ga4php.googlecode.com/svn/trunk/ ga4php > /dev/null 2>&1
72 echo "There was a problem downloading the authserver source code.. bailing"
76 echo "Code downloaded, beginning installation into /opt/gaas"
81 echo "Createing service user"
82 useradd -d /opt/gaas -r gaas -m
84 chown -R gaas:gaas /opt/gaas
85 echo "Tightening up permissions"
86 chmod 700 /opt/gaas/authserver/authd
87 chmod 770 /opt/gaas/authserver/
89 echo "Users who wish to use the gaas system must now be added to the gaas group"