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

set -e

# Retrieve the configuration values
juju-log "Retrieving configuration values"

TITLE=`config-get title`
NAME=`config-get name`
EMAIL=`config-get email`
PASSWORD=`config-get password`
TIMEZONE=`config-get timezone`
CACHE=`config-get cache`
CACHE_LIFETIME=`config-get cache-lifetime`

# Update the user configuration IF the config data has
# been supplied AND the DB has been configured.
if [[ -n $NAME && -n $EMAIL && -n $PASSWORD && -f /opt/created_database_tables ]] ; then
    juju-log "Updating the owner information"
    update_admin_info "$NAME" "$EMAIL" "$PASSWORD"
fi

# Update the configuration
juju-log "Updating configuration file"
update_thinkup_config <<EOD
app_title="$TITLE"
timezone="$TIMEZONE"
cache_pages=$CACHE
cache_lifetime=$CACHE_LIFETIME
EOD