~jose/charms/precise/owncloud/fix-tests

« back to all changes in this revision

Viewing changes to hooks/upgrade-charm

  • Committer: Charles Butler
  • Date: 2014-07-21 22:03:13 UTC
  • mfrom: (24.1.17 owncloud)
  • Revision ID: chuck@dasroot.net-20140721220313-fkp6gi45czkd3zw8
  José Antonio Rey 2014-07-21 Updated Release key sha1sum, updated source to version 6.0.4
    José Antonio Rey 2014-06-20 Updated the author's email address
    José Antonio Rey 2014-06-20 Fixed default behaviour when domain wasn't set and made setup test +x
    José Antonio Rey 2014-06-17 Fixed various bugs
    José Antonio Rey 2014-06-03 Fixed password idempotency issue
    José Antonio Rey 2014-06-03 Added install dependency for mysql
    José Antonio Rey 2014-06-03 Solved some bugs
    José Antonio Rey 2014-06-03 Solved idempotency issue with username
    José Antonio Rey 2014-05-16 [merge] Fixed amulet tests. Thanks ~lazypower!
    Charles Butler 2014-05-12 Move expose to before setup in deploy test
    Charles Butler 2014-05-12 Refactor tests to resemble nose tests
    José Antonio Rey 2014-05-16 Fixed bug in website-relation-joined
    José Antonio Rey 2014-05-10 Fixed README and added default 'not configured' page
    José Antonio Rey 2014-05-07 Partially fixed tests
    José Antonio Rey 2014-05-01 Added db-relation-departed hook
    José Antonio Rey 2014-04-23 Fixed tests to comply with new settings
    José Antonio Rey 2014-04-23 Re-written part of the README, added SSL support and taken maintai...
    José Antonio Rey 2014-04-19 Fixed bug
    José Antonio Rey 2014-04-11 Added port change support and support to install from a repo

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# Pause during upgrade
6
6
hooks/stop
7
7
 
8
 
#we are under active migration, dont do anything more than once
9
 
if [ ! -f $CHARM_DIR/.migrating ]; then
10
 
 
11
 
    # Excise old installation data
12
 
    find /var/www -mindepth 2 -maxdepth 2 -type d -name 'data'\
13
 
     -exec mv {} /var/tmp/ \;
14
 
    find /var/www -mindepth 2 -maxdepth 2 -type d -name 'config'\
15
 
     -exec mv {} /var/tmp/ \;
16
 
    touch $CHARM_DIR/.migrating
17
 
 
 
8
if [ -f /usr/share/charm-helper/sh/net.sh ]; then
 
9
    #we are under active migration, dont do anything more than once
 
10
    if [ ! -f $CHARM_DIR/.migrating ]; then
 
11
    
 
12
        # Excise old installation data
 
13
        find /var/www -mindepth 2 -maxdepth 2 -type d -name 'data'\
 
14
        -exec mv {} /var/tmp/ \;
 
15
        find /var/www -mindepth 2 -maxdepth 2 -type d -name 'config'\
 
16
         -exec mv {} /var/tmp/ \;
 
17
        touch $CHARM_DIR/.migrating
 
18
    
 
19
    fi
 
20
    
 
21
    # Deleting all traces of the old ownCloud install
 
22
    rm -rf /var/www/owncloud/
 
23
    
 
24
    cd /var/www/
 
25
    
 
26
    # Getting new ownCloud version and MD5 checking it
 
27
    wget download.owncloud.org/community/owncloud-6.0.3.tar.bz2
 
28
    
 
29
    if [ `sha1sum owncloud-6.0.3.tar.bz2 | awk '{print $1}'` != "df1e272c208376117a8c00619079cee25a22f784" ]; then
 
30
        juju-log "Download verification failed. Exiting."
 
31
        exit 1
 
32
    fi
 
33
    
 
34
    tar xfj owncloud-6.0.3.tar.bz2
 
35
    cd $CHARM_DIR
 
36
 
 
37
    # Migrating data
 
38
    mkdir /var/www/owncloud/data
 
39
    rm -rf /var/www/owncloud/config
 
40
    mkdir /var/www/owncloud/config
 
41
    cp -pr /var/tmp/data/* /var/www/owncloud/data/
 
42
    cp -pr /var/tmp/config/* /var/www/owncloud/config/
 
43
    sudo chown -R www-data:www-data /var/www/owncloud
 
44
    rm $CHARM_DIR/.migrating
 
45
 
 
46
    # Finish upgrade
 
47
    hooks/config-changed
 
48
else
 
49
    apt-get update
 
50
    apt-get upgrade -y
18
51
fi
19
 
 
20
 
# Deleting all traces of the old ownCloud install
21
 
rm -rf /var/www/owncloud/
22
 
cd /var/www/
23
 
 
24
 
# Getting new ownCloud version and MD5 checking it
25
 
wget download.owncloud.org/community/owncloud-6.0.2.tar.bz2
26
 
wget download.owncloud.org/community/owncloud-6.0.2.tar.bz2.md5
27
 
 
28
 
while [ `md5sum owncloud-6.0.2.tar.bz2 | awk '{print $1}'` != `cat owncloud-6.0.2.tar.bz2.md5 | awk '{print $1}'` ]; do
29
 
    rm owncloud-6.0.2.tar.bz2
30
 
    wget download.owncloud.org/community/owncloud-6.0.2.tar.bz2
31
 
done
32
 
 
33
 
tar xfj owncloud-6.0.2.tar.bz2
34
 
cd $CHARM_DIR
35
 
 
36
 
# Migrating data
37
 
mkdir /var/www/owncloud/data
38
 
rm -rf /var/www/owncloud/config
39
 
mkdir /var/www/owncloud/config
40
 
cp -pr /var/tmp/data/* /var/www/owncloud/data/
41
 
cp -pr /var/tmp/config/* /var/www/owncloud/config/
42
 
sudo chown -R www-data:www-data /var/www/owncloud
43
 
 
44
 
# Finish upgrade
45
 
hooks/config-changed
46
 
 
47
 
rm $CHARM_DIR/.migrating