-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrubygem-chef-solr.spec
153 lines (121 loc) · 4.46 KB
/
rubygem-chef-solr.spec
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Generated from chef-solr-0.10.0.rc.1.gem by gem2rpm -*- rpm-spec -*-
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%define gemname chef-solr
#%define prerelease
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}%{?prerelease}
Summary: Search indexing for Chef
Name: rubygem-%{gemname}
Version: 10.16.4
Release: 1%{?buildstamp}%{?dist}
Group: Development/Languages
License: GPLv2+ or Ruby
URL: http://wiki.opscode.com/display/chef
Source0: http://rubygems.org/downloads/%{gemname}-%{version}%{?prerelease}.gem
Source1: chef-solr.init
Source2: chef-solr.sysconfig
Source3: chef-solr.logrotate
Source4: config.rb
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: rubygems
Requires: rubygem(chef) = %{version}%{?prerelease}
BuildRequires: rubygems
BuildArch: noarch
Provides: rubygem(%{gemname}) = %{version}%{?prerelease}
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
Requires(postun): initscripts
%description
Search indexing for Chef
%prep
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{gemdir}
mkdir -p %{buildroot}/etc/rc.d/init.d
mkdir -p %{buildroot}/var/log/chef
mkdir -p %{buildroot}%{_sysconfdir}/chef
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig/
mkdir -p %{buildroot}/var/run/chef
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
gem install --local --install-dir %{buildroot}%{gemdir} \
--force --rdoc %{SOURCE0}
mkdir -p %{buildroot}/%{_bindir}
mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir}
rmdir %{buildroot}%{gemdir}/bin
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
cp %{SOURCE1} %{buildroot}/etc/rc.d/init.d/chef-solr
chmod +x %{buildroot}/etc/rc.d/init.d/chef-solr
cp %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/chef-solr
cp %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/chef-solr
cp %{SOURCE4} %{buildroot}%{_sysconfdir}/chef/solr.rb
%clean
rm -rf %{buildroot}
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add chef-solr
if [ -z "`/usr/bin/id chef 2> /dev/null`" ]; then
%{_sbindir}/adduser chef >/dev/null 2>&1
chown -R chef %{_sysconfdir}/chef
fi
# Run chef-solr-installer for the first time
if ! [ -d /var/chef/solr/data ]; then
chef-solr-installer > /dev/null 2>&1
fi
%preun
if [ $1 -eq 0 ] ; then
/sbin/service chef-solr >/dev/null 2>&1
/sbin/chkconfig --del chef-solr
fi
%postun
if [ "$1" -ge "1" ] ; then
/sbin/service chef-solr restart >/dev/null 2>&1 || :
fi
%files
%defattr(-, root, root, -)
%{_bindir}/chef-solr
%{_bindir}/chef-solr-installer
%{gemdir}/gems/%{gemname}-%{version}%{?prerelease}/
%doc %{gemdir}/doc/%{gemname}-%{version}%{?prerelease}
%{gemdir}/cache/%{gemname}-%{version}%{?prerelease}.gem
%{gemdir}/specifications/%{gemname}-%{version}%{?prerelease}.gemspec
%config(noreplace) %{_sysconfdir}/sysconfig/chef-solr
%config(noreplace) %{_sysconfdir}/logrotate.d/chef-solr
%config(noreplace) %{_sysconfdir}/chef/solr.rb
%{_sysconfdir}/rc.d/init.d/chef-solr
%changelog
- bumped version 10.16.2
- bumped version 10.14.2
- bumped version 10.14.0
- bumped version 10.12.0
- bumped version 0.10.6
- preparing for 0.10.4
- updated release version format
- added buildstamp to release
- depend on 0.10.2 chef gems
- upstream update
- solr data now stored in /var/chef
- upstream update
- upstream update
- add init script
- create default dirs
- add logrotate and solr.rb configs
- create chef user
- Initial package