add gackscollector initscript to rpm
[raven.git] / rpm_builds / build-gackscentral
1 #!/bin/bash
2
3
4 if [ ! $# -eq 2 ]
5 then
6         echo "usage: build-gackscentral <version> <release>"
7         exit 1
8 fi
9
10 VER=$1
11 REL=$2
12 GENIWRAPPER_DIR=/home/smbaker/projects/sfa/trunk/sfa
13 GENIWRAPPER_UTIL=$GENIWRAPPER_DIR/util
14 GENIWRAPPER_TRUST=$GENIWRAPPER_DIR/trust
15 SOURCE=`cat source`
16 FOLDER="gackscentral-$VER"
17
18
19 #create a folder to do the stuff in
20 mkdir $FOLDER
21
22
23 #mv the source files we need to there
24 cp $SOURCE/apps/gacks/*.py $FOLDER
25 cp $SOURCE/apps/gacks/etc/*.conf $FOLDER
26 cp $SOURCE/apps/gacks/gackslog.conf $FOLDER
27
28 cp $SOURCE/apps/gacks/localhost-gacks-defragment.sh $FOLDER
29 cp $SOURCE/apps/gacks/localhost-gacks-garbagecollect.sh $FOLDER
30 cp $SOURCE/apps/gacks/localhost-gacks-runasap.sh $FOLDER
31 cp $SOURCE/apps/gacks/localhost-gacks-applyinvoices.sh $FOLDER
32 cp $SOURCE/apps/gacks/localhost-gacks-mailinvoices.sh $FOLDER
33 cp $SOURCE/apps/gacks/gackscentral.cron $FOLDER
34
35 cp $SOURCE/apps/gacks/gacksbackend.init $FOLDER
36 cp $SOURCE/apps/gacks/gackslogserver.init $FOLDER
37 cp $SOURCE/apps/gacks/gackscollector.init $FOLDER
38
39 chmod +x $FOLDER/*.sh
40 chmod +x $FOLDER/gackscli.py
41
42 # stuff for the modpython API
43 cp $SOURCE/lib/ravenlib/modpythonapi/ModPython.py $FOLDER
44 cp $SOURCE/lib/ravenlib/modpythonapi/BaseApi.py $FOLDER
45 cp $SOURCE/lib/ravenlib/modpythonapi/AuthenticatedApi.py $FOLDER
46 cp $SOURCE/lib/ravenlib/modpythonapi/ApiExceptionCodes.py $FOLDER
47
48 cp $GENIWRAPPER_UTIL/*.py $FOLDER
49 cp $GENIWRAPPER_TRUST/*.py $FOLDER
50
51 touch $FOLDER/__init__.py
52
53 #tar the dir up into the SOURCES folder
54 tar -czf SOURCES/$FOLDER.tar.gz $FOLDER
55
56 #remove the folder
57 rm -rf $FOLDER
58
59 #prepare the awk command
60 AWK="awk '{gsub(/@VER@/,\"$VER\"); gsub(/@REL@/,\"$REL\"); print;}' SPECS/gackscentral.spec.template"
61
62 #execute awk command
63 eval $AWK > .gackscentral.spec
64
65 #make rpm
66 rpmbuild -ba .gackscentral.spec --target noarch
67 RETSTAT=$?
68
69 rm .gackscentral.spec
70
71 #clean up the debug rpms that get created for some reason
72 for foo in `find ./ -name "*debuginfo*"`
73 do
74         rm -f $foo
75 done
76
77 exit $RETSTAT