forked from cambridgesu/bob-gui-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2-install-bob.sh
50 lines (39 loc) · 1.96 KB
/
2-install-bob.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Tested on SLES 12.0 with SDK installed
# This script is idempotent - it can be safely re-run without destroying existing data
# Installation of the voting component (BOB)
# Add the BOB software (the native voting component, without any setup management)
if [ ! -d ${documentRoot}/bob ] ; then
cd "${documentRoot}"
git clone [email protected]:cusu/bob.git
fi
# MTA (mail sending)
# Useful guides for Postfix at: http://www-uxsup.csx.cam.ac.uk/~fanf2/hermes/doc/misc/postfix.html and http://www-co.ch.cam.ac.uk/facilities/clusters/theory/heartofgold/heartofgold-postfix.html
zypper -n install -l postfix
if [ "${mtaRelayhost}" ] ; then
if ! grep -qF "${mtaRelayhost}" /etc/postfix/main.cf ; then
echo $'\nrelayhost = '"${mtaRelayhost}" >> /etc/postfix/main.cf
fi
fi
# The canonical config should be something like the following (uncommented) :
# wwwrun [email protected]
# @machinename @example.com
if ! grep -qF "${apacheUser}" /etc/postfix/canonical ; then
echo $'\n'"${apacheUser} ${voteAdmin}" >> /etc/postfix/canonical
fi
if ! grep -qF "@${HOSTNAME}" /etc/postfix/canonical ; then
echo $'\n'"@${HOSTNAME} @${mtaUserMailDomain}" >> /etc/postfix/canonical
fi
postmap /etc/postfix/canonical
postfix reload
# Create the voting database
${mysql} -e "CREATE DATABASE IF NOT EXISTS ${bobDbDatabase} DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
# Create database user privileges (which will create the users if they do not exist); see: https://github.com/cusu/bob/blob/master/BOB.php#L1436
${mysql} -e "GRANT SELECT,INSERT,UPDATE ON ${bobDbDatabase}.* TO '${bobDbUsername}'@'localhost' IDENTIFIED BY '${bobDbPassword}';"
${mysql} -e "GRANT SELECT,CREATE ON ${bobDbDatabase}.* TO '${bobDbSetupUsername}'@'localhost' IDENTIFIED BY '${bobDbPassword}';"
# Install (download) OpenSTV, the STV counting program
zypper -n install -l python
if [ ! -d ${documentRoot}/openSTV ] ; then
cd "${documentRoot}"
git clone [email protected]:cusu/openSTV.git
fi