%{!?python_version: %define python_version %(%{__python} -c "from distutils.sysconfig import get_python_version; print get_python_version()")}
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
Summary: Remote management framework
Name: func
Version: 0.30
Release: 13%{?dist}
Source0: https://git.fedorahosted.org/cgit/func.git/snapshot/%{name}-%{version}.tar.gz
Source1: funcd.service
Source2: %{name}.logrotate-init
Source3: %{name}.logrotate-service
License: GPLv2+
Group: Applications/System
Requires: python2 >= 2.3
Requires: python2-pyOpenSSL
Requires: python2-simplejson
Requires: certmaster >= 0.28
Requires: logrotate
BuildRequires: python2-devel
%if %is_suse
BuildRequires: gettext-devel
%else
BuildRequires: python2-setuptools
%endif
%if 0%{?fedora} >= 16 && 0%{?fedora} < 18
BuildRequires: systemd-units
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%endif
BuildArch: noarch
Url: https://fedorahosted.org/func/
%description
func is a remote api for mangement, configuration, and monitoring of systems.
%prep
%setup -q
%build
%{__python} setup.py build
%install
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --prefix=/usr --root=$RPM_BUILD_ROOT
touch $RPM_BUILD_ROOT/var/log/func/func.log
touch $RPM_BUILD_ROOT/var/log/func/audit.log
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 755 init-scripts/funcd $RPM_BUILD_ROOT%{_sysconfdir}/init.d/funcd
rm -f $RPM_BUILD_ROOT/etc/logrotate.d/func_rotate
install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/func
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
install -D -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/funcd.service
rm -rf $RPM_BUILD_ROOT/etc/init.d
install -D -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/func
%endif
# Convert everything to UTF-8
iconv -f iso-8859-1 -t utf-8 -o CHANGES.utf8 CHANGES
touch -r CHANGES CHANGES.utf8; mv -f CHANGES.utf8 CHANGES
%files
%defattr(-, root, root, -)
%if "%{python_version}" >= "2.5"
%{python_sitelib}/func*.egg-info
%endif
# Conditionally include funcd.
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
%{_unitdir}/funcd.service
%else
%{_sysconfdir}/init.d/funcd
%endif
%{_bindir}/funcd
%{_bindir}/func
%{_bindir}/func-inventory
%{_bindir}/func-create-module
%{_bindir}/func-transmit
%{_bindir}/func-build-map
%{_bindir}/func-command
%{_bindir}/func-down-hosts
%{_bindir}/func-find-user
%{_bindir}/func-grep
%{_bindir}/func-list-vms-per-host
%{_bindir}/func-ps-compare
%{_bindir}/func-whatsmyname
%{_bindir}/func-yum
%{_bindir}/func-group
#%{_bindir}/update-func
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/minion-acl.d/
%dir /etc/func/modules/
%config(noreplace) /etc/func/minion.conf
%config(noreplace) /etc/func/async_methods.conf
%config(noreplace) /etc/func/overlord.conf
%config(noreplace) /etc/logrotate.d/func
%config(noreplace) /etc/func/modules/Test.conf
%config(noreplace) /etc/func/modules/Bridge.conf
%config(noreplace) /etc/func/modules/Vlan.conf
%config /etc/func/version
%dir %{python_sitelib}/func
%dir %{python_sitelib}/func/minion
%dir %{python_sitelib}/func/minion/facts
%dir %{python_sitelib}/func/minion/facts/modules
%dir %{python_sitelib}/func/minion/modules/iptables
%dir %{python_sitelib}/func/overlord
%dir %{python_sitelib}/func/overlord/cmd_modules
%dir %{python_sitelib}/func/overlord/group
%dir %{python_sitelib}/func/overlord/modules
%dir %{python_sitelib}/func/yaml
%{python_sitelib}/func/minion/*.py*
%{python_sitelib}/func/minion/facts/*.py*
%{python_sitelib}/func/minion/facts/modules/*.py*
%{python_sitelib}/func/overlord/*.py*
%{python_sitelib}/func/overlord/cmd_modules/*.py*
%{python_sitelib}/func/overlord/group/*.py*
%{python_sitelib}/func/overlord/modules/*.py*
%{python_sitelib}/func/yaml/*.py*
%{python_sitelib}/func/*.py*
%dir %{python_sitelib}/func/minion/modules
%{python_sitelib}/func/minion/modules/*.py*
# we need to make the spec and setup.py find modules
# in deep dirs automagically
%dir %{python_sitelib}/func/minion/modules/netapp
%dir %{python_sitelib}/func/minion/modules/netapp/vol
%{python_sitelib}/func/minion/modules/*/*.py*
%{python_sitelib}/func/minion/modules/*/*/*.py*
%dir /var/log/func
%attr(0600,root,root) %config %ghost %verify(not md5 size mtime) /var/log/func/func.log
%attr(0600,root,root) %config %ghost %verify(not md5 size mtime) /var/log/func/audit.log
%dir /var/lib/func
#%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/log/prelink/prelink.log
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc AUTHORS README CHANGES
%{_mandir}/man1/func.1.gz
%{_mandir}/man1/func-inventory.1.gz
%{_mandir}/man1/funcd.1.gz
%{_mandir}/man1/func-transmit.1.gz
%{_mandir}/man1/func-build-map.1.gz
%{_mandir}/man1/func-create-module.1.gz
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%post
%systemd_post funcd.service
test -e /var/log/func/func.log || touch /var/log/func/func.log
test -e /var/log/func/audit.log || touch /var/log/func/audit.log
chmod 600 /var/log/func/func.log /var/log/func/audit.log
%preun
%systemd_preun funcd.service
%postun
%systemd_postun_with_restart funcd.service
%else
%post
# systemd
if [ -x /bin/systemctl ]; then
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
fi
# for suse
if [ -x /usr/lib/lsb/install_initd ]; then
/usr/lib/lsb/install_initd /etc/init.d/funcd
# for red hat distros
elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --add funcd
# or, the old fashioned way
else
for i in 2 3 4 5; do
ln -sf /etc/init.d/funcd /etc/rc.d/rc${i}.d/S99funcd
done
for i in 1 6; do
ln -sf /etc/init.d/funcd /etc/rc.d/rc${i}.d/k01funcd
done
fi
test -e /var/log/func/func.log || touch /var/log/func/func.log
test -e /var/log/func/audit.log || touch /var/log/func/audit.log
chmod 600 /var/log/func/func.log /var/log/func/audit.log
# upgrade old installs if needed
#/usr/bin/update-func
exit 0
%preun
if [ "$1" = 0 ] ; then
/etc/init.d/funcd stop > /dev/null 2>&1
if [ -x /bin/systemctl ]; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable funcd.service > /dev/null 2>&1 || :
/bin/systemctl stop funcd.service > /dev/null 2>&1 || :
elif [ -x /usr/lib/lsb/remove_initd ]; then
/usr/lib/lsb/remove_initd /etc/init.d/funcd
elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --del funcd
else
rm -f /etc/rc.d/rc?.d/???funcd
fi
fi
%postun
if [ -x /bin/systemctl ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart funcd.service >/dev/null 2>&1 || :
fi
fi
%if 0%{?fedora} >= 16
%triggerun -- func < 0.28-2
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply funcd
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save funcd >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del funcd >/dev/null 2>&1 || :
/bin/systemctl try-restart funcd.service >/dev/null 2>&1 || :
%endif
%endif
%changelog
* Wed Feb 14 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.30-13
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.30-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.30-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.30-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.30-9
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Fri Apr 22 2016 Robert Scheck <robert@fedoraproject.org> - 0.30-8
- Fix daemon restarts via logrotate for initscripts and systemd
- Avoid creating log files ending with .rpmnew or .rpmsave (#695428)
- Own all directories for func python modules (#894534)
- Do not try to run SysV initscripts on Fedora >= 18 (#915092)
- Add macro conditionals for Red Hat Enterprise Linux 7 (#1164784)
- Introduce new systemd-rpm macros in func spec file (#850055)
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.30-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.30-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Jun 30 2014 Toshio Kuratomi <toshio@fedoraproject.org> - 0.30-5
- Replace python-setuptools-devel BR with python-setuptools
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.30-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.30-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.30-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Mon Oct 15 2012 Steve Salevan <ssalevan at fedoraproject.org> - 0.30-1
- v0.30 release:
- Added copyfile improvements
- Improvements to all func-* scripts
- Delegation improvements
- Stability improvements
- Removing dependency on smolt
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.28-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.28-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Fri Sep 9 2011 Tom Callaway <spot@fedoraproject.org> - 0.28-2
- convert to systemd
* Thu Mar 31 2011 Seth Vidal <skvidal at fedoraproject.org> - 0.28-1
- 0.28
* Fri Oct 8 2010 Seth Vidal <skvidal at fedoraproject.org> - 0.27-2
- add func-commands and func-yum
* Wed Aug 25 2010 Seth Vidal <skvidal at fedoraproject.org> - 0.27-1
- bump to 0.27
* Wed Sep 9 2009 Adrian Likins <alikins@redhat.com> - 0.26-1
- require smolt (should be there on most stuff we support, and
hardware module is lame without it)
* Thu Aug 26 2009 Adrian Likins <alikins@redhat.com> - 0.26-1
- rev
* Thu Aug 20 2009 Adrian Likins <alikins@redhat.com> - 0.25-2
- add func-group
* Thu Jun 11 2009 Adrian Likins <alikins@redhat.com> - 0.25-1
- add /etc/func/version
* Wed Jun 10 2009 Adrian Likins <alikins@redhat.com> - 0.25-1
- add CHANGES to spec file
* Wed May 27 2009 Adrian Likins <alikins@redhat.com> - 0.25-1
- add /var/log/func/*.log files to spec
- add a post section to chmod any log files with bogus perms
* Thu Apr 16 2009 Adrian Likins <alikins@redhat.com> - 0.24-5
- add an overlord.conf file
* Wed Feb 18 2009 Adrian Likins <alikins@redhat.com> - 0.24-5
- remove version file
* Mon Jan 19 2009 Adrian Likins <alikins@redhat.com> - 0.24.4
- make inclusion of egginfo dependant on having python >= 2.5
- remove need for patch on rhel3+python2.4 cases (distutils should
do all the /usr/bin/python renaming now)
- minor reformatting changes
* Tue Jan 06 2009 Greg Swift <gregswift@gmail.com> - 0.24-3
- Fixed spec because it was only building in rhel3
* Wed Dec 31 2008 Greg Swift <gregswift@gmail.com> - 0.24-2
- Patched SPEC to build on rhel3 with python2.3
- Added Patch0 to handle python2.3 if on rhel3
* Wed Dec 17 2008 Adrian Likins <alikins@redhat.com> - 0.24-1
- require certmaster 0.24
* Mon Dec 8 2008 Adrian Likins <alikins@redhat.com> - 0.24-1
- claim ownership of all dirs bz#474644
- add dep on logrotate
* Fri Jul 18 2008 Adrian Likins <alikins@redhat.com> - 0.23-2
- remove requirement for pyyaml, add python-simplejson
* Fri Jul 11 2008 Michael DeHaan <mdehaan@redhat.com> - 0.23-1
- (for ssalevan) adding in mapping/delegation tools
* Mon Jul 07 2008 Michael DeHaan <mdehaan@redhat.com> - 0.22-1
- packaged func-transmit script
* Wed Jul 02 2008 Michael DeHaan <mdehaan@redhat.com> - 0.21-1
- new release, upstream changes
* Mon Jun 30 2008 Michael DeHaan <mdehaan@redhat.com> - 0.20-1
- new release, upstream changes
* Fri Jun 28 2008 Adrian Likins <alikins@redhat.com> - 0.18-2
- fix fedora bug #441283 - typo in postinstall scriptlet
(the init.d symlinks for runlevels 1 and 6 were created wrong)
* Mon Mar 03 2008 Adrian Likins <alikins@redhat.com> - 0.18-1
- split off certmaster
* Fri Feb 8 2008 Michael DeHaan <mdehaan@redhat.com> - 0.17-1
- bugfix release
* Mon Feb 4 2008 Michael DeHaan <mdehaan@redhat.com> - 0.16-1
- bump version for release
- fixing versions in previous changelogs
* Mon Feb 4 2008 Adrian Likins <alikins@redhat.com> - 0.15-1
- catch some deeper minion modules as well
* Sun Jan 13 2008 Steve 'Ashcrow' Milner <smilner@redhat.como> - 0.14-6
- Added in func-create-module for scripts.
* Tue Dec 18 2007 Adrian Likins <alikins@redhat.com> - 0.14-5
- add /var/lib/ dirs to spec file
* Thu Dec 13 2007 Eli Criffield <elicriffield@gmail.com> - 0.14-4
- changes for suse integration
* Tue Dec 11 2007 Michael DeHaan <mdehaan@redhat.com> - 0.14-2
- python egg section added for F9 and later
* Tue Dec 11 2007 Michael DeHaan <mdehaan@redhat.com> - 0.14-1
- new release to mirrors
* Fri Oct 26 2007 Michael DeHaan <mdehaan@redhat.com> - 0.13-3
- Misc fixes per Fedora package-review
* Wed Oct 24 2007 Michael DeHaan <mdehaan@redhat.com> - 0.13-2
- packaged func-inventory and associated manpage
- release bump for Fedora submission