~george-edison55/charms/precise/statusnet/added-maintainer

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
50
51
52
53
#!/bin/bash

set -e

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

juju-log "Downloading and verifying StatusNet"
. /usr/share/charm-helper/sh/net.sh
ch_get_file http://status.net/statusnet-1.0.1.tar.gz 727a7cfe7e9531b732739dabd295bcb9

juju-log "Extracting StatusNet"
cd /var/www
tar -xzf /tmp/statusnet-1.0.1.tar.gz

juju-log "Relocating files to document root"
rm index.html # this file is placed by Apache, we don't need it
mv statusnet-1.0.1/* .
rm -r statusnet-1.0.1 # only file left in folder is .gitignore
mv htaccess.sample .htaccess

juju-log "Patching .htaccess"
sed -i "s:RewriteBase /mublog/::" .htaccess

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

# Enable mod_rewrite
a2enmod rewrite

# Enable .htaccess overrides
cat > /etc/apache2/sites-enabled/000-default <<EOD
<VirtualHost *:80>
    DocumentRoot /var/www
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
EOD

juju-log "Restarting Apache"
service apache2 restart

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

juju-log "Setting relation values"
relation-set hostname=`unit-get private-address` port=80