File puppet.spec of Package puppet
#
# spec file for package puppet
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# backward compatible requirement SLE...
%{?!_initddir:%define _initddir %_initrddir}
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
Name: puppet
Version: 3.0.2
Release: 0
Summary: A network tool for managing many disparate systems
License: Apache-2.0
Group: Productivity/Networking/System
Url: http://puppetlabs.com/puppet/what-is-puppet/
Source: http://downloads.puppetlabs.com/puppet/%{name}-%{version}.tar.gz
Source1: puppetmaster.fw
Source2: puppet.fw
Source3: puppet.sysconfig
Source4: puppetmasterd.sysconfig
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0: puppet-2.6.6-yumconf.diff
# PATCH-FIX-OPENSUSE puppet-3.0.2-init.diff aeszter@gwdg.de
Patch1: puppet-3.0.2-init.patch
Obsoletes: hiera-puppet < 1.0.0
Provides: hiera-puppet >= 1.0.0
Requires: facter >= 1.6.4
Requires: rubygem-hiera >= 1.0.0
Requires: ruby >= 1.8.7
Requires: rubygem-ruby-shadow >= 2.1.4
BuildRequires: facter >= 1.6.11
BuildRequires: fdupes
BuildRequires: ruby >= 1.8.7
BuildRequires: rubygem-hiera >= 1.0.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(pre): %fillup_prereq
Requires(pre): %insserv_prereq
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%endif
%if %suse_version > 1220
%define _unitdir /usr/lib/systemd
%else
%define _unitdir /lib/systemd
%endif
%description
Puppet lets you centrally manage every important aspect of your system
using a cross-platform specification language that manages all the
separate elements normally aggregated in different files, like users,
cron jobs, and hosts, along with obviously discrete elements like
packages, services, and files.
%package server
Summary: A network tool for managing many disparate systems
Group: Productivity/Networking/System
Requires(pre): %fillup_prereq
Requires(pre): %insserv_prereq
Requires(pre): puppet = %{version}
%description server
Puppet lets you centrally manage every important aspect of your system
using a cross-platform specification language that manages all the
separate elements normally aggregated in different files, like users,
cron jobs, and hosts, along with obviously discrete elements like
packages, services, and files.
%prep
%setup -q
%patch0
%patch1
%build
%install
ruby install.rb install --destdir=%{buildroot} --sitelibdir=%{_libdir}/ruby/vendor_ruby/%{rb_ver}
mkdir -p %{buildroot}%{_sysconfdir}/puppet
mkdir -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}%{_localstatedir}/lib/puppet
mkdir -p %{buildroot}%{_localstatedir}/log/puppet
mkdir -p %{buildroot}/%{_fwdefdir}
%if 0%{?suse_version} >= 1210
mkdir -p %{buildroot}%{_unitdir}/system
%endif
install -m0644 ext/redhat/puppet.conf %{buildroot}%{_sysconfdir}/puppet/puppet.conf
install -m0644 conf/auth.conf %{buildroot}%{_sysconfdir}/puppet/auth.conf
install -m0755 ext/suse/client.init %{buildroot}%{_initddir}/puppet
install -m0755 ext/suse/server.init %{buildroot}%{_initddir}/puppetmasterd
ln -sf ../../etc/init.d/puppet %{buildroot}/%{_sbindir}/rcpuppet
ln -sf ../../etc/init.d/puppetmasterd %{buildroot}/%{_sbindir}/rcpuppetmasterd
install -m 644 %{SOURCE1} %{buildroot}/%{_fwdefdir}/puppetmasterd
install -m 644 %{SOURCE2} %{buildroot}/%{_fwdefdir}/puppet
%if 0%{?suse_version} >= 1210
install -m 644 ext/systemd/puppetagent.service %{buildroot}%{_unitdir}/system/puppetagent.service
install -m 644 ext/systemd/puppetmaster.service %{buildroot}%{_unitdir}/system/puppetmaster.service
%endif
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
cp %{SOURCE3} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.puppet
cp %{SOURCE4} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.puppetmasterd
%fdupes -s %{buildroot}/%{_mandir}
%pre
getent group puppet >/dev/null || /usr/sbin/groupadd -r puppet
getent passwd puppet >/dev/null || /usr/sbin/useradd -r -g puppet -d /var/lib/puppet -s /bin/false -c "Puppet daemon" puppet
%preun
%stop_on_removal puppet
%postun
%restart_on_update puppet
%insserv_cleanup
%post
%fillup_and_insserv
%preun server
%stop_on_removal puppetmasterd
%post server
%fillup_and_insserv -f
%postun server
%restart_on_update puppetmasterd
%insserv_cleanup
%files
%defattr(-,root,root,-)
%doc LICENSE README.*
%{_bindir}/puppet
%{_bindir}/extlookup2hiera
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/puppet/
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/hiera/
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/hiera_puppet.rb
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/puppet.rb
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/semver.rb
%dir %{_sysconfdir}/puppet
%dir %{_localstatedir}/lib/puppet
%dir %{_localstatedir}/log/puppet
%config %{_sysconfdir}/puppet/puppet.conf
%config %{_sysconfdir}/puppet/auth.conf
%{_mandir}/man?/*
%{_sysconfdir}/init.d/puppet
%{_sbindir}/rcpuppet
%config %{_fwdefdir}/puppet
%{_localstatedir}/adm/fillup-templates/sysconfig.puppet
%if 0%{?suse_version} >= 1210
%{_unitdir}/system/puppetagent.service
%endif
%files server
%defattr(-, root, root, 0755)
%dir %attr(755,root,root)
%{_sbindir}/rcpuppetmasterd
%{_sysconfdir}/init.d/puppetmasterd
%config %{_fwdefdir}/puppetmasterd
%{_localstatedir}/adm/fillup-templates/sysconfig.puppetmasterd
%if 0%{?suse_version} >= 1210
%{_unitdir}/system/puppetmaster.service
%endif
%changelog