dnsmasq-vl.spec 12 KB

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