dnsmasq-vl.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. %bcond_with systemd
  2. Name: dnsmasq
  3. Version: 2.84
  4. Release: 1%{?_dist_release}%{?with_systemd:.systemd}
  5. Summary: A lightweight DHCP/caching DNS server
  6. Summary(ja): 軽量 DHCP/DNSキャッシュサーバ
  7. Group: servers
  8. Vendor: Project Vine
  9. Distribution: Vine Linux
  10. License: GPLv2 or GPLv3
  11. URL: http://www.thekelleys.org.uk/dnsmasq/
  12. Source0: http://www.thekelleys.org.uk/dnsmasq/%{name}-%{version}.tar.xz
  13. Source1: %{name}.service
  14. Source2: dnsmasq-systemd-sysusers.conf
  15. Patch0: %{name}-2.33-initscript.patch
  16. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
  17. BuildRequires: dbus-devel, libidn2-devel, nettle-devel
  18. BuildRequires: pkgconfig
  19. Requires(pre): shadow-utils
  20. Requires(post): /bin/sed /bin/grep
  21. %if %{with systemd}
  22. BuildRequires: systemd
  23. %{?systemd_requires}
  24. %else
  25. Requires(post): /sbin/chkconfig
  26. Requires(post): /sbin/service
  27. Requires(preun): /sbin/chkconfig
  28. Requires(preun): /sbin/service
  29. Requires(postun): /sbin/service
  30. %endif
  31. %description
  32. Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
  33. It is designed to provide DNS and, optionally, DHCP, to a small network.
  34. It can serve the names of local machines which are not in the global
  35. DNS. The DHCP server integrates with the DNS server and allows machines
  36. with DHCP-allocated addresses to appear in the DNS with names configured
  37. either in each host or in a central configuration file. Dnsmasq supports
  38. static and dynamic DHCP leases and BOOTP for network booting of diskless
  39. machines.
  40. %debug_package
  41. %prep
  42. %setup -q -n %{name}-%{version}
  43. %if !%{with systemd}
  44. %patch0 -p1
  45. %endif
  46. # use /var/lib/dnsmasq instead of /var/lib/misc
  47. for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do
  48. sed -i 's|/var/lib/misc/dnsmasq.leases|/var/lib/dnsmasq/dnsmasq.leases|g' "$file"
  49. done
  50. # fix the path to the trust anchor
  51. sed -i 's|%%%%PREFIX%%%%|%{_prefix}|' dnsmasq.conf.example
  52. #set dnsmasq user / group
  53. sed -i 's|#user=|user=dnsmasq|' dnsmasq.conf.example
  54. sed -i 's|#group=|group=dnsmasq|' dnsmasq.conf.example
  55. #set default user /group in src/config.h
  56. sed -i 's|#define CHUSER "nobody"|#define CHUSER "dnsmasq"|' src/config.h
  57. sed -i 's|#define CHGRP "dip"|#define CHGRP "dnsmasq"|' src/config.h
  58. #enable dbus
  59. sed -i 's|/\* #define HAVE_DBUS \*/|#define HAVE_DBUS|g' src/config.h
  60. #enable libidn2 support
  61. sed -i 's|/\* #define HAVE_LIBIDN2 \*/|#define HAVE_LIBIDN2|g' src/config.h
  62. #enable DNSSEC support
  63. sed -i 's|/\* #define HAVE_DNSSEC \*/|#define HAVE_DNSSEC|g' src/config.h
  64. #enable /etc/dnsmasq.d fix bz 526703, ignore RPM backup files
  65. cat << EOF >> dnsmasq.conf.example
  66. # Include all files in /etc/dnsmasq.d except RPM backup files
  67. conf-dir=%{_sysconfdir}/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
  68. EOF
  69. %build
  70. make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
  71. make %{?_smp_mflags} -C contrib/lease-tools CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
  72. %install
  73. rm -rf $RPM_BUILD_ROOT
  74. # normally i'd do 'make install'...it's a bit messy, though
  75. mkdir -p $RPM_BUILD_ROOT%{_sbindir} \
  76. $RPM_BUILD_ROOT%{_mandir}/man8 \
  77. $RPM_BUILD_ROOT%{_var}/lib/dnsmasq \
  78. $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.d \
  79. $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
  80. install src/dnsmasq $RPM_BUILD_ROOT%{_sbindir}/dnsmasq
  81. install dnsmasq.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.conf
  82. install dbus/dnsmasq.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/
  83. install -m 644 man/dnsmasq.8 $RPM_BUILD_ROOT%{_mandir}/man8/
  84. install -D trust-anchors.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/trust-anchors.conf
  85. # utils sub package
  86. mkdir -p $RPM_BUILD_ROOT%{_bindir} \
  87. $RPM_BUILD_ROOT%{_mandir}/man1
  88. install -m 755 contrib/lease-tools/dhcp_release $RPM_BUILD_ROOT%{_bindir}/dhcp_release
  89. install -m 644 contrib/lease-tools/dhcp_release.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release.1
  90. install -m 755 contrib/lease-tools/dhcp_release6 $RPM_BUILD_ROOT%{_bindir}/dhcp_release6
  91. install -m 644 contrib/lease-tools/dhcp_release6.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release6.1
  92. install -m 755 contrib/lease-tools/dhcp_lease_time $RPM_BUILD_ROOT%{_bindir}/dhcp_lease_time
  93. install -m 644 contrib/lease-tools/dhcp_lease_time.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_lease_time.1
  94. %if %{with systemd}
  95. # Systemd
  96. mkdir -p %{buildroot}%{_unitdir}
  97. install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
  98. rm -rf %{buildroot}%{_initrddir}
  99. #install systemd sysuser file
  100. install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
  101. %else
  102. mkdir -p $RPM_BUILD_ROOT%{_initrddir}
  103. install rpm/dnsmasq.init $RPM_BUILD_ROOT%{_initrddir}/dnsmasq
  104. %endif
  105. %clean
  106. rm -rf $RPM_BUILD_ROOT
  107. %pre
  108. %if %{with systemd}
  109. #precreate users so that rpm can install files owned by that user
  110. %sysusers_create_package %{name} %{SOURCE2}
  111. %else
  112. getent group dnsmasq >/dev/null || groupadd -r dnsmasq
  113. getent passwd dnsmasq >/dev/null || \
  114. useradd -r -g dnsmasq -d /var/lib/dnsmasq -s /sbin/nologin \
  115. -c "Dnsmasq DHCP and DNS server" dnsmasq
  116. exit 0
  117. %endif
  118. %post
  119. %if %{with systemd}
  120. %systemd_post dnsmasq.service
  121. %endif
  122. if [ "$1" = "2" ]; then # if we're being upgraded
  123. # if using the old leases location, move the file to the new one
  124. # but only if we're not clobbering another file
  125. #
  126. if [ -f /var/lib/misc/dnsmasq.leases -a ! -f /var/lib/dnsmasq/dnsmasq.leases ]; then
  127. # causes rpmlint to report dangerous-command-in-post,
  128. # but that's the price of selinux compliance :-(
  129. mv -f /var/lib/misc/dnsmasq.leases /var/lib/dnsmasq/dnsmasq.leases || :
  130. fi
  131. # ugly, but kind of necessary
  132. if [ ! `grep -q dhcp-leasefile=/var/lib/misc/dnsmasq.leases %{_sysconfdir}/dnsmasq.conf` ]; then
  133. cp %{_sysconfdir}/dnsmasq.conf %{_sysconfdir}/dnsmasq.conf.tmp || :
  134. sed -e 's/var\/lib\/misc/var\/lib\/dnsmasq/' < %{_sysconfdir}/dnsmasq.conf.tmp > %{_sysconfdir}/dnsmasq.conf || :
  135. rm -f %{_sysconfdir}/dnsmasq.conf.tmp || :
  136. fi
  137. %if !%{with systemd}
  138. else # if we're being installed
  139. /sbin/chkconfig --add dnsmasq
  140. %endif
  141. fi
  142. %preun
  143. %if %{with systemd}
  144. %systemd_preun dnsmasq.service
  145. %else
  146. if [ "$1" = "0" -o -x /bin/systemctl ]; then # execute this only if we are NOT doing an upgrade
  147. /sbin/service dnsmasq stop >/dev/null 2>&1 || :
  148. /sbin/chkconfig --del dnsmasq
  149. fi
  150. %endif
  151. %postun
  152. %if %{with systemd}
  153. %systemd_postun_with_restart dnsmasq.service
  154. %else
  155. if [ "$1" -gt "0" ]; then
  156. /sbin/service dnsmasq condrestart >/dev/null 2>&1 || :
  157. fi
  158. %endif
  159. %files
  160. %defattr(-,root,root,-)
  161. %license COPYING*
  162. %doc CHANGELOG FAQ doc.html setup.html dbus/DBus-interface
  163. %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dnsmasq.conf
  164. %dir /etc/dnsmasq.d
  165. %dir %{_var}/lib/dnsmasq
  166. %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/dnsmasq.conf
  167. %dir %{_datadir}/dnsmasq
  168. %{_datadir}/dnsmasq/*
  169. %{_sbindir}/dnsmasq
  170. %{_mandir}/man8/dnsmasq*
  171. %if %{with systemd}
  172. %{_unitdir}/%{name}.service
  173. %{_sysusersdir}/dnsmasq.conf
  174. %else
  175. %{_initrddir}/dnsmasq
  176. %endif
  177. %{_bindir}/dhcp_*
  178. %{_mandir}/man1/dhcp_*
  179. %changelog
  180. * Thu Jan 28 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.84-1
  181. - new upstream release.
  182. * Tue Sep 08 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.82-1
  183. - new upstream release.
  184. * Sat May 23 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.81-1
  185. - new upstream release.
  186. - added systemd support (disabled as default).
  187. * Sat Mar 21 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.80-2
  188. - rebuilt with libidn2.
  189. * Sat May 25 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.80-1
  190. - new upstream release.
  191. * Tue Jul 5 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.76-1
  192. - new upstream release.
  193. * Sat Dec 28 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.45-3
  194. - rebuild with VineSeed environment
  195. * Sun Apr 17 2011 Shu KONNO <owa@bg.wakwak.com> 2.45-2
  196. - rebuilt with rpm-4.8.1-3
  197. * Thu Jul 31 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.45-1
  198. - initial build for Vine Linux
  199. * Mon Jul 21 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.45-1
  200. - Upstream release (bugfixes)
  201. * Wed Jul 16 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.43-2
  202. - New upstream release, contains fixes for CVE-2008-1447/CERT VU#800113
  203. - Dropped patch for newer glibc (merged upstream)
  204. * Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.8
  205. - Added upstream-authored patch for newer glibc (thanks Simon!)
  206. * Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.7
  207. - New upstream release
  208. * Wed Jan 30 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.6.rc1
  209. - Release candidate
  210. - Happy Birthday Isaac!
  211. * Wed Jan 23 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.5.test30
  212. - Bugfix update
  213. * Mon Dec 31 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.4.test26
  214. - Bugfix/feature enhancement update
  215. * Thu Dec 13 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.3.test24
  216. - Upstream fix for fairly serious regression
  217. * Tue Dec 04 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.2.test20
  218. - New upstream test release
  219. - Moving dnsmasq.leases to /var/lib/dnsmasq/ as per BZ#407901
  220. - Ignoring dangerous-command-in-%%post rpmlint warning (as per above fix)
  221. - Patch consolidation/cleanup
  222. - Removed conditionals for Fedora <= 3 and Aurora 2.0
  223. * Tue Sep 18 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-1
  224. - Finalized upstream release
  225. - Removing URLs from patch lines (CVS is the authoritative source)
  226. - Added more magic to make spinning rc/test packages more seamless
  227. * Sun Aug 26 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-0.1.rc2
  228. - New upstream release candidate (feature-frozen), thanks Simon!
  229. - License clarification
  230. * Tue May 29 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.39-1
  231. - New upstream version (bugfixes, enhancements)
  232. * Mon Feb 12 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.38-1
  233. - New upstream version with bugfix for potential hang
  234. * Tue Feb 06 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.37-1
  235. - New upstream version
  236. * Wed Jan 24 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.36-1
  237. - New upstream version
  238. * Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-2
  239. - Stop creating /etc/sysconfig on %%install
  240. - Create /etc/dnsmasq.d on %%install
  241. * Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-1
  242. - Update to 2.35
  243. - Removed UPGRADING_to_2.0 from %%doc as per upstream change
  244. - Enabled conf-dir in default config as per RFE BZ#214220 (thanks Chris!)
  245. - Added %%dir /etc/dnsmasq.d to %%files as per above RFE
  246. * Tue Oct 24 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-2
  247. - Fixed BZ#212005
  248. - Moved %%postun scriptlet to %%post, where it made more sense
  249. - Render scriptlets safer
  250. - Minor cleanup for consistency
  251. * Thu Oct 19 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-1
  252. - Hardcoded version in patches, as I'm getting tired of updating them
  253. - Update to 2.34
  254. * Mon Aug 28 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-2
  255. - Rebuild for FC6
  256. * Tue Aug 15 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-1
  257. - Update
  258. * Sat Jul 22 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-3
  259. - Added pkgconfig BuildReq due to reduced buildroot
  260. * Thu Jul 20 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-2
  261. - Forced update due to dbus version bump
  262. * Mon Jun 12 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-1
  263. - Update from upstream
  264. - Patch from Dennis Gilmore fixed the conditionals to detect Aurora Linux
  265. * Mon May 8 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.31-1
  266. - Removed dbus config patch (now provided upstream)
  267. - Patched in init script (no longer provided upstream)
  268. - Added DBus-interface to docs
  269. * Tue May 2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4.2
  270. - More upstream-recommended cleanups :)
  271. - Killed sysconfig file (provides unneeded functionality)
  272. - Tweaked init script a little more
  273. * Tue May 2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4
  274. - Moved options out of init script and into /etc/sysconfig/dnsmasq
  275. - Disabled DHCP_LEASE in sysconfig file, fixing bug #190379
  276. - Simon Kelley provided dbus/dnsmasq.conf, soon to be part of the tarball
  277. * Thu Apr 27 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-3
  278. - Un-enabled HAVE_ISC_READER, a hack to enable a deprecated feature (request)
  279. - Split initscript & enable-dbus patches, conditionalized dbus for FC3
  280. - Tweaked name field in changelog entries (trying to be consistent)
  281. * Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-2
  282. - Disabled stripping of binary while installing (oops)
  283. - Enabled HAVE_ISC_READER/HAVE_DBUS via patch
  284. - Added BuildReq for dbus-devel
  285. * Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-1
  286. - Initial Fedora Extras RPM