This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathmake-rpm.sh
executable file
·65 lines (61 loc) · 1.54 KB
/
make-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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
version=`cat VERSION`
dst=td-agent-$version
rev=`cat REVISION`
cur=`pwd`
# user defined revision
if [ ! -z "$1" ]; then
rev=$1
rpm_dist=$(echo $rev | cut -c1-10)
fi
# install required packages
yum install -y wget make rpm-build gcc gcc-c++ readline-devel openssl-devel libxml2-devel libxslt-devel zlib-devel automake autoconf libtool auto-buildrequires openssl-devel
# setup td-agent-$version.tar.gz from fluentd.git
rm -fR fluentd
git clone git://github.com/fluent/fluentd.git
cd fluentd
git checkout $rev
cd ..
rm -fR $dst
mv fluentd $dst
cp td-agent.conf $dst
if [ -f redhat/td-agent.conf.custom ]; then
cp redhat/td-agent.conf.custom $dst
fi
cp td-agent.prelink.conf $dst
cp Makefile.am $dst
cp autogen.sh $dst
cp configure.in $dst
cp ./td-agent.logrotate $dst
# locate pre-downloaded gems
if [ -d plugin_gems ]; then
mkdir -p $dst/plugins
cp plugin_gems/*.gem $dst/plugins
fi
tar czf $dst.tar.gz $dst
rm -fR $dst
# setup rpmbuild env
my_rpmbuild() {
rpmbuild --define "_topdir $cur/rpmbuild/" "$@"
}
rm -fR rpmbuild
mkdir rpmbuild
pushd rpmbuild
mkdir BUILD RPMS SOURCES SPECS SRPMS
# locate spec
cp ../redhat/td-agent.spec SPECS
# locate source tarball
mv ../$dst.tar.gz SOURCES
# locate init.d script
cp ../redhat/td-agent.init SOURCES
# locate customized configuration file
if [ -f ../redhat/td-agent.conf.custom ]; then
cp ../redhat/td-agent.conf.custom SOURCES
fi
# build
if [ -z "$rpm_dist" ]; then
my_rpmbuild -v -ba --clean SPECS/td-agent.spec
else
my_rpmbuild -v -ba --define "dist .${rpm_dist}" --clean SPECS/td-agent.spec
fi
popd