A new user interface for you! Read more...

File puppet.spec of Package puppet-2.7

#
# 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
%if 0%{?rhel_version}
%global	rb_ver          %(ruby -rrbconfig -e 'puts Config::CONFIG["ruby_version"]')
%global puppet_libdir   %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]')
%else 
%global puppet_libdir   %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]') 
%endif


Name:           puppet
#BuildArch:      noarch
Version:        2.7.26 
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
Source5:	puppetagent.service
Source6:        puppet.conf
Source7:        puppet.init.d-redhat
Source8:        puppet-server.init.d-redhat
Source9:        puppet.init.d-suse
Source10:       puppet-server.init.d-suse
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0:         puppet-2.6.6-yumconf.diff
Requires:       facter >= 1.6.4
Requires:       ruby >= 1.8.7
%if 0%{?rhel_version}
Requires:       rubygem-ruby-shadow >= 2.1.4
%endif
%if 0%{?suse_version} != 1010
Requires:       rubygem-ruby-augeas >= 0.5.0
%endif
BuildRequires:  facter >= 1.6.11
BuildRequires:  fdupes
BuildRequires:  ruby >= 1.8.7
%if 0%{?suse_version} != 1010
BuildRequires:  rubygem-ruby-shadow
%endif
# not really required but we do not wanna own their folders
BuildRequires:  vim
BuildRequires:  emacs-nox

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
%endif
Requires(pre):  /usr/sbin/groupadd
Requires(pre):  /usr/sbin/useradd
%if 0%{?suse_version} >= 1210
BuildRequires:  systemd
%endif

%if 0%{?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
%if 0%{?suse_version}
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
%endif
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

%build

%install
ruby install.rb install --destdir=%{buildroot} --sitelibdir=%{puppet_libdir}
# Rename yumrepo.rb.orig to yumrepo.rb.old -> avoiding "not allowed anymore on SuSE Linux"
%if 0%{?suse_version}
#mv %{buildroot}/%{_libdir}/ruby/vendor_ruby/%{rb_ver}/puppet/type/yumrepo.rb.orig %{buildroot}/%{_libdir}/ruby/vendor_ruby/%{rb_ver}/puppet/type/yumrepo.rb.old
%endif
mkdir -p %{buildroot}%{_sysconfdir}/puppet
mkdir -p %{buildroot}%{_sysconfdir}/puppet/manifests
mkdir -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}%{_localstatedir}/lib/puppet
mkdir -p %{buildroot}%{_localstatedir}/lib/puppet/reports
mkdir -p %{buildroot}%{_localstatedir}/lib/puppet/yaml
mkdir -p %{buildroot}%{_localstatedir}/lib/puppet/bucket
mkdir -p %{buildroot}%{_localstatedir}/lib/puppet/server_data
mkdir -p %{buildroot}%{_localstatedir}/log/puppet
mkdir -p %{buildroot}/%{_fwdefdir}
%if 0%{?suse_version} >= 1210
mkdir -p %{buildroot}%{_unitdir}/system
%endif
mkdir -p %{buildroot}/usr/share/doc/puppet-%{version}
install -m0644 %{S:6} %{buildroot}%{_sysconfdir}/puppet/puppet.conf
install -m0644 conf/auth.conf %{buildroot}%{_sysconfdir}/puppet/auth.conf
%if 0%{?suse_version}
mkdir -p %{buildroot}%{_initddir}
install -m0755 %{S:9} %{buildroot}%{_sysconfdir}/init.d/puppet
install -m0755 %{S:10} %{buildroot}%{_sysconfdir}/init.d/puppetmasterd
%else
install -m0755 %{S:7} %{buildroot}%{_sysconfdir}/init.d/puppet
install -m0755 %{S:8} %{buildroot}%{_sysconfdir}/init.d/puppetmasterd
%endif
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 %{SOURCE5} %{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}

# puppet ext/ data
install -d -m0755 %{buildroot}%{puppet_libdir}/%{name}
install -d -m0755 %{buildroot}%{puppet_libdir}/%{name}/ext

# be specific, we don't need/want the OS specific stuff
for ii in \
    autotest \
    cert_inspector \
    dbfix.sql \
    envpuppet \
    ldap \
    logcheck \
    nagios \
    puppetlisten \
    puppet-load.rb \
    puppet-test \
    pure_ruby_dsl \
    rack \
    regexp_nodes \
    upload_facts.rb \
    yaml_nodes.rb 
do
    cp -a ext/$ii %{buildroot}%{puppet_libdir}/%{name}/ext
done
%if 0%{?rhel_version}
# Install vim syntax files
vimdir=%{buildroot}%{puppet_libdir}/vim/site
install -Dp -m0644 ext/vim/ftdetect/puppet.vim $vimdir/ftdetect/puppet.vim
install -Dp -m0644 ext/vim/syntax/puppet.vim $vimdir/syntax/puppet.vim

# Install emacs mode files
emacsdir=%{buildroot}%{puppet_libdir}/emacs/site-lisp
install -Dp -m0644 ext/emacs/puppet-mode.el $emacsdir/puppet-mode.el
install -Dp -m0644 ext/emacs/puppet-mode-init.el \
    $emacsdir/site-start.d/puppet-mode-init.el
%endif 

%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
%if 0%{?suse_version}
%stop_on_removal puppet
%endif 
%postun
%if 0%{?suse_version}
%restart_on_update puppet
%insserv_cleanup
%endif
%post
%if 0%{?suse_version}
%fillup_and_insserv
%endif 
%preun server
%if 0%{?suse_version}
%stop_on_removal puppetmasterd
%endif

%post server
%if 0%{?suse_version}
%fillup_and_insserv -f
%endif 
%postun server
%if 0%{?suse_version}
%restart_on_update puppetmasterd
%insserv_cleanup
%endif

%files
%defattr(-,root,root,-)
%doc LICENSE README.*
%{_bindir}/puppet
%{_bindir}/puppetdoc
%{_bindir}/filebucket
%{_bindir}/pi
%{_bindir}/ralsh
%{_sbindir}/puppetca
%{_sbindir}/puppetd
%{_sbindir}/puppetqd
%{_sbindir}/puppetrun
%{puppet_libdir}/puppet/
%{puppet_libdir}/puppet.rb
%{puppet_libdir}/semver.rb
%dir %{_sysconfdir}/puppet
%dir %{_sysconfdir}/puppet/manifests
%dir %{_localstatedir}/lib/puppet
%dir %{_localstatedir}/log/puppet
%attr(0750,puppet,puppet) %dir %{_localstatedir}/lib/puppet/reports
%attr(0750,puppet,puppet) %dir %{_localstatedir}/lib/puppet/yaml
%attr(0750,puppet,puppet) %dir %{_localstatedir}/lib/puppet/bucket
%attr(0750,puppet,puppet) %dir %{_localstatedir}/lib/puppet/server_data
# emacs-mode files
%if 0%{?rhel_version}
%{puppet_libdir}/emacs/site-lisp/puppet-mode.el
# emacs by default does not own it so we must own it...
%dir %{puppet_libdir}/emacs/site-lisp/site-start.d
%{puppet_libdir}/emacs/site-lisp/site-start.d/puppet-mode-init.el
# vim support files
%{puppet_libdir}/vim/site/ftdetect/puppet.vim
%{puppet_libdir}/vim/site/syntax/puppet.vim
%endif
# puppet extensions
%dir %{puppet_libdir}/%{name}
%dir %{puppet_libdir}/%{name}/ext
%{puppet_libdir}/%{name}/ext/autotest
%{puppet_libdir}/%{name}/ext/cert_inspector
%{puppet_libdir}/%{name}/ext/dbfix.sql
%{puppet_libdir}/%{name}/ext/envpuppet
%{puppet_libdir}/%{name}/ext/ldap
%{puppet_libdir}/%{name}/ext/logcheck
%{puppet_libdir}/%{name}/ext/nagios
%{puppet_libdir}/%{name}/ext/puppetlisten
%{puppet_libdir}/%{name}/ext/puppet-load.rb
%{puppet_libdir}/%{name}/ext/puppet-test
%{puppet_libdir}/%{name}/ext/pure_ruby_dsl
%{puppet_libdir}/%{name}/ext/rack
%{puppet_libdir}/%{name}/ext/regexp_nodes
%{puppet_libdir}/%{name}/ext/upload_facts.rb
%{puppet_libdir}/%{name}/ext/yaml_nodes.rb
#
%config(noreplace) %{_sysconfdir}/puppet/puppet.conf
%config(noreplace) %{_sysconfdir}/puppet/auth.conf
%{_mandir}/man?/*
%{_sysconfdir}/init.d/puppet
%{_sbindir}/rcpuppet
%config(noreplace) %{_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}/puppetmasterd
%{_sbindir}/rcpuppetmasterd
%{_sysconfdir}/init.d/puppetmasterd
%config(noreplace) %{_fwdefdir}/puppetmasterd
%{_localstatedir}/adm/fillup-templates/sysconfig.puppetmasterd
%if 0%{?suse_version} >= 1210
%{_unitdir}/system/puppetmaster.service
%endif

%changelog