Update code from https://github.com/dmi-try/marionette-collective
[packages/precise/mcollective.git] / ext / redhat / mcollective.spec
1 %{!?ruby_sitelib: %global ruby_sitelib %(ruby -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']")}
2 %define release %{rpm_release}%{?dist}
3
4 Summary: Application Server for hosting Ruby code on any capable middleware
5 Name: mcollective
6 Version: %{version}
7 Release: %{release}
8 Group: System Environment/Daemons
9 License: ASL 2.0
10 URL: http://puppetlabs.com/mcollective/introduction/
11 Source0: http://downloads.puppetlabs.com/mcollective/%{name}-%{version}.tgz
12 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
13 Requires: mcollective-common = %{version}-%{release}
14 Packager: R.I.Pienaar <rip@devco.net>
15 BuildArch: noarch
16
17 %package common
18 Summary: Common libraries for the mcollective clients and servers
19 Group: System Environment/Libraries
20 Requires: ruby
21 Requires: ruby(abi) >= 1.8
22 Requires: rubygems
23 Requires: rubygem(stomp)
24
25 %description common
26 The Marionette Collective:
27
28 Common libraries for the mcollective clients and servers
29
30 %package client
31 Summary: Client tools for the mcollective Application Server
32 Requires: mcollective-common = %{version}-%{release}
33 Group: Applications/System
34
35 %description client
36 The Marionette Collective:
37
38 Client tools for the mcollective Application Server
39
40 %description
41 The Marionette Collective:
42
43 Server for the mcollective Application Server
44
45 %prep
46 %setup -q
47
48 %build
49
50 %install
51 rm -rf %{buildroot}
52 %{__install} -d -m0755  %{buildroot}/%{ruby_sitelib}/mcollective
53 %{__install} -d -m0755  %{buildroot}%{_bindir}
54 %{__install} -d -m0755  %{buildroot}%{_sbindir}
55 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/init.d
56 %{__install} -d -m0755  %{buildroot}%{_libexecdir}/mcollective/
57 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/mcollective
58 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/mcollective/plugin.d
59 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/mcollective/ssl
60 %{__install} -d -m0755  %{buildroot}%{_sysconfdir}/mcollective/ssl/clients
61 %{__install} -m0755 bin/mcollectived %{buildroot}%{_sbindir}/mcollectived
62 %{__install} -m0640 etc/server.cfg.dist %{buildroot}%{_sysconfdir}/mcollective/server.cfg
63 %{__install} -m0644 etc/client.cfg.dist %{buildroot}%{_sysconfdir}/mcollective/client.cfg
64 %{__install} -m0444 etc/facts.yaml.dist %{buildroot}%{_sysconfdir}/mcollective/facts.yaml
65 %{__install} -m0444 etc/rpc-help.erb %{buildroot}%{_sysconfdir}/mcollective/rpc-help.erb
66 %{__install} -m0444 etc/data-help.erb %{buildroot}%{_sysconfdir}/mcollective/data-help.erb
67 %{__install} -m0444 etc/discovery-help.erb %{buildroot}%{_sysconfdir}/mcollective/discovery-help.erb
68 %{__install} -m0444 etc/metadata-help.erb %{buildroot}%{_sysconfdir}/mcollective/metadata-help.erb
69 %{__install} -m0444 etc/msg-help.erb %{buildroot}%{_sysconfdir}/mcollective/msg-help.erb
70 %if 0%{?suse_version}
71 %{__install} -m0755 mcollective.init %{buildroot}%{_sysconfdir}/init.d/mcollective
72 %else
73 %{__install} -m0755 ext/redhat/mcollective.init %{buildroot}%{_sysconfdir}/init.d/mcollective
74 %endif
75
76
77 cp -R lib/* %{buildroot}/%{ruby_sitelib}/
78 cp -R plugins/* %{buildroot}%{_libexecdir}/mcollective/
79 cp bin/mc-* %{buildroot}%{_sbindir}/
80 cp bin/mco %{buildroot}%{_bindir}/
81 chmod 0755 %{buildroot}%{_sbindir}/*
82
83 %clean
84 rm -rf %{buildroot}
85
86 %post
87 /sbin/chkconfig --add mcollective || :
88
89 %postun
90 if [ "$1" -ge 1 ]; then
91   /sbin/service mcollective condrestart &>/dev/null || :
92 fi
93
94 %preun
95 if [ "$1" = 0 ] ; then
96   /sbin/service mcollective stop > /dev/null 2>&1
97   /sbin/chkconfig --del mcollective || :
98 fi
99
100 %files common
101 %doc COPYING
102 %{ruby_sitelib}/mcollective.rb
103 %{ruby_sitelib}/mcollective
104 %{_libexecdir}/mcollective/mcollective
105 %dir %{_sysconfdir}/mcollective
106 %dir %{_sysconfdir}/mcollective/ssl
107 %config %{_sysconfdir}/mcollective/*.erb
108
109 %files client
110 %attr(0755, root, root)%{_sbindir}/mc-call-agent
111 %attr(0755, root, root)%{_bindir}/mco
112 %doc COPYING
113 %config(noreplace)%{_sysconfdir}/mcollective/client.cfg
114 %{_libexecdir}/mcollective/mcollective/application
115 %{_libexecdir}/mcollective/mcollective/pluginpackager
116
117 %files
118 %doc COPYING
119 %{_sbindir}/mcollectived
120 %{_sysconfdir}/init.d/mcollective
121 %config(noreplace)%{_sysconfdir}/mcollective/server.cfg
122 %config(noreplace)%{_sysconfdir}/mcollective/facts.yaml
123 %dir %{_sysconfdir}/mcollective/ssl/clients
124 %config(noreplace)%{_sysconfdir}/mcollective/plugin.d
125
126 %changelog
127 * Tue Nov 03 2009 R.I.Pienaar <rip@devco.net>
128 - First release