Ubuntu Pastebin

Paste from jobot at Fri, 16 Jan 2015 01:56:09 +0000

Download as text
 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
#!/bin/bash
set -e # If any command fails, stop execution of the hook with that error
apt-get install -y apache2 php5-cgi php5-mysql curl php5-gd wget libapache2-mod-php5 unzip
dl="https://github.com/salesagility/SuiteCRM/archive/master.zip"
# Grab SuiteCRM from upstream.
juju-log "Fetching $dl"
wget "$dl" -O /tmp/master.zip
# IDEMPOTENCY is very important in all charm hooks, even the install hook.
if [ -f /var/www/suitecrm/config.php ]; then
  cp /var/www/suitecrm/config.php /tmp/
  rm -rf /var/www/suitecrm
fi
# Extract to a known location
juju-log "Extracting SuiteCRM"
unzip -C /tmp/master.zip -d /var/www/

mv /var/www/SuiteCRM-master* /var/www/suitecrm
if [ -f /tmp/config.php ]; then
  mv /tmp/config.php /var/www/suitecrm
fi

if [ -f /var/www/suitecrm/config.php ]; then
  chmod 777 /var/www/suitecrm/config.php
fi

chmod -R 777 /var/www/suitecrm/upload
juju-log "Creating apache2 configuration"
cat <<EOF > /etc/apache2/sites-available/suitecrm
<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/suitecrm
  <Directory /var/www/suitecrm>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
  ErrorLog \${APACHE_LOG_DIR}/suitecrm.log
  LogLevel warn
  CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
a2dissite 000-default
a2ensite suitecrm
service apache2 reload
juju-log "Files extracted, waiting for other events before we do anything else!"
Download as text