c318a1e
%define testrelease 0
22ddee6
%define releasecandidate 0
e85159c
%if 0%{testrelease}
e85159c
  %define extrapath test-releases/
4c94878
  %define extraversion test30
e85159c
%endif
e85159c
%if 0%{releasecandidate}
e85159c
  %define extrapath release-candidates/
c318a1e
  %define extraversion rc1
e85159c
%endif
9fa2ba4
b0365fb
Name:           dnsmasq
ce211c7
Version:        2.43
3d10ffe
Release:        2%{?extraversion}%{?dist}
b0365fb
Summary:        A lightweight DHCP/caching DNS server
b0365fb
b0365fb
Group:          System Environment/Daemons
62e3847
License:        GPLv2 or GPLv3
b0365fb
URL:            http://www.thekelleys.org.uk/dnsmasq/
f994f12
Source0:        http://www.thekelleys.org.uk/dnsmasq/%{?extrapath}%{name}-%{version}%{?extraversion}.tar.gz
f994f12
Patch0:         %{name}-2.33-initscript.patch
91d4b30
Patch1:         %{name}-configuration.patch
b0365fb
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
b0365fb
b0365fb
BuildRequires:  dbus-devel
c81c9a2
BuildRequires:  pkgconfig
cc527ef
c81c9a2
Requires(post):  /sbin/chkconfig
b0365fb
Requires(post):  /sbin/service
91d4b30
Requires(post):  /bin/sed /bin/grep
b0365fb
Requires(preun): /sbin/chkconfig
b0365fb
Requires(preun): /sbin/service
b0365fb
b0365fb
%description
b0365fb
Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server. 
b0365fb
It is designed to provide DNS and, optionally, DHCP, to a small network. 
b0365fb
It can serve the names of local machines which are not in the global 
b0365fb
DNS. The DHCP server integrates with the DNS server and allows machines 
b0365fb
with DHCP-allocated addresses to appear in the DNS with names configured 
b0365fb
either in each host or in a central configuration file. Dnsmasq supports 
b0365fb
static and dynamic DHCP leases and BOOTP for network booting of diskless 
b0365fb
machines.
b0365fb
b0365fb
b0365fb
%prep
9fa2ba4
%setup -q -n %{name}-%{version}%{?extraversion}
5275092
%patch0 -p1
5275092
%patch1 -p1
b0365fb
b0365fb
%build
b0365fb
make %{?_smp_mflags}
b0365fb
b0365fb
b0365fb
%install
b0365fb
rm -rf $RPM_BUILD_ROOT
b0365fb
# normally i'd do 'make install'...it's a bit messy, though
b0365fb
mkdir -p $RPM_BUILD_ROOT%{_sbindir} $RPM_BUILD_ROOT%{_initrddir} \
c81c9a2
        $RPM_BUILD_ROOT%{_mandir}/man8 \
91d4b30
        $RPM_BUILD_ROOT%{_var}/lib/dnsmasq \
65d7a40
        $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.d \
c81c9a2
        $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
b0365fb
install src/dnsmasq $RPM_BUILD_ROOT%{_sbindir}/dnsmasq
b0365fb
install dnsmasq.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.conf
aa950b3
install dbus/dnsmasq.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/
60068e4
install rpm/dnsmasq.init $RPM_BUILD_ROOT%{_initrddir}/dnsmasq
6a4bb30
install -m 644 man/dnsmasq.8 $RPM_BUILD_ROOT%{_mandir}/man8/
b0365fb
b0365fb
%clean
b0365fb
rm -rf $RPM_BUILD_ROOT
b0365fb
b0365fb
%post
1b09738
if [ "$1" = "2" ]; then # if we're being upgraded
91d4b30
    # if using the old leases location, move the file to the new one
91d4b30
    # but only if we're not clobbering another file
91d4b30
    #
91d4b30
    if [ -f /var/lib/misc/dnsmasq.leases -a ! -f /var/lib/dnsmasq/dnsmasq.leases ]; then
91d4b30
        # causes rpmlint to report dangerous-command-in-post,
91d4b30
        # but that's the price of selinux compliance :-(
91d4b30
        mv -f /var/lib/misc/dnsmasq.leases /var/lib/dnsmasq/dnsmasq.leases || :
91d4b30
    fi
91d4b30
    # ugly, but kind of necessary
91d4b30
    if [ ! `grep -q dhcp-leasefile=/var/lib/misc/dnsmasq.leases %{_sysconfdir}/dnsmasq.conf` ]; then
91d4b30
        cp %{_sysconfdir}/dnsmasq.conf %{_sysconfdir}/dnsmasq.conf.tmp || :
91d4b30
        sed -e 's/var\/lib\/misc/var\/lib\/dnsmasq/' < %{_sysconfdir}/dnsmasq.conf.tmp > %{_sysconfdir}/dnsmasq.conf || :
91d4b30
        rm -f %{_sysconfdir}/dnsmasq.conf.tmp || :
91d4b30
    fi
1b09738
    /sbin/service dnsmasq condrestart >/dev/null 2>&1 || :
1b09738
else # if we're being installed
1b09738
    /sbin/chkconfig --add dnsmasq
1b09738
fi
b0365fb
b0365fb
%preun
1b09738
if [ "$1" = "0" ]; then     # execute this only if we are NOT doing an upgrade
1b09738
    /sbin/service dnsmasq stop >/dev/null 2>&1 || :
b0365fb
    /sbin/chkconfig --del dnsmasq
b0365fb
fi
b0365fb
b0365fb
b0365fb
%files
b0365fb
%defattr(-,root,root,-)
474aabd
%doc CHANGELOG COPYING FAQ doc.html setup.html dbus/DBus-interface
aa950b3
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/dnsmasq.conf
474aabd
%dir /etc/dnsmasq.d
91d4b30
%dir %{_var}/lib/dnsmasq
aa950b3
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/dnsmasq.conf
b0365fb
%{_initrddir}/dnsmasq
b0365fb
%{_sbindir}/dnsmasq
b0365fb
%{_mandir}/man8/dnsmasq*
b0365fb
b0365fb
b0365fb
%changelog
3d10ffe
* Wed Jul 16 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.43-2
ce211c7
- New upstream release, contains fixes for CVE-2008-1447/CERT VU#800113
3d10ffe
- Dropped patch for newer glibc (merged upstream)
ce211c7
62e3847
* Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.8
62e3847
- Added upstream-authored patch for newer glibc (thanks Simon!)
62e3847
22ddee6
* Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.7
22ddee6
- New upstream release
22ddee6
c318a1e
* Wed Jan 30 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.6.rc1
c318a1e
- Release candidate
c318a1e
- Happy Birthday Isaac!
c318a1e
4c94878
* Wed Jan 23 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.5.test30
4c94878
- Bugfix update
4c94878
d996be6
* Mon Dec 31 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.4.test26
d996be6
- Bugfix/feature enhancement update
d996be6
d927a5c
* Thu Dec 13 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.3.test24
d927a5c
- Upstream fix for fairly serious regression
d927a5c
91d4b30
* Tue Dec 04 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.2.test20
a1e0af8
- New upstream test release
91d4b30
- Moving dnsmasq.leases to /var/lib/dnsmasq/ as per BZ#407901
91d4b30
- Ignoring dangerous-command-in-%%post rpmlint warning (as per above fix)
91d4b30
- Patch consolidation/cleanup
91d4b30
- Removed conditionals for Fedora <= 3 and Aurora 2.0
a1e0af8
f994f12
* Tue Sep 18 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-1
f994f12
- Finalized upstream release
f994f12
- Removing URLs from patch lines (CVS is the authoritative source)
f994f12
- Added more magic to make spinning rc/test packages more seamless
f994f12
9fa2ba4
* Sun Aug 26 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-0.1.rc2
9fa2ba4
- New upstream release candidate (feature-frozen), thanks Simon!
9fa2ba4
- License clarification
9fa2ba4
d1bbeeb
* Tue May 29 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.39-1
d1bbeeb
- New upstream version (bugfixes, enhancements)
d1bbeeb
d000b5a
* Mon Feb 12 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.38-1
d000b5a
- New upstream version with bugfix for potential hang
d000b5a
253ce1d
* Tue Feb 06 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.37-1
253ce1d
- New upstream version
253ce1d
7930563
* Wed Jan 24 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.36-1
7930563
- New upstream version
7930563
65d7a40
* Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-2
65d7a40
- Stop creating /etc/sysconfig on %%install
65d7a40
- Create /etc/dnsmasq.d on %%install
65d7a40
474aabd
* Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-1
474aabd
- Update to 2.35
474aabd
- Removed UPGRADING_to_2.0 from %%doc as per upstream change
474aabd
- Enabled conf-dir in default config as per RFE BZ#214220 (thanks Chris!)
474aabd
- Added %%dir /etc/dnsmasq.d to %%files as per above RFE
474aabd
1b09738
* Tue Oct 24 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-2
1b09738
- Fixed BZ#212005
1b09738
- Moved %%postun scriptlet to %%post, where it made more sense
1b09738
- Render scriptlets safer
1b09738
- Minor cleanup for consistency
1b09738
c99b31e
* Thu Oct 19 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-1
c99b31e
- Hardcoded version in patches, as I'm getting tired of updating them
c99b31e
- Update to 2.34
c99b31e
507262e
* Mon Aug 28 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-2
507262e
- Rebuild for FC6
507262e
c81c9a2
* Tue Aug 15 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-1
c81c9a2
- Update
c81c9a2
cc527ef
* Sat Jul 22 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-3
cc527ef
- Added pkgconfig BuildReq due to reduced buildroot
cc527ef
b3b82db
* Thu Jul 20 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-2
b3b82db
- Forced update due to dbus version bump
b3b82db
bc74c1b
* Mon Jun 12 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-1
bc74c1b
- Update from upstream
bc74c1b
- Patch from Dennis Gilmore fixed the conditionals to detect Aurora Linux
bc74c1b
60068e4
* Mon May  8 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.31-1
60068e4
- Removed dbus config patch (now provided upstream)
60068e4
- Patched in init script (no longer provided upstream)
60068e4
- Added DBus-interface to docs
60068e4
5275092
* Tue May  2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4.2
00482dd
- More upstream-recommended cleanups :)
00482dd
- Killed sysconfig file (provides unneeded functionality)
00482dd
- Tweaked init script a little more
00482dd
aa950b3
* Tue May  2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4
aa950b3
- Moved options out of init script and into /etc/sysconfig/dnsmasq
aa950b3
- Disabled DHCP_LEASE in sysconfig file, fixing bug #190379
aa950b3
- Simon Kelley provided dbus/dnsmasq.conf, soon to be part of the tarball
aa950b3
9433ece
* Thu Apr 27 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-3
9433ece
- Un-enabled HAVE_ISC_READER, a hack to enable a deprecated feature (request)
9433ece
- Split initscript & enable-dbus patches, conditionalized dbus for FC3
9433ece
- Tweaked name field in changelog entries (trying to be consistent)
9433ece
9433ece
* Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-2
b0365fb
- Disabled stripping of binary while installing (oops)
b0365fb
- Enabled HAVE_ISC_READER/HAVE_DBUS via patch
b0365fb
- Added BuildReq for dbus-devel
b0365fb
9433ece
* Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-1
b0365fb
- Initial Fedora Extras RPM