File dasscm.spec of Package dasscm

# 
# Copyright  (c)  2004-2013  dass IT GmbH, Koeln, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# $Id: dasscm.spec 1247 2020-01-07 11:28:33Z joergs $

Name:           dasscm
URL:            https://trac.dass-it.de/pub/
License:        GPL-2.0+
Group:          Development/Tools/Version Control
Autoreqprov:    on
Summary:        DASS Configuration Management
Version: 1.2.1273
Release:        0
Requires:       subversion perl
Source: dasscm_1.2.1273.orig.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  gzip tar
%endif
#BuildRequires:  nagios-nrpe

# Subversion should be installed during build 
# to have the directory /etc/subversion/ available.
# Unfortunally, it isn't included in all distributions,
# therefore we added some checks
##if 0#{?suse_version} > 1100
#BuildRequires:  subversion
##endif
 

%description
dasscm is a tool for handling configuration files with subversion

%prep
%setup -c



%build


%install
# call install script
./dasscm.install.sh DESTDIR=$RPM_BUILD_ROOT

# handle special files, not useful on all distributions
rm -f files
touch files
if test -e $RPM_BUILD_ROOT/etc/bash_completion.d/dasscm.sh; then
    echo '%config(noreplace)  /etc/bash_completion.d/dasscm.sh' >> files
else
    echo '%doc                etc/bash_completion.d/bash_completion_dasscm.sh' >> files
fi

if test -e $RPM_BUILD_ROOT/etc/nagios/nrpe.d/dasscm.cfg; then
    #test -d /etc/nagios        || echo '%%dir /etc/nagios' >> files
    #test -d /etc/nagios/nrpe.d || echo '%%dir /etc/nagios/nrpe.d' >> files
    echo '%config(noreplace)  /etc/nagios/nrpe.d/dasscm.cfg' >> files
else
    echo '%doc                etc/nagios/nrpe.d/nrpe-dasscm.cfg' >> files
fi

#cat files


%clean
[ "$RPM_BUILD_ROOT" != "/" ] &&  rm -rf $RPM_BUILD_ROOT

# TODO: group dasscm: 4199
#       without existing group, #attr(640,root,4199)  falls back to root
#       groupadd -g 4199 dasscm

%files -f files
%defattr(-,root,root)
%dir /var/lib/dasscm/
%dir /var/lib/dasscm/plugin-results/
/usr/bin/dasscm
/usr/bin/dasscm_remote_check.sh
/usr/bin/dasscm_remote_update.sh
%doc doc/README doc/*.txt doc/*.pl subversion-servers.dass-it

%config(noreplace)  %attr(640,root,root) /etc/dasscm.conf
%config(noreplace)  /etc/profile.d/dasscm.sh

# /etc/sudoers.d/ should not belong to dasscm,
# but is does currently not exist on most distributions
# on Fedora, RHEL/CentOS > 6 produces conflict with sudo package
# if it is also owned by this package
%if ! 0%{?fedora} && ! 0%{?rhel_version} && ! 0%{?centos_version}
%dir /etc/nagios/
%dir /etc/nagios/nrpe.d/
%dir /etc/sudoers.d/
%endif
# sudo requires permissions 440 and config files without any "."
%attr(440,root,root) %config(noreplace) /etc/sudoers.d/nagios_dasscm_check
openSUSE Build Service is sponsored by