# Fedora 17 and later use vendorlibdir instead of sitelibdir (see https://fedoraproject.org/wiki/Packaging:Ruby?rd=Packaging/Ruby#Pure_Ruby_packages)
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
%global ruby_libdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorlibdir"]')
%else
%global ruby_libdir %(ruby -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']")
%endif
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
%global _with_systemd 1
%else
%global _with_systemd 0
%endif
Summary: Application Server for hosting Ruby code on any capable middleware
Name: mcollective
Version: 2.8.4
Release: 3%{?dist}
Group: System Environment/Daemons
License: ASL 2.0
URL: http://puppetlabs.com/mcollective/introduction/
Source0: http://downloads.puppetlabs.com/mcollective/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ruby >= 1.8
Requires: mcollective-common = %{version}-%{release}
Packager: Puppet Labs <info@puppetlabs.com>
BuildArch: noarch
%if 0%{?_with_systemd}
# Required for %%post, %%preun, %%postun
Requires: systemd
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
BuildRequires: systemd
%else
BuildRequires: systemd-units
%endif
%else
# Required for %%post and %%preun
Requires: chkconfig
# Required for %%preun and %%postun
Requires: initscripts
%endif
%description
The Marionette Collective:
Server for the mcollective Application Server
%package common
Summary: Common libraries for the mcollective clients and servers
Group: System Environment/Libraries
Requires: ruby >= 1.8
Requires: rubygems >= 1.3.7
Requires: rubygem-stomp
Requires: rubygem-json
%description common
The Marionette Collective:
Common libraries for the mcollective clients and servers
%package client
Summary: Client tools for the mcollective Application Server
Requires: mcollective-common = %{version}-%{release}
Group: Applications/System
%description client
The Marionette Collective:
Client tools for the mcollective Application Server
%prep
%setup -q -n %{name}-%{version}
%build
%install
rm -rf %{buildroot}
ruby install.rb --destdir=%{buildroot} --no-rdoc --sitelibdir=%{ruby_libdir} --plugindir=%{_libexecdir}/mcollective
%if 0%{?_with_systemd}
%{__install} -d -m0755 %{buildroot}%{_unitdir}
%{__install} -m0644 ext/redhat/mcollective.service %{buildroot}%{_unitdir}/mcollective.service
%else
%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/init.d
%if 0%{?suse_version}
%{__install} -m0755 mcollective.init %{buildroot}%{_sysconfdir}/init.d/mcollective
%else
%{__install} -m0755 ext/redhat/mcollective.init %{buildroot}%{_sysconfdir}/init.d/mcollective
%endif
%endif
%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/mcollective/plugin.d
%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/mcollective/ssl/clients
%clean
rm -rf %{buildroot}
%post
%if 0%{?_with_systemd}
if [ $1 -eq 1 ] ; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%else
/sbin/chkconfig --add mcollective || :
%endif
%postun
%if 0%{?_with_systemd}
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart mcollective.service >/dev/null 2>&1 || :
fi
%else
if [ "$1" -ge 1 ]; then
/sbin/service mcollective condrestart &>/dev/null || :
fi
%endif
%preun
%if 0%{?_with_systemd}
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable mcollective.service > /dev/null 2>&1 || :
/bin/systemctl stop mcollective.service > /dev/null 2>&1 || :
fi
%else
if [ "$1" = 0 ] ; then
/sbin/service mcollective stop > /dev/null 2>&1
/sbin/chkconfig --del mcollective || :
fi
%endif
%files common
%defattr(-, root, root, 0755)
%doc COPYING
%doc doc
%{ruby_libdir}/mcollective.rb
%{ruby_libdir}/mcollective
%dir %{_sysconfdir}/mcollective
%dir %{_sysconfdir}/mcollective/ssl
%config %{_sysconfdir}/mcollective/*.erb
%files client
%defattr(-, root, root, 0755)
%attr(0755, root, root)%{_bindir}/mco
%doc COPYING
%config(noreplace)%{_sysconfdir}/mcollective/client.cfg
%files
%defattr(-, root, root, 0755)
%doc COPYING
%attr(0755, root, root)%{_sbindir}/mcollectived
%if 0%{?_with_systemd}
%{_unitdir}/mcollective.service
%else
%{_sysconfdir}/init.d/mcollective
%endif
%config(noreplace)%{_sysconfdir}/mcollective/server.cfg
%config(noreplace)%{_sysconfdir}/mcollective/facts.yaml
%dir %{_sysconfdir}/mcollective/ssl/clients
%config(noreplace)%{_sysconfdir}/mcollective/plugin.d
%changelog
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Oct 30 2015 Adam Miller <maxamillion@fedoraproject.org> - 2.8.4-1
- Update to latest upstream
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Jul 21 2014 Steve Traylen <steve.traylen@cern.ch> - 2.5.3-2
- Correct bogus date in last commit.
* Mon Jul 21 2014 Steve Traylen <steve.traylen@cern.ch> - 2.5.3-1
- Upstream 2.5.3
* Wed Jun 11 2014 Steve Traylen <steve.traylen@cern.ch> - 2.5.2-1
- Upstream 2.5.2
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Feb 12 2014 Steve Traylen <steve.traylen@cern.ch> - 2.4.1-1
- Upstream 2.4.1
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Apr 17 2013 Vít Ondruch <vondruch@redhat.com> - 2.2.3-1
- Upstream to 2.2.3
- Add mcollective-rhbz#952970.patch
- rhbz#850200 Use new systemd rpm macros.
- rhbz#868417 Use deamonozie allways in configuration.
* Wed Mar 20 2013 Vít Ondruch <vondruch@redhat.com> - 2.2.0-3
- Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sat Sep 22 2012 Steve Traylen <steve.traylen@cern.ch> - 2.2.0-1
- Update to 2.2.0, add plugin.d directory to package, add missing
.erb help files.
* Wed Sep 5 2012 Steve Traylen <steve.traylen@cern.ch> - 2.0.0-6
- Fix rhbz#853574 in different way. 0644 client.cfg.
* Wed Sep 5 2012 Steve Traylen <steve.traylen@cern.ch> - 2.0.0-5
- Add mco unix group who can read client.cfg rhbz#853574
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue May 22 2012 Steve Traylen <steve.traylen@cern.ch> - 2.0.0-3
- Drop 0001-get-rid-of-vendor-libraries.patch and
0002-Don-t-enable-services-by-default.patch. vendor load falls
back to system path.
* Mon May 21 2012 Steve Traylen <steve.traylen@cern.ch> - 2.0.0-2
- Fix ExecReload in systemd file.
- Use alternate SysV start up file dropping lsb requires.
* Thu May 3 2012 Steve Traylen <steve.traylen@cern.ch> - 2.0.0-1
- New version.
* Fri Apr 27 2012 Steve Traylen <steve.traylen@cern.ch> - 1.3.3-5
- Finger trouble.
* Fri Apr 27 2012 Steve Traylen <steve.traylen@cern.ch> - 1.3.3-4
- Fix patch 0001 to stop loading verdor directory.
* Tue Apr 24 2012 Steve Traylen <steve.traylen@cern.ch> - 1.3.3-3
- Fix systemd start up file.
* Wed Apr 18 2012 Steve Traylen <steve.traylen@cern.ch> - 1.3.3-2
- Update to Fedora's new ruby guidelines.
* Tue Apr 17 2012 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.3-1
- 1.3.3
- see releasenotes: http://docs.puppetlabs.com/mcollective/releasenotes.html
* Fri Jan 13 2012 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.2-1
- 1.3.2
- see releasenotes: http://docs.puppetlabs.com/mcollective/releasenotes.html
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Dec 7 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.1-6
- Use sed instead of perl in build section
* Tue Dec 6 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.1-5
- Use patches instead of perl
- Remove included copy of systemu
* Mon Dec 5 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.1-4
- More work on keeping init scripts disabled by default
- reorder defattr and doc lines
* Thu Dec 1 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.1-3
- Don't enable SysV init script by default
- use sbindir macro for a few more things
- fix config(noreplace) flag
- default file attributes for EPEL
* Thu Nov 17 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.1-2
- Remove internal copy of JSON library
* Thu Nov 17 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.1-1
- Update to 1.3.1
* Thu Aug 18 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.3.0-1
- Update to 1.3.0
* Fri May 27 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.2.0-2
- Add mco script
* Mon May 23 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.2.0-1
- Update to 1.2.0
* Wed Apr 20 2011 Jeffrey Ollie <jeff@ocjtech.us> - 1.1.3-3
- First version for Fedora