forked from towel1980/openlava
-
Notifications
You must be signed in to change notification settings - Fork 6
/
rpm.sh
executable file
·51 lines (40 loc) · 1.18 KB
/
rpm.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
#!/bin/sh
#set -x
#
# Copyright (c) 2011-2016 David Bigagli
#
major="3"
minor="1"
grep 4.6 /etc/redhat-release > /dev/null
if [ "$?" == "0" ]; then
echo "Cleaning..."
rm -f /usr/src/redhat/SOURCES/openlava*
rm -f /usr/src/redhat/RPMS/x86_64/openlava*
rm -f /usr/src/redhat/SPECS/openlava.spec
echo "Archiving..."
git archive --format=tar --prefix="openlava-${major}.${minor}/" HEAD \
| gzip > /usr/src/redhat/SOURCES/openlava-${major}.${minor}.tar.gz
cp spec/openlava.spec /usr/src/redhat/SPECS/openlava.spec
echo "RPM building..."
rpmbuild -ba --target x86_64 /usr/src/redhat/SPECS/openlava.spec
if [ "$?" != 0 ]; then
echo "Failed buidling rpm"
exit 1
fi
exit 0
fi
echo "Cleaning up ~/rpmbuild directory..."
rm -rf ~/rpmbuild
echo "Creating the ~/rpmbuild..."
rpmdev-setuptree
echo "Archiving source code..."
git archive --format=tar --prefix="openlava-${major}.${minor}/" HEAD \
| gzip > ~/rpmbuild/SOURCES/openlava-${major}.${minor}.tar.gz
cp spec/openlava.spec ~/rpmbuild/SPECS/openlava.spec
echo "RPM building..."
rpmbuild -ba --target x86_64 ~/rpmbuild/SPECS/openlava.spec
if [ "$?" != 0 ]; then
echo "Failed buidling rpm"
exit 1
fi
exit 0