File unscd.spec of Package unscd

#
# spec file for package unscd
#
# Copyright (c) 2011 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/
#



Name:           unscd
Version:        0.47
Release:        2
Summary:        Alternative Name Service Caching Daemon
Group:          System/Daemons
License:        GPL
Url:            http://busybox.net/~vda/unscd/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Conflicts:      nscd
Obsoletes:      nscd < 2.10.1-6
Source0:        nscd-%version.c
Source1:        init.d
Source2:        nscd.conf
Source3:        COPYING
PreReq:         %insserv_prereq

%description
unscd caches application requests for resolving hostnames,
user and group names and other things, and can dramatically improve
performance e.g. when using NIS or LDAP or even when just caching
DNS requests.

This is an alternative to the glibc-supplied nscd that has been
designed to be much simpler and more robust, but has fewer features
and may have somewhat worse performance.

%prep
%setup -q -c -T
cp $RPM_SOURCE_DIR/nscd-%version.c .

%build
%__cc -Wl,-z,relro,-z,now $RPM_OPT_FLAGS -fpie -pie -o unscd nscd-%version.c

%install
install -m 0755 -D unscd $RPM_BUILD_ROOT/%_sbindir/nscd
install -m 0644 -D $RPM_SOURCE_DIR/nscd.conf $RPM_BUILD_ROOT/etc/nscd.conf
install -m 0755 -D $RPM_SOURCE_DIR/init.d $RPM_BUILD_ROOT/etc/init.d/nscd
ln -sf /etc/init.d/nscd $RPM_BUILD_ROOT/usr/sbin/rcnscd
mkdir -p $RPM_BUILD_ROOT/var/run/nscd
touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid}

%clean
rm -rf $RPM_BUILD_ROOT

%preun
%stop_on_removal nscd

%post
%{insserv_force_if_yast nscd}

%postun
%restart_on_update nscd
%insserv_cleanup

%files
%defattr(-,root,root,-)
%config(noreplace) /etc/nscd.conf
%config /etc/init.d/nscd
%attr(0755,root,root) %_sbindir/*
%dir %attr(0755,root,root) %ghost /var/run/nscd
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket
%doc $RPM_SOURCE_DIR/COPYING

%changelog
openSUSE Build Service is sponsored by