distmaker - Extract function dm_generate_version()
[civicrm-core.git] / distmaker / dists / joomla_php5.sh
CommitLineData
6a488035 1#!/bin/bash
7c71cbb4 2set -ex
6a488035
TO
3
4# This script assumes
5# that DAOs are generated
6# and all the necessary conversions had place!
7
8P=`dirname $0`
9CFFILE=$P/../distmaker.conf
10
11if [ ! -f $CFFILE ] ; then
12 echo "NO DISTMAKER.CONF FILE!"
13 exit 1
14else
15 . $CFFILE
16fi
17
69ff4a4a 18. "$P/common.sh"
19
ee752347 20RSYNCOPTIONS="-avC $DM_EXCLUDES_RSYNC --include=core"
6a488035
TO
21RSYNCCOMMAND="$DM_RSYNC $RSYNCOPTIONS"
22SRC=$DM_SOURCEDIR
23TRG=$DM_TMPDIR/civicrm
24
bed96570
TO
25# checkout the right code revisions
26pushd "$DM_SOURCEDIR/joomla"
27git checkout "$DM_REF_JOOMLA"
28popd
29
6a488035
TO
30# make sure and clean up before
31if [ -d $TRG ] ; then
32 rm -rf $TRG/*
33fi
34
35# copy all the rest of the stuff
69ff4a4a 36dm_install_core "$SRC" "$TRG"
9f0ca23d 37dm_install_packages "$SRC/packages" "$TRG/packages"
38for CODE in joomla ; do
6a488035
TO
39 echo $CODE
40 [ -d $SRC/$CODE ] && $RSYNCCOMMAND $SRC/$CODE $TRG
41done
42
6a488035 43# copy docs
6a488035 44cp $SRC/civicrm.config.php $TRG
30a50cd8 45dm_generate_version "$TRG/civicrm-version.php" Joomla
6a488035
TO
46
47# gen zip file
48cd $DM_TMPDIR;
49
50mkdir com_civicrm
51mkdir com_civicrm/admin
52mkdir com_civicrm/site
53mkdir com_civicrm/site/elements
54mkdir com_civicrm/admin/civicrm
55mkdir com_civicrm/admin/language
56mkdir com_civicrm/admin/language/en-GB
57mkdir com_civicrm/admin/helpers
58mkdir com_civicrm/admin/plugins
59
60# copying back end code to admin folder
61cp civicrm/joomla/script.civicrm.php com_civicrm/
62cp civicrm/joomla/admin/admin.civicrm.php com_civicrm/admin
63cp civicrm/joomla/admin/config.xml com_civicrm/admin
64cp civicrm/joomla/admin/configure.php com_civicrm/admin
65cp civicrm/joomla/admin/license.civicrm.txt com_civicrm/admin
66cp civicrm/joomla/admin/toolbar.civicrm.php com_civicrm/admin
67cp civicrm/joomla/admin/toolbar.civicrm.html.php com_civicrm/admin
68cp -r -p civicrm/joomla/admin/helpers/* com_civicrm/admin/helpers
69cp -r -p civicrm/joomla/admin/plugins/* com_civicrm/admin/plugins
70cp civicrm/joomla/admin/language/en-GB/* com_civicrm/admin/language/en-GB
71
01ad1437
DL
72# joomla 3.0 like admin.civicrm.php to be called civicrm.php
73# lets keep both versions there
74cp com_civicrm/admin/admin.civicrm.php com_civicrm/admin/civicrm.php
6a488035
TO
75
76# copying front end code
77cp civicrm/joomla/site/civicrm.html.php com_civicrm/site
78cp civicrm/joomla/site/civicrm.php com_civicrm/site
79cp -r civicrm/joomla/site/views com_civicrm/site
80cp -r -p civicrm/joomla/site/elements/* com_civicrm/site/elements
81
82# copy civicrm code
83cp -r -p civicrm/* com_civicrm/admin/civicrm
84
85# generate alt version of civicrm.xml
86$DM_PHP $DM_SOURCEDIR/distmaker/utils/joomlaxml.php $DM_SOURCEDIR com_civicrm $DM_VERSION alt
87
88# generate alt version of package
89$DM_ZIP -q -r -9 $DM_TARGETDIR/civicrm-$DM_VERSION-joomla-alt.zip com_civicrm
90
91# delete the civicrm directory
92rm -rf com_civicrm/admin/civicrm
93
94# generate zip version of civicrm.xml
95$DM_PHP $DM_SOURCEDIR/distmaker/utils/joomlaxml.php $DM_SOURCEDIR com_civicrm $DM_VERSION zip
96
97$DM_ZIP -q -r -9 com_civicrm/admin/civicrm.zip civicrm
98
99# generate zip within zip file
100$DM_ZIP -q -r -9 $DM_TARGETDIR/civicrm-$DM_VERSION-joomla.zip com_civicrm -x 'com_civicrm/admin/civicrm'
101
102# clean up
103rm -rf com_civicrm
104rm -rf $TRG