Merge pull request #50 from yashodha/fix-version
[civicrm-core.git] / distmaker / dists / joomla_php5.sh
1 #!/bin/bash
2 set -e
3
4 # This script assumes
5 # that DAOs are generated
6 # and all the necessary conversions had place!
7
8 P=`dirname $0`
9 CFFILE=$P/../distmaker.conf
10
11 if [ ! -f $CFFILE ] ; then
12 echo "NO DISTMAKER.CONF FILE!"
13 exit 1
14 else
15 . $CFFILE
16 fi
17
18 RSYNCOPTIONS="-avC $DM_EXCLUDES_RSYNC --include=core"
19 RSYNCCOMMAND="$DM_RSYNC $RSYNCOPTIONS"
20 SRC=$DM_SOURCEDIR
21 TRG=$DM_TMPDIR/civicrm
22
23 # checkout the right code revisions
24 pushd "$DM_SOURCEDIR/joomla"
25 git checkout "$DM_REF_JOOMLA"
26 popd
27
28 # make sure and clean up before
29 if [ -d $TRG ] ; then
30 rm -rf $TRG/*
31 fi
32
33 # copy all the rest of the stuff
34 for CODE in css i install js packages PEAR templates bin joomla CRM api extern Reports settings; do
35 echo $CODE
36 [ -d $SRC/$CODE ] && $RSYNCCOMMAND $SRC/$CODE $TRG
37 done
38
39 # delete any setup.sh or setup.php4.sh if present
40 if [ -d $TRG/bin ] ; then
41 rm -f $TRG/bin/setup.sh
42 rm -f $TRG/bin/setup.php4.sh
43 rm -f $TRG/bin/setup.bat
44 fi
45
46 # copy selected sqls
47 if [ ! -d $TRG/sql ] ; then
48 mkdir $TRG/sql
49 fi
50 for F in $SRC/sql/civicrm*.mysql $SRC/sql/counties.US.sql.gz $SRC/sql/case_sample*.mysql; do
51 cp $F $TRG/sql
52 done
53
54 set +e
55 rm -rf $TRG/sql/civicrm_*.??_??.mysql
56 set -e
57
58 # copy docs
59 cp $SRC/agpl-3.0.txt $TRG
60 cp $SRC/gpl.txt $TRG
61 cp $SRC/README.txt $TRG
62 cp $SRC/Sponsors.txt $TRG
63 cp $SRC/agpl-3.0.exception.txt $TRG
64 cp $SRC/civicrm.config.php $TRG
65
66 # final touch
67 echo "<?php
68 function civicrmVersion( ) {
69 return array( 'version' => '$DM_VERSION',
70 'cms' => 'Joomla',
71 'revision' => '$DM_REVISION' );
72 }
73 " > $TRG/civicrm-version.php
74
75 # gen zip file
76 cd $DM_TMPDIR;
77
78 mkdir com_civicrm
79 mkdir com_civicrm/admin
80 mkdir com_civicrm/site
81 mkdir com_civicrm/site/elements
82 mkdir com_civicrm/admin/civicrm
83 mkdir com_civicrm/admin/language
84 mkdir com_civicrm/admin/language/en-GB
85 mkdir com_civicrm/admin/helpers
86 mkdir com_civicrm/admin/plugins
87
88 # copying back end code to admin folder
89 cp civicrm/joomla/script.civicrm.php com_civicrm/
90 cp civicrm/joomla/admin/admin.civicrm.php com_civicrm/admin
91 cp civicrm/joomla/admin/config.xml com_civicrm/admin
92 cp civicrm/joomla/admin/configure.php com_civicrm/admin
93 cp civicrm/joomla/admin/license.civicrm.txt com_civicrm/admin
94 cp civicrm/joomla/admin/toolbar.civicrm.php com_civicrm/admin
95 cp civicrm/joomla/admin/toolbar.civicrm.html.php com_civicrm/admin
96 cp -r -p civicrm/joomla/admin/helpers/* com_civicrm/admin/helpers
97 cp -r -p civicrm/joomla/admin/plugins/* com_civicrm/admin/plugins
98 cp civicrm/joomla/admin/language/en-GB/* com_civicrm/admin/language/en-GB
99
100
101 # copying front end code
102 cp civicrm/joomla/site/civicrm.html.php com_civicrm/site
103 cp civicrm/joomla/site/civicrm.php com_civicrm/site
104 cp -r civicrm/joomla/site/views com_civicrm/site
105 cp -r -p civicrm/joomla/site/elements/* com_civicrm/site/elements
106
107 # copy civicrm code
108 cp -r -p civicrm/* com_civicrm/admin/civicrm
109
110 # generate alt version of civicrm.xml
111 $DM_PHP $DM_SOURCEDIR/distmaker/utils/joomlaxml.php $DM_SOURCEDIR com_civicrm $DM_VERSION alt
112
113 # generate alt version of package
114 $DM_ZIP -q -r -9 $DM_TARGETDIR/civicrm-$DM_VERSION-joomla-alt.zip com_civicrm
115
116 # delete the civicrm directory
117 rm -rf com_civicrm/admin/civicrm
118
119 # generate zip version of civicrm.xml
120 $DM_PHP $DM_SOURCEDIR/distmaker/utils/joomlaxml.php $DM_SOURCEDIR com_civicrm $DM_VERSION zip
121
122 $DM_ZIP -q -r -9 com_civicrm/admin/civicrm.zip civicrm
123
124 # generate zip within zip file
125 $DM_ZIP -q -r -9 $DM_TARGETDIR/civicrm-$DM_VERSION-joomla.zip com_civicrm -x 'com_civicrm/admin/civicrm'
126
127 # clean up
128 rm -rf com_civicrm
129 rm -rf $TRG