File radvd.spec of Package radvd
#
# spec file for package radvd
#
# 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: radvd
Version: 1.8.2
Release: 1
License: BSD 3-clause (or similar)
Summary: Router ADVertisement Daemon for IPv6
Url: http://v6web.litech.org/radvd
Group: Productivity/Networking/Routing
Source0: http://www.litech.org/radvd/dist/%{name}-%{version}.tar.gz
Source1: radvd.init
Source2: sysconfig.radvd
Patch0: diff_release_1_8_2..44ee01c7.patch
Patch1: 0001-run-as-user-radvd-by-default.diff
BuildRequires: bison
BuildRequires: flex
PreReq: %fillup_prereq
PreReq: %insserv_prereq
PreReq: /usr/sbin/useradd
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
RADVD is the Router ADVertisement Daemon. It is used for automated
configuration of IPv6 networks. Most people will not need this.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
autoreconf -fi
CFLAGS="%{optflags} -fno-strict-aliasing"
%configure --disable-silent-rules --with-configfile=%{_sysconfdir}/radvd.conf --with-pidfile=/var/run/radvd/radvd.pid
make %{?_smp_mflags}
%install
%makeinstall
mkdir -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}%{_localstatedir}/run/radvd
install -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/radvd
ln -sf /etc/init.d/radvd %{buildroot}%{_sbindir}/rcradvd
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
install -m 644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/
install -m 644 /dev/null %{buildroot}%{_sysconfdir}/radvd.conf
%pre
getent passwd radvd >/dev/null || \
/usr/sbin/useradd -r -d /var/lib/empty -s /bin/false \
-c "Router ADVertisement Daemon for" -g daemon radvd 2>/dev/null || :
%post
# zap old (<= 11.4) default
test -f /etc/sysconfig/radvd && sed -ie '/^RADVD_OPTIONS/s/-u daemon//' /etc/sysconfig/radvd
%{fillup_and_insserv radvd}
#
if [ ! -e /etc/radvd.conf ]; then
# yeah, not quite the rfc4193 algorithm but hopefully
# random enough
prefix=`printf "fd%%02x:%%04x:%%04x:0001::/64\n" $((RANDOM%256)) $RANDOM $RANDOM`
cat > /etc/radvd.conf <<EOF
interface eth0
{
AdvSendAdvert on;
# life time zero means we don't actually advertise a
# router but only our ULA address. Remove if you want this
# host to be advertised as router.
AdvDefaultLifetime 0;
# ULA address according to RFC 4193.
# It was randomly created at installation of the package for
# use in your local network.
prefix $prefix
{
};
};
EOF
echo "created /etc/radvd.conf with ULA prefix $prefix"
fi
#
install -d -m 755 -o radvd /var/run/radvd
%postun
%restart_on_update radvd
%insserv_cleanup
%preun
%stop_on_removal radvd
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%ghost %dir %attr(0755,radvd,root) %{_localstatedir}/run/radvd/
%ghost %config(noreplace) %{_sysconfdir}/radvd.conf
%{_localstatedir}/adm/fillup-templates/sysconfig.radvd
%{_sbindir}/radvd
%{_sbindir}/radvdump
%doc %{_mandir}/man8/radvd.8.gz
%doc %{_mandir}/man8/radvdump.8.gz
%doc %{_mandir}/man5/radvd.conf.5.gz
%doc CHANGES COPYRIGHT TODO INTRO.html
%doc radvd.conf.example
%config %{_sysconfdir}/init.d/radvd
%{_sbindir}/rcradvd
%changelog