~jorge/charms/precise/lamp/readme-fixes

« back to all changes in this revision

Viewing changes to hooks/config-changed

  • Committer: Victor Palau
  • Date: 2012-09-07 11:56:42 UTC
  • Revision ID: vtuson@gmail.com-20120907115642-biyzmt7iwo3pcbef
added bzr pull and bzr update

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
 
4
4
BZR_BRANCH=`config-get website-bzr`
5
 
 
6
 
if [ ! -z "$BZR_BRANCH" ]; then
7
 
        rmdir website
 
5
BZR_PULL=`config-get bzr-update`
 
6
 
 
7
bzr_config="config/bar"
 
8
 
 
9
if [ ! -z "$BZR_BRANCH" ] && [ -f "$bzr_config" ]; then
 
10
        read bzr_current< $bzr_config
 
11
        juju-log "current config is $bzr_current"
 
12
        if [ $BZR_BRANCH = $bzr_current ]; then
 
13
                if [ ! -z "$BZR_PULL" ]; then   
 
14
                        juju-log "pulling latest version of $bzr_current"
 
15
                        cd website 
 
16
                        bzr pull
 
17
                        cd ..
 
18
                        cp website/mysql_conf config
 
19
                        cp website/* /var/www/ -r
 
20
                fi 
 
21
        else
 
22
                juju-log " $bzr_current and $BZR_branch are not the same"
 
23
                rm $bzr_config
 
24
        fi
 
25
         
 
26
fi
 
27
 
 
28
 
 
29
if [ ! -z "$BZR_BRANCH" ] && [ ! -f "$bzr_config" ]; then
 
30
        #fisrt time that bzr config is set
 
31
        juju-log " $bzr_config file not found"
 
32
        rm -r website
8
33
        bzr branch $BZR_BRANCH website
9
34
        cp website/mysql_conf config
10
35
        cp website/* /var/www/ -r
 
36
        echo "$BZR_BRANCH" > $bzr_config
 
37
        juju-log " adding $BZR_BRANCH to $bzr_config file" 
 
38
        exit 0
11
39
        
12
40
fi
13
41
 
 
42