dnsmasq-vl.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. %bcond_with systemd
  2. Name: dnsmasq
  3. Version: 2.85
  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: https://www.thekelleys.org.uk/dnsmasq/
  12. Source0: https://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. sed -i \
  70. -e '/^#interface=/a # Listen only on localhost by default\ninterface=lo\n' \
  71. -e '/^#no-dhcp-interface=/a \\n# Serve DNS and DHCP only to networks directly connected to this machine.\n# Any interface= line will override it.\n#local-service\n' \
  72. -e '/^#bind-interfaces/a #\n# To listen only on localhost and do not receive packets on other\n# interfaces, bind only to lo device. Comment out to bind on single\n# wildcard socket.\nbind-interfaces\n' \
  73. -e '/^#bind-interfaces/d' \
  74. -e 's|/var/lib/misc/|/var/lib/dnsmasq/|' \
  75. dnsmasq.conf.example
  76. %build
  77. make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
  78. make %{?_smp_mflags} -C contrib/lease-tools CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
  79. %install
  80. rm -rf $RPM_BUILD_ROOT
  81. # normally i'd do 'make install'...it's a bit messy, though
  82. mkdir -p $RPM_BUILD_ROOT%{_sbindir} \
  83. $RPM_BUILD_ROOT%{_mandir}/man8 \
  84. $RPM_BUILD_ROOT%{_var}/lib/dnsmasq \
  85. $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.d \
  86. $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
  87. install src/dnsmasq $RPM_BUILD_ROOT%{_sbindir}/dnsmasq
  88. install dnsmasq.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.conf
  89. install dbus/dnsmasq.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/
  90. install -m 644 man/dnsmasq.8 $RPM_BUILD_ROOT%{_mandir}/man8/
  91. install -D trust-anchors.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/trust-anchors.conf
  92. # utils sub package
  93. mkdir -p $RPM_BUILD_ROOT%{_bindir} \
  94. $RPM_BUILD_ROOT%{_mandir}/man1
  95. install -m 755 contrib/lease-tools/dhcp_release $RPM_BUILD_ROOT%{_bindir}/dhcp_release
  96. install -m 644 contrib/lease-tools/dhcp_release.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release.1
  97. install -m 755 contrib/lease-tools/dhcp_release6 $RPM_BUILD_ROOT%{_bindir}/dhcp_release6
  98. install -m 644 contrib/lease-tools/dhcp_release6.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release6.1
  99. install -m 755 contrib/lease-tools/dhcp_lease_time $RPM_BUILD_ROOT%{_bindir}/dhcp_lease_time
  100. install -m 644 contrib/lease-tools/dhcp_lease_time.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_lease_time.1
  101. %if %{with systemd}
  102. # Systemd
  103. mkdir -p %{buildroot}%{_unitdir}
  104. install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
  105. rm -rf %{buildroot}%{_initrddir}
  106. #install systemd sysuser file
  107. install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
  108. %else
  109. mkdir -p $RPM_BUILD_ROOT%{_initrddir}
  110. install rpm/dnsmasq.init $RPM_BUILD_ROOT%{_initrddir}/dnsmasq
  111. %endif
  112. %clean
  113. rm -rf $RPM_BUILD_ROOT
  114. %pre
  115. %if %{with systemd}
  116. #precreate users so that rpm can install files owned by that user
  117. %sysusers_create_package %{name} %{SOURCE2}
  118. %else
  119. getent group dnsmasq >/dev/null || groupadd -r dnsmasq
  120. getent passwd dnsmasq >/dev/null || \
  121. useradd -r -g dnsmasq -d /var/lib/dnsmasq -s /sbin/nologin \
  122. -c "Dnsmasq DHCP and DNS server" dnsmasq
  123. exit 0
  124. %endif
  125. %post
  126. %if %{with systemd}
  127. %systemd_post dnsmasq.service
  128. %endif
  129. if [ "$1" = "2" ]; then # if we're being upgraded
  130. # if using the old leases location, move the file to the new one
  131. # but only if we're not clobbering another file
  132. #
  133. if [ -f /var/lib/misc/dnsmasq.leases -a ! -f /var/lib/dnsmasq/dnsmasq.leases ]; then
  134. # causes rpmlint to report dangerous-command-in-post,
  135. # but that's the price of selinux compliance :-(
  136. mv -f /var/lib/misc/dnsmasq.leases /var/lib/dnsmasq/dnsmasq.leases || :
  137. fi
  138. # ugly, but kind of necessary
  139. if [ ! `grep -q dhcp-leasefile=/var/lib/misc/dnsmasq.leases %{_sysconfdir}/dnsmasq.conf` ]; then
  140. cp %{_sysconfdir}/dnsmasq.conf %{_sysconfdir}/dnsmasq.conf.tmp || :
  141. sed -e 's/var\/lib\/misc/var\/lib\/dnsmasq/' < %{_sysconfdir}/dnsmasq.conf.tmp > %{_sysconfdir}/dnsmasq.conf || :
  142. rm -f %{_sysconfdir}/dnsmasq.conf.tmp || :
  143. fi
  144. %if !%{with systemd}
  145. else # if we're being installed
  146. /sbin/chkconfig --add dnsmasq
  147. %endif
  148. fi
  149. %preun
  150. %if %{with systemd}
  151. %systemd_preun dnsmasq.service
  152. %else
  153. if [ "$1" = "0" -o -x /bin/systemctl ]; then # execute this only if we are NOT doing an upgrade
  154. /sbin/service dnsmasq stop >/dev/null 2>&1 || :
  155. /sbin/chkconfig --del dnsmasq
  156. fi
  157. %endif
  158. %postun
  159. %if %{with systemd}
  160. %systemd_postun_with_restart dnsmasq.service
  161. %else
  162. if [ "$1" -gt "0" ]; then
  163. /sbin/service dnsmasq condrestart >/dev/null 2>&1 || :
  164. fi
  165. %endif
  166. %files
  167. %defattr(-,root,root,-)
  168. %license COPYING*
  169. %doc CHANGELOG FAQ doc.html setup.html dbus/DBus-interface
  170. %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dnsmasq.conf
  171. %dir /etc/dnsmasq.d
  172. %dir %{_var}/lib/dnsmasq
  173. %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/dnsmasq.conf
  174. %dir %{_datadir}/dnsmasq
  175. %{_datadir}/dnsmasq/*
  176. %{_sbindir}/dnsmasq
  177. %{_mandir}/man8/dnsmasq*
  178. %if %{with systemd}
  179. %{_unitdir}/%{name}.service
  180. %{_sysusersdir}/dnsmasq.conf
  181. %else
  182. %{_initrddir}/dnsmasq
  183. %endif
  184. %{_bindir}/dhcp_*
  185. %{_mandir}/man1/dhcp_*
  186. %changelog
  187. * Thu Apr 22 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.85-1
  188. - new upstream release.
  189. * Thu Mar 25 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.84-2
  190. - updated the configuration file to fix CVE-2020-14312.
  191. * Thu Jan 28 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.84-1
  192. - new upstream release.
  193. * Tue Sep 08 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.82-1
  194. - new upstream release.
  195. * Sat May 23 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.81-1
  196. - new upstream release.
  197. - added systemd support (disabled as default).
  198. * Sat Mar 21 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.80-2
  199. - rebuilt with libidn2.
  200. * Sat May 25 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.80-1
  201. - new upstream release.
  202. * Tue Jul 5 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.76-1
  203. - new upstream release.
  204. * Sat Dec 28 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.45-3
  205. - rebuild with VineSeed environment
  206. * Sun Apr 17 2011 Shu KONNO <owa@bg.wakwak.com> 2.45-2
  207. - rebuilt with rpm-4.8.1-3
  208. * Thu Jul 31 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.45-1
  209. - initial build for Vine Linux
  210. * Mon Jul 21 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.45-1
  211. - Upstream release (bugfixes)
  212. * Wed Jul 16 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.43-2
  213. - New upstream release, contains fixes for CVE-2008-1447/CERT VU#800113
  214. - Dropped patch for newer glibc (merged upstream)
  215. * Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.8
  216. - Added upstream-authored patch for newer glibc (thanks Simon!)
  217. * Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.7
  218. - New upstream release
  219. * Wed Jan 30 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.6.rc1
  220. - Release candidate
  221. - Happy Birthday Isaac!
  222. * Wed Jan 23 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.5.test30
  223. - Bugfix update
  224. * Mon Dec 31 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.4.test26
  225. - Bugfix/feature enhancement update
  226. * Thu Dec 13 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.3.test24
  227. - Upstream fix for fairly serious regression
  228. * Tue Dec 04 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.2.test20
  229. - New upstream test release
  230. - Moving dnsmasq.leases to /var/lib/dnsmasq/ as per BZ#407901
  231. - Ignoring dangerous-command-in-%%post rpmlint warning (as per above fix)
  232. - Patch consolidation/cleanup
  233. - Removed conditionals for Fedora <= 3 and Aurora 2.0
  234. * Tue Sep 18 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-1
  235. - Finalized upstream release
  236. - Removing URLs from patch lines (CVS is the authoritative source)
  237. - Added more magic to make spinning rc/test packages more seamless
  238. * Sun Aug 26 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-0.1.rc2
  239. - New upstream release candidate (feature-frozen), thanks Simon!
  240. - License clarification
  241. * Tue May 29 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.39-1
  242. - New upstream version (bugfixes, enhancements)
  243. * Mon Feb 12 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.38-1
  244. - New upstream version with bugfix for potential hang
  245. * Tue Feb 06 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.37-1
  246. - New upstream version
  247. * Wed Jan 24 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.36-1
  248. - New upstream version
  249. * Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-2
  250. - Stop creating /etc/sysconfig on %%install
  251. - Create /etc/dnsmasq.d on %%install
  252. * Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-1
  253. - Update to 2.35
  254. - Removed UPGRADING_to_2.0 from %%doc as per upstream change
  255. - Enabled conf-dir in default config as per RFE BZ#214220 (thanks Chris!)
  256. - Added %%dir /etc/dnsmasq.d to %%files as per above RFE
  257. * Tue Oct 24 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-2
  258. - Fixed BZ#212005
  259. - Moved %%postun scriptlet to %%post, where it made more sense
  260. - Render scriptlets safer
  261. - Minor cleanup for consistency
  262. * Thu Oct 19 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-1
  263. - Hardcoded version in patches, as I'm getting tired of updating them
  264. - Update to 2.34
  265. * Mon Aug 28 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-2
  266. - Rebuild for FC6
  267. * Tue Aug 15 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-1
  268. - Update
  269. * Sat Jul 22 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-3
  270. - Added pkgconfig BuildReq due to reduced buildroot
  271. * Thu Jul 20 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-2
  272. - Forced update due to dbus version bump
  273. * Mon Jun 12 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-1
  274. - Update from upstream
  275. - Patch from Dennis Gilmore fixed the conditionals to detect Aurora Linux
  276. * Mon May 8 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.31-1
  277. - Removed dbus config patch (now provided upstream)
  278. - Patched in init script (no longer provided upstream)
  279. - Added DBus-interface to docs
  280. * Tue May 2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4.2
  281. - More upstream-recommended cleanups :)
  282. - Killed sysconfig file (provides unneeded functionality)
  283. - Tweaked init script a little more
  284. * Tue May 2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4
  285. - Moved options out of init script and into /etc/sysconfig/dnsmasq
  286. - Disabled DHCP_LEASE in sysconfig file, fixing bug #190379
  287. - Simon Kelley provided dbus/dnsmasq.conf, soon to be part of the tarball
  288. * Thu Apr 27 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-3
  289. - Un-enabled HAVE_ISC_READER, a hack to enable a deprecated feature (request)
  290. - Split initscript & enable-dbus patches, conditionalized dbus for FC3
  291. - Tweaked name field in changelog entries (trying to be consistent)
  292. * Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-2
  293. - Disabled stripping of binary while installing (oops)
  294. - Enabled HAVE_ISC_READER/HAVE_DBUS via patch
  295. - Added BuildReq for dbus-devel
  296. * Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-1
  297. - Initial Fedora Extras RPM