import repository from arizona
[raven.git] / rpm_builds / build-failsafe
1 #!/bin/bash
2
3 if [ ! $# -eq 2 ]
4 then
5         echo "usage: build-failsafe <version> <release>"
6         exit 1
7 fi
8
9 VER=$1
10 REL=$2
11 SOURCE=`cat source`
12 FOLDER="stork-failsafe-$VER"
13
14
15 #create a folder to do the stuff in
16 mkdir $FOLDER 
17
18 #mv the source files we need to there
19 cp $SOURCE/apps/failsafe/failsafe.sh $FOLDER
20 cp $SOURCE/apps/failsafe/stork-failsafe.cron $FOLDER
21 cp $SOURCE/webpage/downloads/initscript $FOLDER
22 cp $SOURCE/pyspecer/stork/nr06.certificate $FOLDER
23
24 chmod +x $FOLDER/*.sh
25 chmod +x $FOLDER/initscript
26
27 #tar the dir up into the SOURCES folder
28 tar -czf SOURCES/$FOLDER.tar.gz $FOLDER
29
30 #remove the folder
31 rm -rf $FOLDER
32
33 #prepare the awk command
34 AWK="awk '{gsub(/@VER@/,\"$VER\"); gsub(/@REL@/,\"$REL\"); print;}' SPECS/stork-failsafe.spec.template"
35
36 #execute awk command
37 eval $AWK > .stork-failsafe.spec
38
39 #make rpm
40 rpmbuild -ba .stork-failsafe.spec --target noarch
41 RETSTAT=$?
42
43
44 rm .stork-failsafe.spec
45
46 #clean up the debug rpms that get created for some reason
47 for foo in `find ./ -name "*debuginfo*"`
48 do
49         rm -f $foo
50 done
51
52
53
54 exit $RETSTAT