Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 21d88d3

Browse files
committed
Merge pull request #44 from tagomoris/customized_conf_and_plugins
Fixes for user-locally-built rpms of td-agent
2 parents 58c726b + 0eb91f1 commit 21d88d3

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

Makefile.am

+15-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ plugins:
4646
fi; \
4747
done
4848

49+
extplugin:
50+
if [ ! -f "$(srcdir)/plugins/$(EXTGEM)" ]; then \
51+
wget "http://rubygems.org/downloads/$(EXTGEM)" -O "$(srcdir)/plugins/$(EXTGEM)"; \
52+
fi
53+
54+
# duplicate of PLUGINS and $(srcdir)/plugins/*.gem depends on install order of nokogiri and aws-sdk (and others)
4955
install: install-recursive
5056
for gem in $(srcdir)/deps/*.gem; do \
5157
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
@@ -60,15 +66,22 @@ install: install-recursive
6066
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
6167
$(DEST_GEM) install --no-rdoc --no-ri "$$gem"; \
6268
done
63-
for gem in $(PLUGINS); do \
69+
for gemname in $(PLUGINS); do \
6470
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
65-
$(DEST_GEM) install --no-rdoc --no-ri "$(srcdir)/plugins/$$gem"; \
71+
$(DEST_GEM) install --no-rdoc --no-ri "$(srcdir)/plugins/$$gemname"; \
72+
done
73+
for gem in $(srcdir)/plugins/*.gem; do \
74+
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
75+
$(DEST_GEM) install --no-rdoc --no-ri "$$gem"; \
6676
done
6777
rm -fR $(DEST_RUBY_LIBDIR)/gems/1.9.1/gems/bson-*/bin/b2json
6878
rm -fR $(DEST_RUBY_LIBDIR)/gems/1.9.1/gems/bson-*/bin/j2bson
6979
rm -fR $(DEST_RUBY_LIBDIR)/gems/1.9.1/gems/td-*/dist/resources/pkg/td
7080
mkdir -p $(DESTDIR)$(sysconfdir)/td-agent
7181
cp -f $(srcdir)/td-agent.conf $(DESTDIR)$(sysconfdir)/td-agent/td-agent.conf.tmpl
82+
if [ -f "$(srcdir)/td-agent.conf.custom" ]; then \
83+
cp -f $(srcdir)/td-agent.conf.custom $(DESTDIR)$(sysconfdir)/td-agent/td-agent.conf; \
84+
fi
7285
mkdir -p $(DESTDIR)$(sysconfdir)/td-agent/prelink.conf.d
7386
cp -f $(srcdir)/td-agent.prelink.conf $(DESTDIR)$(sysconfdir)/td-agent/prelink.conf.d/td-agent.conf
7487
mkdir -p $(DESTDIR)$(sysconfdir)/td-agent/logrotate.d

make-rpm.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,24 @@ yum install -y wget make rpmbuild gcc gcc-c++ readline-devel openssl-devel libxm
1717
rm -fR fluentd
1818
git clone git://github.com/fluent/fluentd.git
1919
cd fluentd
20-
git checkout $rev
20+
git checkout -b $rev # -b: don't show message to suggest 'you are not anywhere' of git
2121
cd ..
2222
rm -fR $dst
2323
mv fluentd $dst
2424
cp td-agent.conf $dst
25+
if [ -f redhat/td-agent.conf.custom ]; then
26+
cp redhat/td-agent.conf.custom $dst
27+
fi
2528
cp td-agent.prelink.conf $dst
2629
cp Makefile.am $dst
2730
cp autogen.sh $dst
2831
cp configure.in $dst
2932
cp ./td-agent.logrotate $dst
33+
# locate pre-downloaded gems
34+
if [ -d plugin_gems ]; then
35+
mkdir -p $dst/plugins
36+
cp plugin_gems/*.gem $dst/plugins
37+
fi
3038
tar czf $dst.tar.gz $dst
3139
rm -fR $dst
3240

@@ -44,6 +52,10 @@ cp ../redhat/td-agent.spec SPECS
4452
mv ../$dst.tar.gz SOURCES
4553
# locate init.d script
4654
cp ../redhat/td-agent.init SOURCES
55+
# locate customized configuration file
56+
if [ -f ../redhat/td-agent.conf.custom ]; then
57+
cp ../redhat/td-agent.conf.custom SOURCES
58+
fi
4759
# build
4860
if [ -z "$rpm_dist" ]; then
4961
my_rpmbuild -v -ba --clean SPECS/td-agent.spec

redhat/td-agent.spec

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Vendor: Treasure Data, Inc.
99
URL: http://treasure-data.com/
1010
Source: %{name}-%{version}.tar.gz
1111
Source1: %{name}.init
12+
# Source2: %{name}.conf.custom
1213
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
1314

1415
Requires: /usr/sbin/useradd /usr/sbin/groupadd
@@ -36,7 +37,10 @@ BuildRequires: gcc gcc-c++ pkgconfig libtool openssl-devel readline-devel libxsl
3637
./autogen.sh
3738

3839
%configure
40+
make plugins
3941
make %{?_smp_mflags}
42+
# make extplugin EXTGEM=fluent-plugin-ping-message-0.1.0.gem
43+
# make extplugin EXTGEM=...
4044

4145
%install
4246
# cleanup first
@@ -118,11 +122,14 @@ fi
118122

119123
%files
120124
%defattr(-,root,root)
125+
%config(noreplace,missingok) %{_sysconfdir}/td-agent/td-agent.conf
121126
/usr/bin/td
122127
/usr/sbin/td-agent
123128
/usr/%{_lib}/fluent
124-
/etc/td-agent
129+
/etc/td-agent/td-agent.conf.tmpl
125130
/etc/init.d/td-agent
131+
/etc/td-agent/logrotate.d/td-agent.logrotate
132+
/etc/td-agent/prelink.conf.d/td-agent.conf
126133
/var/log/td-agent
127134

128135
%changelog

0 commit comments

Comments
 (0)