File nss-myhostname.spec of Package nss-myhostname
#
# spec file for package nss-myhostname
#
# 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/
#
# icecream 0
Name: nss-myhostname
Summary: Plugin for local system host name resolution
License: LGPL-2.1+
Group: System/Libraries
Version: 0.3
Release: 0
BuildRequires: autoconf
BuildRequires: automake
Url: http://0pointer.de/lennart/projects/nss-myhostname/
Source: http://0pointer.de/lennart/projects/nss-myhostname/nss-myhostname-%{version}.tar.gz
Source1: nss-myhostname-config
Patch0: 0001-avoid-assertion-if-invalid-address-familily-is-passed.diff
Patch1: 0001-optionally-warn-if-nss-myhostname-is-called.diff
PreReq: sed
%description
nss-myhostname is a plugin for the GNU Name Service Switch (NSS)
functionality of the GNU C Library (glibc) providing host name
resolution for the locally configured system hostname as returned by
gethostname(2). Various software relies on an always resolvable local
host name. When using dynamic hostnames this is usually achieved by
patching /etc/hosts at the same time as changing the host name. This
however is not ideal since it requires a writable /etc file system and
is fragile because the file might be edited by the administrator at
the same time. nss-myhostname simply returns all locally
configured public IP addresses, or -- if none are configured --
the IPv4 address 127.0.0.2 (wich is on the local loopback) and the
IPv6 address ::1 (which is the local host) for whatever system
hostname is configured locally. Patching /etc/hosts is thus no
longer necessary.
Note that nss-myhostname only provides a workaround for broken
software. If nss-myhostname is trigged by an application a message
is logged to /var/log/messages. Please check whether that's worth
a bug report then.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
autoreconf
%configure --libdir=/%{_lib} --with-warning
make %{?_smp_mflags}
%install
make DESTDIR=%{buildroot} install
install -D -m 755 %SOURCE1 %{buildroot}%{_sbindir}/nss-myhostname-config
rm -rf %{buildroot}/usr/share/doc/nss-myhostname
%clean
rm -rf $RPM_BUILD_ROOT
%preun
if [ "$1" -eq 0 -a -f /etc/nsswitch.conf ] ; then
%{_sbindir}/nss-myhostname-config --disable
fi
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-, root, root)
%doc README
%doc LICENSE
%{_sbindir}/nss-myhostname-config
/%{_lib}/*
%changelog