Update version according to OSCI-883
[packages/precise/mcollective.git] / ext / redhat / mcollective.spec
1 # Fedora 17 and later use vendorlibdir instead of sitelibdir (see https://fedoraproject.org/wiki/Packaging:Ruby?rd=Packaging/Ruby#Pure_Ruby_packages)
2 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
3 %global         ruby_libdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorlibdir"]')
4 %else
5 %global         ruby_libdir %(ruby -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']")
6 %endif
7
8 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
9 %global         _with_systemd 1
10 %else
11 %global         _with_systemd 0
12 %endif
13
14 # VERSION is subbed out during rake package:srpm process
15 %global         realversion 2.3.3
16 %global         rpmversion 2.3.3
17
18 Summary:        Application Server for hosting Ruby code on any capable middleware
19 Name:           mcollective
20 Version:        %{rpmversion}
21 Release:        1%{?dist}
22 Group:          System Environment/Daemons
23 License:        ASL 2.0
24 URL:            http://puppetlabs.com/mcollective/introduction/
25 Source0:        http://downloads.puppetlabs.com/mcollective/%{name}-%{realversion}.tar.gz
26 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
27 BuildRequires:  ruby >= 1.8
28 Requires:       mcollective-common = %{version}-%{release}
29 Packager:       Puppet Labs <info@puppetlabs.com>
30 BuildArch:      noarch
31
32 %if 0%{?_with_systemd}
33 # Required for %%post, %%preun, %%postun
34 Requires:       systemd
35 %if 0%{?fedora} >= 18
36 BuildRequires:  systemd
37 %else
38 BuildRequires:  systemd-units
39 %endif
40 %else
41 # Required for %%post and %%preun
42 Requires:       chkconfig
43 # Required for %%preun and %%postun
44 Requires:       initscripts
45 %endif
46
47 %description
48 The Marionette Collective:
49
50 Server for the mcollective Application Server
51
52 %package common
53 Summary:        Common libraries for the mcollective clients and servers
54 Group:          System Environment/Libraries
55 Requires:       ruby >= 1.8
56 Requires:       rubygems
57 Requires:       rubygem-stomp
58
59 %description common
60 The Marionette Collective:
61
62 Common libraries for the mcollective clients and servers
63
64 %package client
65 Summary:        Client tools for the mcollective Application Server
66 Requires:       mcollective-common = %{version}-%{release}
67 Group:          Applications/System
68
69 %description client
70 The Marionette Collective:
71
72 Client tools for the mcollective Application Server
73
74 %prep
75 %setup -q -n %{name}-%{realversion}
76
77 %build
78
79 %install
80 rm -rf %{buildroot}
81
82 ruby install.rb --destdir=%{buildroot} --no-rdoc --sitelibdir=%{ruby_libdir} --plugindir=%{_libexecdir}/mcollective
83
84 %if 0%{?_with_systemd}
85 %{__install} -d -m0755  %{buildroot}%{_unitdir}
86 %{__install} -m0644 ext/redhat/mcollective.service %{buildroot}%{_unitdir}/mcollective.service
87 %else
88 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/init.d
89 %if 0%{?suse_version}
90 %{__install} -m0755 mcollective.init %{buildroot}%{_sysconfdir}/init.d/mcollective
91 %else
92 %{__install} -m0755 ext/redhat/mcollective.init %{buildroot}%{_sysconfdir}/init.d/mcollective
93 %endif
94 %endif
95
96 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/mcollective/plugin.d
97 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/mcollective/ssl/clients
98
99 %clean
100 rm -rf %{buildroot}
101
102 %post
103 %if 0%{?_with_systemd}
104 if [ $1 -eq 1 ] ; then
105     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
106 fi
107 %else
108 /sbin/chkconfig --add mcollective || :
109 %endif
110
111 %postun
112 %if 0%{?_with_systemd}
113 if [ $1 -ge 1 ] ; then
114     # Package upgrade, not uninstall
115     /bin/systemctl try-restart mcollective.service >/dev/null 2>&1 || :
116 fi
117 %else
118 if [ "$1" -ge 1 ]; then
119   /sbin/service mcollective condrestart &>/dev/null || :
120 fi
121 %endif
122
123 %preun
124 %if 0%{?_with_systemd}
125 if [ $1 -eq 0 ] ; then
126     # Package removal, not upgrade
127     /bin/systemctl --no-reload disable mcollective.service > /dev/null 2>&1 || :
128     /bin/systemctl stop mcollective.service > /dev/null 2>&1 || :
129 fi
130 %else
131 if [ "$1" = 0 ] ; then
132   /sbin/service mcollective stop > /dev/null 2>&1
133   /sbin/chkconfig --del mcollective || :
134 fi
135 %endif
136
137 %files common
138 %defattr(-, root, root, 0755)
139 %doc COPYING
140 %doc doc
141 %{ruby_libdir}/mcollective.rb
142 %{ruby_libdir}/mcollective
143 %{_libexecdir}/mcollective/mcollective
144 %dir %{_sysconfdir}/mcollective
145 %dir %{_sysconfdir}/mcollective/ssl
146 %config %{_sysconfdir}/mcollective/*.erb
147
148 %files client
149 %defattr(-, root, root, 0755)
150 %attr(0755, root, root)%{_sbindir}/mc-call-agent
151 %attr(0755, root, root)%{_bindir}/mco
152 %doc COPYING
153 %config(noreplace)%{_sysconfdir}/mcollective/client.cfg
154 %{_libexecdir}/mcollective/mcollective/application
155 %{_libexecdir}/mcollective/mcollective/pluginpackager
156
157 %files
158 %defattr(-, root, root, 0755)
159 %doc COPYING
160 %attr(0755, root, root)%{_sbindir}/mcollectived
161 %if 0%{?_with_systemd}
162 %{_unitdir}/mcollective.service
163 %else
164 %{_sysconfdir}/init.d/mcollective
165 %endif
166 %config(noreplace)%{_sysconfdir}/mcollective/server.cfg
167 %config(noreplace)%{_sysconfdir}/mcollective/facts.yaml
168 %dir %{_sysconfdir}/mcollective/ssl/clients
169 %config(noreplace)%{_sysconfdir}/mcollective/plugin.d
170
171 %changelog
172 * Fri Nov 15 2013 Puppet Labs Release <info@puppetlabs.com> -  2.3.3-1
173 - Build for 2.3.3
174
175 * Tue Nov 03 2009 R.I.Pienaar <rip@devco.net>
176 - First release