Project

General

Profile

Download (3.61 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/bash
2

    
3
#
4
#
5
#
6
#
7
DRUPAL_VERSION="7"
8
SVN_USER="edit-jenkins"
9

    
10
if [ -z "$1" ]; then
11
	echo "version parameter missing\nUsage: deploy.sh <version-number>"
12
  exit -1
13
fi
14
VERSION=$1
15

    
16
# $WORKSPACE is an environment variable set by jenkins
17
if [ -n "$WORKSPACE" ]; then
18
	cd $WORKSPACE
19
fi
20

    
21
# check if tag exists
22
TAG_EXISTS=(`svn info http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION 2> /dev/null | grep URL`)
23
if [ -z "$TAG_EXISTS" ]; then
24
	# it is a new version number ...
25

    
26
	# create release tag and branch for the module
27
	svn --username=$SVN_USER copy -m "release tag for cdm_dataportal $VERSION" http://dev.e-taxonomy.eu/svn/trunk/drupal/${DRUPAL_VERSION}.x/modules/cdm_dataportal http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION
28
	svn --username=$SVN_USER copy -m "branch for cdm_dataportal $VERSION" http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION http://dev.e-taxonomy.eu/svn/branches/drupal/module-cdm_dataportal-RELEASE-$VERSION
29

    
30
	#create release tag and branch for the themes
31
	svn --username=$SVN_USER copy -m "release tag for drupal themes $VERSION" http://dev.e-taxonomy.eu/svn/trunk/drupal/${DRUPAL_VERSION}.x/themes http://dev.e-taxonomy.eu/svn/tags/drupal/themes/$VERSION
32
	svn --username=$SVN_USER copy -m "branch for drupal themes $VERSION" http://dev.e-taxonomy.eu/svn/tags/drupal/themes/$VERSION http://dev.e-taxonomy.eu/svn/branches/drupal/themes-RELEASE-$VERSION
33
fi
34

    
35
#create the target folder
36
if [ ! -d target ]; then
37
	mkdir target
38
fi
39
cd target
40
rm -rf *
41

    
42
# create the module-cdm_dataportal archive
43
svn --username=$SVN_USER export http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION ./cdm_dataportal
44
tar czf cdm_dataportal-$VERSION.tar.gz ./cdm_dataportal
45

    
46
# create the drupal${DRUPAL_VERSION}-cdm_dataportal archive ...
47

    
48
# downlod latest and unpack
49
ARCHIVE_URL=(`lynx -dump http://wp5.e-taxonomy.eu/download/dataportal/stable/ | grep "download/dataportal/stable/drupal${DRUPAL_VERSION}-cdm_dataportal" | head -n 1 | sed -e "s/.*\(http.*\)/\1/g"`)
50

    
51
if [ -z "$ARCHIVE_URL" ]; then
52
  echo "http://wp5.e-taxonomy.eu/download/dataportal/stable/ does not contain drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz file, please check this symling on the server"
53
  exit -1;
54
fi
55

    
56
curl --output drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz $ARCHIVE_URL
57
tar xzf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz
58

    
59
# update the update script update-to.sh
60
rsync -r --exclude=.svn ../jenkins-ci/dataportal-version-update/ drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all
61

    
62
# update the module and themes
63
cd drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all
64
./update-to.sh $VERSION
65

    
66
# copy the profiles
67
cd ../../
68
rsync -r --exclude=.svn sites/all/modules/cdm_dataportal/profile/ profiles/
69

    
70
# make tar
71
cd ../
72
tar czf drupal${DRUPAL_VERSION}-cdm_dataportal-$VERSION.tar.gz drupal${DRUPAL_VERSION}-cdm_dataportal
73
rm -rf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz
74

    
75
# create the new folder on the server and upload everything
76
ssh root@160.45.63.172 "mkdir /var/www/download/dataportal/$VERSION"
77
ssh root@160.45.63.172 "rm -r /var/www/download/dataportal/stable"
78
ssh root@160.45.63.172 "ln -s /var/www/download/dataportal/$VERSION /var/www/download/dataportal/stable"
79
scp cdm_dataportal-${VERSION}.tar.gz root@wp5.e-taxonomy.eu:/var/www/download/dataportal/${VERSION}/
80
scp drupal${DRUPAL_VERSION}-cdm_dataportal-${VERSION}.tar.gz root@wp5.e-taxonomy.eu:/var/www/download/dataportal/${VERSION}/
81
ssh root@160.45.63.172 "chown -R www-data:www-data /var/www/download/dataportal/${VERSION}"
82
ssh root@160.45.63.172 "chown -R www-data:www-data /var/www/download/dataportal/stable"
83

    
84
# DONE
85
echo "cdm_dataportal deployment done!"
86

    
87

    
88

    
89

    
90

    
91

    
92

    
93

    
94

    
95

    
(1-1/3)