File ypbind.spec of Package ypbind
#
# spec file for package ypbind
#
# 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/
#
%if 0%{?suse_version} >= 1220
%define with_systemd 1
%else
%define with_systemd 0
%endif
Name: ypbind
BuildRequires: dbus-1-devel
BuildRequires: openslp-devel
BuildRequires: pkgconfig
%if %{with_systemd}
BuildRequires: systemd
%{?systemd_requires}
%endif
%if %{suse_version} > 1010
BuildRequires: dbus-1-glib-devel
%endif
%if %{suse_version} > 1210
BuildRequires: libxml2-tools
%endif
Requires: portmap
Requires: yp-tools
PreReq: %insserv_prereq %fillup_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Version: 1.35
Release: 0
Url: http://www.linux-nis.org/nis/ypbind-mt
Summary: NIS client daemon
License: GPL-2.0
Group: Productivity/Networking/NIS
Source: ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
Source1: SuSEfirewall.ypbind
Source2: ypbind.service
Source3: ypbind-systemd-pre
Source4: ypbind-systemd-post
%description
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
programs.
%prep
%setup -q -n ypbind-mt-%{version}
%build
export CFLAGS=$RPM_OPT_FLAGS
./configure --mandir=%{_mandir} --enable-dbus-nm
make
%install
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
mkdir -p $RPM_BUILD_ROOT/var/yp/binding
make install DESTDIR=$RPM_BUILD_ROOT
# Install init script
install -m 755 etc/ypbind.init $RPM_BUILD_ROOT/etc/init.d/ypbind
# Install SuSEfirewall2 service file
install -m 644 %SOURCE1 $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/ypbind
# Install rc.config add-on
install -m 644 etc/sysconfig.ypbind $RPM_BUILD_ROOT/var/adm/fillup-templates/
# Install SuSEconfig.ypclient
ln -sf /etc/init.d/ypbind $RPM_BUILD_ROOT/usr/sbin/rcypbind
# Create dummy yp.conf
touch $RPM_BUILD_ROOT/etc/yp.conf
# Create filelist with translatins
%{find_lang} ypbind-mt
# Install systemd stuff
%if %{with_systemd}
install -D -m 644 %SOURCE2 %{buildroot}%{_unitdir}/ypbind.service
install -D -m 755 %SOURCE3 $RPM_BUILD_ROOT/usr/share/ypbind/ypbind-systemd-pre
install -m 755 %SOURCE4 $RPM_BUILD_ROOT/usr/share/ypbind/ypbind-systemd-post
%endif
%if %{with_systemd}
%pre
%service_add_pre ypbind.service
%endif
%post
%{fillup_and_insserv ypbind}
%if %{with_systemd}
%service_add_post ypbind.service
%endif
%preun
%stop_on_removal ypbind
%if %{with_systemd}
%service_del_preun ypbind.service
%endif
if [ "$1" = "0" ]; then
rm -f var/yp/binding/*
fi
%postun
%restart_on_update ypbind
%insserv_cleanup
%if %{with_systemd}
%service_del_postun ypbind.service
%endif
%files -f ypbind-mt.lang
%defattr(-,root,root)
%doc AUTHORS NEWS README THANKS
%ghost %config(noreplace) /etc/yp.conf
%config /etc/init.d/ypbind
%config /etc/sysconfig/SuSEfirewall2.d/services/ypbind
/var/adm/fillup-templates/sysconfig.ypbind
%doc %{_mandir}/man5/yp.conf.5.gz
%doc %{_mandir}/man8/ypbind.8.gz
/usr/sbin/rcypbind
/usr/sbin/ypbind
#%dir /usr/share/locale/de
#%dir /usr/share/locale/de/LC_MESSAGES
#/usr/share/locale/de/LC_MESSAGES/ypbind-mt.mo
%dir /var/yp
%dir /var/yp/binding
%if %{with_systemd}
%{_unitdir}/ypbind.service
%dir /usr/share/ypbind
/usr/share/ypbind/*
%endif
%changelog