File ypbind.spec of Package ypbind

# spec file for package ypbind
# Copyright (c) 2018 SUSE LINUX 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

%if ! %{defined _fillupdir}
  %define _fillupdir %{_localstatedir}/adm/fillup-templates

%define tmpfiles_remove() \
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
if [ "$FIRST_ARG" -eq 0 ]; then \
   [ -z "${TRANSACTIONAL_UPDATE}" -a -x /usr/bin/systemd-tmpfiles ] && \
            /usr/bin/systemd-tmpfiles --remove %{?*} || : \
fi \

Name:           ypbind
Version:        2.6
Release:        0
Summary:        NIS client daemon
License:        GPL-2.0-only
Group:          Productivity/Networking/NIS
Source:         %{name}-mt-%{version}.tar.xz
Source1:        SuSEfirewall.ypbind
Source2:        ypbind.service
Source3:        ypbind-systemd-pre
Source4:        ypbind-systemd-post
Source5:        ypbind-systemd-exec
Source6:        ypbind.conf
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libnsl) >= 1.0.1
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(libtirpc) >= 1.0.1
Requires:       libnss_nis2
Requires:       rpcbind
Requires:       yp-tools
Requires(post): %fillup_prereq

This package provides the ypbind daemon. The ypbind daemon binds NIS
clients to an NIS domain and searches a new NIS server if the old one
goes down.

Ypbind must be running on any machines which are running NIS client

%setup -q -n ypbind-mt-%{version}

%configure --disable-dbus-nm
make  %{?_smp_mflags}

mkdir -p %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
mkdir -p %{buildroot}%{_fillupdir}
# Install SuSEfirewall2 service file
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/ypbind
# Install rc.config add-on
install -m 644 etc/sysconfig.ypbind %{buildroot}%{_fillupdir}
# Create dummy yp.conf
touch %{buildroot}%{_sysconfdir}/yp.conf
# Create filelist with translatins
%find_lang ypbind-mt
# Install systemd stuff
install -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/ypbind.service
mkdir -p %{buildroot}%{_libexecdir}/ypbind
install -m 755 %{SOURCE3} %{buildroot}%{_libexecdir}/ypbind/ypbind-systemd-pre
install -m 755 %{SOURCE4} %{buildroot}%{_libexecdir}/ypbind/ypbind-systemd-post
install -m 755 %{SOURCE5} %{buildroot}%{_libexecdir}/ypbind/ypbind-systemd-exec
# create symlink for rcypbind
ln -s /sbin/service %{buildroot}%{_sbindir}/rcypbind
mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d
install -m 644 %{SOURCE6} %{buildroot}%{_prefix}/lib/tmpfiles.d/

%service_add_pre ypbind.service

%{fillup_only -n ypbind}
%service_add_post ypbind.service
%tmpfiles_create ypbind.conf

%service_del_preun ypbind.service
%tmpfiles_remove ypbind.conf

%service_del_postun ypbind.service
if [ "$1" = "0" ]; then
   test -d %{_localstatedir}/yp/binding && rm -rf %{_localstatedir}/yp/binding ||:

%files -f ypbind-mt.lang
%license COPYING
%ghost %config(noreplace) %{_sysconfdir}/yp.conf
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/ypbind
%dir %{_libexecdir}/ypbind

openSUSE Build Service is sponsored by