Merge pull request #166 from totten/html-head
[civicrm-core.git] / distmaker / dists / wordpress_php5.sh
1 #!/bin/bash
2 set -ex
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/WordPress"
25 git checkout "$DM_REF_WORDPRESS"
26 popd
27
28 # make sure and clean up before
29 if [ -d $TRG ] ; then
30 rm -rf $TRG/*
31 fi
32
33 if [ ! -d $TRG ] ; then
34 mkdir $TRG
35 fi
36
37 if [ ! -d $TRG/civicrm ] ; then
38 mkdir $TRG/civicrm
39 fi
40
41 if [ ! -d $TRG/civicrm/civicrm ] ; then
42 mkdir $TRG/civicrm/civicrm
43 fi
44
45 # copy all the stuff
46 for CODE in css i js packages PEAR templates bin CRM api extern Reports install settings; do
47 echo $CODE
48 [ -d $SRC/$CODE ] && $RSYNCCOMMAND $SRC/$CODE $TRG/civicrm/civicrm
49 done
50
51 # delete any setup.sh or setup.php4.sh if present
52 if [ -d $TRG/civicrm/civicrm/bin ] ; then
53 rm -f $TRG/civicrm/civicrm/bin/setup.sh
54 rm -f $TRG/civicrm/civicrm/bin/setup.php4.sh
55 rm -f $TRG/civicrm/civicrm/bin/setup.bat
56 fi
57
58 # copy selected sqls
59 if [ ! -d $TRG/civicrm/civicrm/sql ] ; then
60 mkdir $TRG/civicrm/civicrm/sql
61 fi
62
63 for F in $SRC/sql/civicrm*.mysql $SRC/sql/counties.US.sql.gz $SRC/sql/case_sample*.mysql; do
64 cp $F $TRG/civicrm/civicrm/sql
65 done
66
67 set +e
68 rm -rf $TRG/civicrm/civicrm/sql/civicrm_*.??_??.mysql
69 set -e
70
71 for F in $SRC/WordPress/*; do
72 cp $F $TRG/civicrm
73 done
74
75 # copy docs
76 cp $SRC/agpl-3.0.txt $TRG/civicrm/civicrm
77 cp $SRC/gpl.txt $TRG/civicrm/civicrm
78 cp $SRC/README.txt $TRG/civicrm/civicrm
79 cp $SRC/civicrm.config.php $TRG/civicrm/civicrm
80
81 # final touch
82 echo "<?php
83 function civicrmVersion( ) {
84 return array( 'version' => '$DM_VERSION',
85 'cms' => 'Wordpress',
86 'revision' => '$DM_REVISION' );
87 }
88 " > $TRG/civicrm/civicrm/civicrm-version.php
89
90 # gen tarball
91 cd $TRG
92 $DM_ZIP -r -9 $DM_TARGETDIR/civicrm-$DM_VERSION-wordpress.zip *
93 # clean up
94 rm -rf $TRG