~george-edison55/charms/oneiric/thinkup/update-to-1-0-2

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
#!/bin/bash

set -e

juju-log "Copying PHP script"
cp opt/update_thinkup_config /usr/bin

juju-log "Installing required packages"
export DEBIAN_FRONTEND=noninteractive
apt-get install -y php5-cli libapache2-mod-php5 php5-mysql php5-curl php5-gd mysql-client postfix unzip wget

juju-log "Downloading ThinkUp"
wget https://github.com/downloads/ginatrapani/ThinkUp/thinkup_1.0.zip -O /tmp/thinkup.zip

juju-log "Extracting ThinkUp"
cd /var/www
unzip /tmp/thinkup.zip

juju-log "Relocating files to document root"
rm index.html # this file is placed by Apache, we don't need it
mv thinkup/* .
rmdir thinkup
mv config.sample.inc.php config.inc.php

juju-log "Preparing initial configuration"
update_thinkup_config <<EOD
site_root_path='/'
EOD

juju-log "Assigning file ownership"
chown -R www-data:www-data .

juju-log "Restarting Apache"
service apache2 restart

# Make port 80 available
juju-log "Opening port 80"
open-port 80/tcp