File etckeeper.spec of Package etckeeper

# vim: set sw=4 ts=4 et nu:
# spec file for package etckeeper
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2014 Mitsutoshi NAKANO <>
# Copyright (c) 2013 Pascal Bleser <>
# 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

# see
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
Name:           etckeeper
Version:        1.18.7
Release:        0
Summary:        Store /etc under Version Control
License:        GPL-2.0+
Group:          System/Management
# PATCH-FIX-UPSTREAM etckeeper-avoid-packagelist.patch gh#joeyh/etckeeper#17 -- add AVOID_PACKAGELIST
Patch0:         etckeeper-avoid-packagelist.patch
# PATCH-FIX-UPSTREAM 0001-Remove-env-from-shebang-in-zypper-plugin.patch
Patch1:         0001-Remove-env-from-shebang-in-zypper-plugin.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define LPM rpm
Requires:       python-base >= 2.7
BuildRequires:  make
# added for bzr 2014-07-10
BuildRequires:  bzr
BuildRequires:  python-devel

%if 0%{?suse_version}
# modified 2014-07-09
# Users should be able to select VCS.
Recommends:     git
Recommends:     %{name}-cron = %{version}-%{release}
Recommends:     %{name}-zypp-plugin = %{version}-%{release}
BuildRequires:  libzypp
%define HPM zypper
BuildRequires:  yum
Requires:       %{name}-cron = %{version}-%{release}
Requires:       %{name}-yum-plugin = %{version}-%{release}
%define HPM yum

The etckeeper program is a tool to let /etc be stored in a git,
mercurial, bzr or darcs repository. It hooks into yum to automatically
commit changes made to /etc during package upgrades. It tracks file
metadata that version control systems do not normally support, but that
is important for /etc, such as the permissions of /etc/shadow. It is
quite modular and configurable, while also being simple to use if you
understand the basics of working with version control.

%package cron
Summary:        The etckeeper cron function
Group:          System/Management
Requires:       etckeeper = %{version}-%{release}
Provides:       etckeeper:%{_sysconfdir}/cron.daily/etckeeper
%if 0%{?suse_version}
Requires:       cron
Requires:       crontabs

%description cron
The etckeeper-cron calls etckeeper from cron.

%if 0%{?suse_version}
%package zypp-plugin
Summary:        The etckeeper integration function with ZYpp
Group:          System/Management
Requires:       etckeeper = %{version}-%{release}
Requires:       zypp-plugin-python
BuildRequires:  zypp-plugin-python
Obsoletes:      etckeeper-pkgmanager-collabo < %{version}-%{release}
Provides:       etckeeper-pkgmanager-collabo = %{version}-%{release}
Provides:       etckeeper:%{_prefix}/lib/zypp/plugins/commit/

%description zypp-plugin
The etckeeper-zypp-plugin calls etckeeper from ZYpp.
%package yum-plugin
Summary:        The etckeeper integration function with YUM
Group:          System/Management
Requires:       etckeeper = %{version}-%{release}
Obsoletes:      etckeeper-pkgmanager-collabo
Provides:       etckeeper-pkgmanager-collabo = %{version}-%{release}
Provides:       etckeeper:%{_sysconfdir}/yum/pluginconf.d/etckeeper.conf

%description yum-plugin
The etckeeper-zypp-plugin calls etckeeper from YUM.

%setup -q
%patch0 -p1
%patch1 -p1

%__perl -pi -e '
' ./etckeeper.conf

# rpmlint
find -type f -name ".gitignore" -delete
rm -f ./doc/todo/.mdwn

# use %%{_unitdir} for rpm-based distros
sed -i 's:systemddir=/lib/systemd/system:systemddir=%{_unitdir}:g' Makefile

make %{?_smp_mflags}

make \
    DESTDIR="%{buildroot}" \
    PYTHON_INSTALL_OPTS="--prefix=%{_prefix} --install-purelib=%{python_sitearch}" \
install -D debian/cron.daily "%{buildroot}/etc/cron.daily/%{name}"

mkdir %{buildroot}%{_sbindir}
ln -s ../bin/%{name} %{buildroot}%{_sbindir}/%{name}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}

%service_add_pre etckeeper.service

%service_del_preun etckeeper.service

%service_add_post etckeeper.service

%service_del_postun etckeeper.service

%doc GPL doc
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%dir %{_sysconfdir}/etckeeper
%config(noreplace) %{_sysconfdir}/etckeeper/etckeeper.conf
%dir %{_sysconfdir}/etckeeper/*.d
%config %{_sysconfdir}/etckeeper/*.d/*
%doc %{_mandir}/man8/etckeeper.8*

%files cron
%config(noreplace) %{_sysconfdir}/cron.daily/etckeeper

%if 0%{?suse_version}
%files zypp-plugin
%files yum-plugin
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/etckeeper.conf

openSUSE Build Service is sponsored by