forked from PeachyPrinter/peachyprinter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_centos.sh
executable file
·56 lines (45 loc) · 1.28 KB
/
build_centos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
echo "TODO - not done yet"
exit 666
echo "------------------------------------"
echo "Cleaning workspace"
echo "------------------------------------"
rm -rf src/build
rm -rf *.dmg
rm -f src/VERSION.py
rm -f version.properties
echo "------------------------------------"
echo "Extracting Git Revision Number"
echo "------------------------------------"
SEMANTIC=`cat symantic.version`
function trim() { echo $1; }
if [ -z $GIT_HOME ]; then
if [ -f "/usr/local/bin/git" ]; then
export GIT_HOME=/usr/local/bin/git
elif [ -f "/usr/bin/git" ]; then
export GIT_HOME=/usr/bin/git
elif [ -f "/bin/git" ]; then
export GIT_HOME=/bin/git
else
echo "Could not find git."
exit 1
fi
fi
export GIT_REV_COUNT_RAW=`$GIT_HOME log --pretty=oneline | wc -l`
export GIT_REV_COUNT=`trim $GIT_REV_COUNT_RAW`
export GIT_REV=`$GIT_HOME rev-parse HEAD`
VERSION=$SEMANTIC.$TAG$GIT_REV_COUNT
echo "Version: $VERSION"
echo "# THIS IS A GENERATED FILE " > version.properties
echo "version='$VERSION'" >> version.properties
echo "revision='$GIT_REV'" >> version.properties
echo "Git Revision Number is $GIT_REV_COUNT"
cp version.properties src/VERSION.py
cd src
python setup.py bdist_rpm
if [ $? != 0 ]; then
echo "Packaging Failed Aborting"
exit 55
fi
cd ..
mv src/dist/*.rpm .