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

« back to all changes in this revision

Viewing changes to hooks/config-changed

  • Committer: Nathan Osman
  • Date: 2011-11-21 02:48:41 UTC
  • Revision ID: admin@quickmediasolutions.com-20111121024841-iq5201ijkgsid615
Switched to sed for manipulating the preferences files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
CACHE_LIFETIME=`config-get cache-lifetime`
12
12
 
13
13
# Write the configuration file to disk
14
 
juju-log "Creating application configuration file"
15
 
 
16
 
# Construct the configuration file for ThinkUp
17
 
cat > /var/www/config.app.inc.php <<EOF
18
 
<?php
19
 
\$THINKUP_CFG['app_title']                = '$TITLE';
20
 
\$THINKUP_CFG['site_root_path']           = '/';
21
 
\$THINKUP_CFG['source_root_path']         = dirname( __FILE__ ) . '/';
22
 
\$THINKUP_CFG['timezone']                 = '$TIMEZONE';
23
 
\$THINKUP_CFG['cache_pages']              = $CACHE;
24
 
\$THINKUP_CFG['cache_lifetime']           = $CACHE_LIFETIME;
25
 
\$THINKUP_CFG['rss_crawler_refresh_rate'] = 20;
26
 
?>
27
 
EOF
 
14
juju-log "Updating configuration file"
 
15
sed -i -e "s/^\\\$THINKUP_CFG\['app_title'\](\s*)\=.*/\$THINKUP_CFG['app_title']$1= '${TITLE}';/" -e "s/^\\\$THINKUP_CFG\['timezone'\](\s*)\=.*/\$THINKUP_CFG['timezone']$1= '${TIMEZONE}';/" -e "s/^\\\$THINKUP_CFG\['cache_pages'\](\s*)\=.*/\$THINKUP_CFG['cache_pages']$1= ${CACHE};/"-e "s/^\\\$THINKUP_CFG\['cache_lifetime'\](\s*)\=.*/\$THINKUP_CFG['cache_lifetime']$1= '${CACHE_LIFETIME}';/" /var/www/config.inc.php