adding bits to setupserver.sh script
[ga4php.git] / contrib / setupserver.sh
old mode 100644 (file)
new mode 100755 (executable)
index 96729fb..8d233bf
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 ####################
 # The purpose of this script is to setup a built ubuntu 10.04
@@ -37,3 +37,53 @@ case "$1" in
        exit 0
 esac
 
+# ok, we're ready to function, tell the user some stuff
+echo "This script will now install packages required for the server to work"
+echo "as well as install the auth server and start scripts into /opt/gaas and"
+echo "/etc/init.d/. I will try to do this as quitely as possible"
+
+read -p "are you sure [y/N]? " surity
+
+if [ "x$surity" != "xy" ]
+then
+       echo "Bailing, must hit y if you are sure"
+       exit 0
+fi
+
+# first install apt packages for apache and php
+echo "Beginning install of apt-get packages"
+apt-get install -y apache2 libapache2-mod-php5 php-soap php5-ldap php5-cli php5-adodb subversion qrencode > /dev/null 2>&1
+
+if [ "$?" != "0" ]
+then
+       echo "There was a problem during install of apt-get packages"
+       exit 1
+fi
+
+echo "Apt-get packages installed, getting auth server code"
+
+# get the auth server code from svn
+MYTMPDIR="/tmp/ga$RANDOM"
+mkdir -p $MYTMPDIR
+cd $MYTMPDIR
+svn checkout http://ga4php.googlecode.com/svn/trunk/ ga4php > /dev/null 2>&1
+if [ "$?" != "0" ]
+then
+       echo "There was a problem downloading the authserver source code.. bailing"
+       exit 2
+fi
+
+echo "Code downloaded, beginning installation into /opt/gaas"
+
+mkdir /opt/gaas
+cp -r * /opt/gaas
+
+echo "Createing service user"
+useradd -d /opt/gaas -r gaas -m
+
+chown -R gaas:gaas /opt/gaas
+echo "Tightening up permissions"
+chmod 700 /opt/gaas/authserver/authd
+chmod 770 /opt/gaas/authserver/
+
+echo "Users who wish to use the gaas system must now be added to the gaas group"