do not copy settings.php in build
[syp.git] / build.sh
1 #!/bin/sh
2
3 set -e
4
5 PROJVERS=0.2
6 PROJNAME=syp
7
8 BUILDDIR=${1:-build}
9 DESTDIR=${BUILDDIR}/${PROJNAME}-${PROJVERS}
10
11 rm -rf $BUILDDIR
12 mkdir -p $DESTDIR
13
14 # php includes
15 cp -RLp inc/ $DESTDIR/
16 # removes generated settings in case it exists
17 rm -f $DESTDIR/inc/settings.php
18
19 # other php files
20 cp -p admin.*php index.*php upgrade.*php install.*php news.php api.php items.php logout.php $DESTDIR/
21
22 # media
23 cp -RLp media/ $DESTDIR/
24
25 # openlayers
26 mkdir -p $DESTDIR/openlayers
27 cd openlayers/build/
28 python build.py ../../syp.cfg
29 cd ../../
30 cp -RLp openlayers/build/OpenLayers.js $DESTDIR/openlayers/
31
32 # openlayers images
33 mkdir $DESTDIR/openlayers/img
34 for file in east-mini.png \
35             north-mini.png \
36             blank.gif \
37             west-mini.png \
38             zoom-plus-mini.png \
39             south-mini.png \
40             zoom-minus-mini.png \
41             zoom-world-mini.png; do
42     cp -p openlayers/img/$file $DESTDIR/openlayers/img
43 done
44 # openlayers theme
45 mkdir -p $DESTDIR/openlayers/theme/default/img
46 cp -Lp openlayers/theme/default/style.css $DESTDIR/openlayers/theme/default/style.css
47 cp -RLp openlayers/theme/default/img/close.gif $DESTDIR/openlayers/theme/default/img
48
49 # other javascript
50 cp -RLp js/ $DESTDIR/
51
52 # replace jquery with minified version
53 for file in $DESTDIR/js/jquery-*.min.js; do
54     jversion=${file##$DESTDIR/js/jquery-}
55     jversion=${jversion%%\.min\.js}
56     mv $file $DESTDIR/js/jquery-$jversion.js
57 done
58
59 # copyright and readme and changes files
60 cp -p license.txt COPYING.txt README.txt CHANGES.txt $DESTDIR/
61
62 # creates upload directory
63 mkdir -p $DESTDIR/upload/_thumbs
64 chmod -R a+wx $DESTDIR/upload
65
66 # generate sources
67 cd $BUILDDIR
68 tar -pczf ${PROJNAME}_${PROJVERS}.tar.gz ${PROJNAME}-${PROJVERS}
69 zip -r ${PROJNAME}_${PROJVERS}.zip ${PROJNAME}-${PROJVERS}
70 cd ..
71
72 if [ -d .git/ ] && which git > /dev/null; then
73     git checkout openlayers
74 fi