## $Id$ --*- rpm-spec -*--
## This package understands the following switches:
## --without dietlibc ... disable usage of dietlibc
## --without fedora ... disable fedora specific parts
## --with minit ... disable creation of 'minit' subpackage
## Fedora Extras specific customization below...
%bcond_without fedora
%bcond_without dietlibc
%bcond_with minit
##
%global username dhcp-fwd
%global homedir %_var/lib/%username
%global minitdir %_sysconfdir/minit
%global minitsvcdir %minitdir/services/dhcp-fwd
%global service dhcp-fwd
%{!?release_func:%global release_func() %1%{?dist}}
Summary: DHCP relay agent
Name: dhcp-forwarder
Version: 0.7
Release: %release_func 12.1
License: GPL
Group: System Environment/Daemons
URL: http://www.nongnu.org/dhcp-fwd/
Source0: http://download.savannah.gnu.org/releases/dhcp-fwd/%name-%version.tar.bz2
Source1: http://download.savannah.gnu.org/releases/dhcp-fwd/%name-%version.tar.bz2.asc
Patch0: dhcp-forwarder-0.7-bigend.patch
BuildRoot: %_tmppath/%name-%version-%release-root
Requires: init(dhcp-forwarder)
BuildRequires: which
BuildRequires: fedora-usermgmt-devel
Provides: user(%username)
Provides: group(%username)
%{?FE_USERADD_REQ}
%{?with_dietlibc:BuildRequires: dietlibc}
%package sysv
Summary: SysV initscripts for dhcp-forwarder
Group: System Environment/Base
Provides: init(dhcp-forwarder) = sysv
Requires: %name = %version-%release
Requires(preun): %name initscripts
Requires(postun): %name initscripts
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
%package minit
Summary: minit initscripts for dhcp-forwarder
Group: System Environment/Base
Provides: init(dhcp-forwarder) = minit
Requires: %name = %version-%release
Requires(pre): minit-setup
Requires(postun): minit-setup
%description
dhcp-fwd forwards DHCP messages between subnets with different sublayer
broadcast domains. It is similar to the DHCP relay agent dhcrelay of
ISC's DHCP, but has the following important features:
* Runs as non-root in a chroot-environment
* Uses AF_INET sockets which makes it possible to filter incoming
messages with packetfilters
* The DHCP agent IDs can be defined freely
* Has a small memory footprint when using dietlibc
%description sysv
dhcp-fwd forwards DHCP messages between subnets with different sublayer
broadcast domains.
This package provides the scripts which can be used to start dhcp-forwarder
with the SysV initconcept.
%description minit
dhcp-fwd forwards DHCP messages between subnets with different sublayer
broadcast domains.
This package provides the scripts which can be used to start dhcp-forwarder
with the minit initconcept.
%prep
%setup -q
%patch0 -p0
%build
%configure \
--enable-release \
--with-initrddir=%_initrddir \
%{!?with_dietlibc:--disable}%{?with_dietlibc:--enable}-dietlibc
%__make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
%__make DESTDIR=$RPM_BUILD_ROOT install install-contrib
%__install -d -m700 $RPM_BUILD_ROOT%homedir
%{!?with_minit:rm -rf $RPM_BUILD_ROOT%minitsvcdir}
%check
%__make check
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%__fe_groupadd 11 -r %username &>/dev/null || :
%__fe_useradd 11 -r -s /sbin/nologin -M -c 'DHCP Forwarder user' \
-d %homedir -g %username %username &>/dev/null || :
%postun
%__fe_userdel %username &>/dev/null || :
%__fe_groupdel %username &>/dev/null || :
%post sysv
/sbin/chkconfig --add %service
%preun sysv
if test "$1" = "0"; then
%_initrddir/%service stop >/dev/null
/sbin/chkconfig --del %service
fi
%postun sysv
test "$1" = "0" || %_initrddir/%service condrestart &>/dev/null
%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README THANKS
%_mandir/*/*
%config(noreplace) %_sysconfdir/dhcp-fwd.conf
%_sbindir/*
## *DO NOT* add %defattr(-,dhcp-fwd,dhcp-fwd); the homedir is used for
## the chroot() only and there is no reason why the setuid()'ed daemon
## needs any kind of access there
%homedir
%files sysv
%defattr(-,root,root,-)
%config %_initrddir/*
%config(noreplace) %_sysconfdir/sysconfig/*
%if 0%{?with_minit:1}
%files minit
%defattr(-,root,root,-)
%dir %minitsvcdir
%minitsvcdir/run
%minitsvcdir/respawn
%config(noreplace) %minitsvcdir/params
%endif
%changelog
* Sun Sep 2 2007 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.7-13
- updated URL
* Thu Jan 18 2007 David Woodhouse <dwmw2@infradead.org> 0.7-12
- rebuilt with PPC support
* Thu Oct 05 2006 Christian Iseli <Christian.Iseli@licr.org> 0.7-11
- rebuilt for unwind info generation, broken in gcc-4.1.1-21
* Mon Sep 18 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.7-10
- rebuilt
* Sun Jul 9 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.7-9
- rebuilt with dietlibc-0.30
- use new fedora-usermgmt code
- use %%bcond_* macros
* Mon Feb 20 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.7-8
- exclude PPC arch because dietlibc is not available there anymore
* Wed Jun 8 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.7-7
- do not build against dietlibc on non-i386 archs running FC3
- added sanity check for builds with mach
- buildrequire 'which'
* Thu May 19 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.7-4
- use %%dist instead of %%disttag
* Sun Mar 6 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.7-2
- fixed bigendian builds (backported from 0.8)
- s!%%define!%%global! to workaround bugs in rpm's macro-engine
* Thu Nov 11 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.7-0.fdr.1
- fedora'ized it
* Thu Aug 19 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.6.1-0
- added support for 'fedora-usermgmt' (enabled with '--with fedora' switch)
* Thu Jun 17 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.6.1-0
- conditionalized build of -minit subpackage
* Thu Aug 7 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0:0.5.1-0
- added minit support
- removed superfluous %%doc attribute of %%_mandir entries
- removed superfluous curlies
- use 'install-contrib' and cleaned up %%install section
- moved /etc/sysconfig/* file into -sysv subpackage; it is not used by
-minit anymore
- minor cleanups
* Wed Jul 30 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0:0.5-0.fdr.1
- updated to version 0.5
* Tue May 27 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0:0.4-0.fdr.2
- create and remove group explicitely
- s/adduser/useradd/
- removed dependency on initscripts by calling the service-script in
the %%post/%%preun scriptlets directly
- do not call '--install-contrib' anymore; it creates too much
clutter to make sure that the initscripts will be installed into
%%_initrddir but not in /etc/init.d. Instead of, install the
scripts manually.
* Fri May 2 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0:0.4-0.fdr.1
- cleanups
- applied fedora.us naming scheme
* Wed Aug 28 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0.3.1-1
- Added /etc/sysconfig/dhcp-fwd file
* Fri Jul 12 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0.2.5-2
- Renamed username from dhcpfwd to dhcp-fwd
- Adjusted URL
* Fri Jul 12 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0.2.5-1
- version 0.2.5
- Fixed some typos
- Added some PreReq's
- Enhanced %postun script
* Mon Jun 17 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0.2-2
- Described purpose of the %%homedir and its handling
* Fri Jun 14 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0.2-1
- Added manpage
* Thu Jun 13 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0.1-0.3
- Added --without dietlibc option
* Sat Jun 1 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
- Initial build.