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
0d9e8c4
Version:        2.52
79727a1
Release:        5%{?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/
27df76d
Source0:        http://www.thekelleys.org.uk/dnsmasq/%{?extrapath}%{name}-%{version}%{?extraversion}.tar.lzma
a4a3c32
Source1:        %{name}.service
b0365fb
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
b0365fb
b0365fb
BuildRequires:  dbus-devel
c81c9a2
BuildRequires:  pkgconfig
cc527ef
a4a3c32
BuildRequires:  systemd-units
a4a3c32
Requires(post): systemd-units systemd-sysv chkconfig 
a4a3c32
Requires(preun): systemd-units
a4a3c32
Requires(postun): systemd-units 
a4a3c32
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}
80a7583
80a7583
# use /var/lib/dnsmasq instead of /var/lib/misc
80a7583
for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do
80a7583
    sed -i 's|/var/lib/misc/dnsmasq.leases|/var/lib/dnsmasq/dnsmasq.leases|g' "$file"
80a7583
done
80a7583
80a7583
#enable dbus
0d9e8c4
sed -i 's|/\* #define HAVE_DBUS \*/|#define HAVE_DBUS|g' src/config.h
80a7583
80a7583
#enable /etc/dnsmasq.d fix bz 526703
80a7583
sed -i 's|#conf-dir=/etc/dnsmasq.d|conf-dir=/etc/dnsmasq.d|g' dnsmasq.conf.example
80a7583
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
80a7583
mkdir -p $RPM_BUILD_ROOT%{_sbindir} \
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/
6a4bb30
install -m 644 man/dnsmasq.8 $RPM_BUILD_ROOT%{_mandir}/man8/
b0365fb
a4a3c32
# Systemd 
a4a3c32
mkdir -p %{buildroot}%{_unitdir}
a4a3c32
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
a4a3c32
rm -rf %{buildroot}%{_initrddir}
a4a3c32
b0365fb
%clean
b0365fb
rm -rf $RPM_BUILD_ROOT
b0365fb
b0365fb
%post
a4a3c32
if [ $1 -eq 1 ] ; then
a4a3c32
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
1b09738
fi
b0365fb
b0365fb
%preun
a4a3c32
if [ $1 -eq 0 ]; then
a4a3c32
  /bin/systemctl --no-reload dnsmasq.service > /dev/null 2>&1 || :
a4a3c32
  /bin/systemctl stop dnsmasq.service > /dev/null 2>&1 || :
b0365fb
fi
b0365fb
b0365fb
a4a3c32
%postun 
a4a3c32
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
a4a3c32
if [ $1 -ge 1 ] ; then
a4a3c32
    /bin/systemctl try-restart dnsmasq.service >/dev/null 2>&1 || :
a4a3c32
fi
a4a3c32
a4a3c32
%triggerun -- dnsmasq < 2.52-3
a4a3c32
%{_bindir}/systemd-sysv-convert --save dnsmasq >/dev/null 2>&1 ||:
a4a3c32
/bin/systemctl enable dnsmasq.service >/dev/null 2>&1
a4a3c32
/sbin/chkconfig --del dnsmasq >/dev/null 2>&1 || :
a4a3c32
/bin/systemctl try-restart dnsmasq.service >/dev/null 2>&1 || :
a4a3c32
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
a4a3c32
%{_unitdir}/%{name}.service
b0365fb
%{_sbindir}/dnsmasq
b0365fb
%{_mandir}/man8/dnsmasq*
b0365fb
b0365fb
b0365fb
%changelog
79727a1
* Mon Aug 08 2011 Patrick "Jima" Laughton <jima@fedoraproject.org> - 2.52-5
0272224
- Include systemd unit file
0272224
a4a3c32
* Mon Aug 08 2011 Patrick "Jima" Laughton <jima@fedoraproject.org> - 2.52-3
a4a3c32
- Applied Jóhann's patch, minor cleanup
a4a3c32
a4a3c32
* Thu Jul 26 2011 Jóhann B. Guðmundsson <johannbg@gmail.com> - 2.52-3
a4a3c32
- Introduce systemd unit file, drop SysV support
a4a3c32
417aeba
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.52-2
417aeba
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
417aeba
0d9e8c4
* Tue Jan 26 2010 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 2.52-1
0d9e8c4
- New Version 2.52
0d9e8c4
- fix condrestart() in initscript bz 547605
0d9e8c4
- fix sed to enable DBUS(the '*' need some escaping) bz 553161
0d9e8c4
243a5a3
* Sun Nov 22 2009 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 2.51-2
243a5a3
- fix bz 512664
243a5a3
fa07928
* Sat Oct 17 2009 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 2.51-1
80a7583
- move initscript from patch to a plain text file
80a7583
- drop (dnsmasq-configuration.patch) and use sed instead
80a7583
- enable /etc/dnsmasq.d fix bz 526703
80a7583
- change requires to package name instead of file
fa07928
- new version 2.51
80a7583
8b0560d
* Mon Oct  5 2009 Mark McLoughlin <markmc@redhat.com> - 2.48-4
8b0560d
- Fix multiple TFTP server vulnerabilities (CVE-2009-2957, CVE-2009-2958)
8b0560d
27df76d
* Wed Aug 12 2009 Ville Skyttä <ville.skytta@iki.fi> - 2.48-3
27df76d
- Use lzma compressed upstream tarball.
27df76d
1ac3bd3
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.48-2
1ac3bd3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
1ac3bd3
01b090e
* Wed Jun 10 2009 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.48-1
01b090e
- Bugfix/feature enhancement update
01b090e
- Fixing BZ#494094
01b090e
7cad9d9
* Fri May 29 2009 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.47-1
7cad9d9
- Bugfix/feature enhancement update
7cad9d9
af406a1
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.46-2
af406a1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
af406a1
d2d8444
* Mon Dec 29 2008 Matěj Cepl <mcepl@redhat.com> - 2.45-2
d2d8444
- rebuilt
d2d8444
4bc8e57
* Mon Jul 21 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.45-1
4bc8e57
- Upstream release (bugfixes)
4bc8e57
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