inn.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. ##
  2. ## inn.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: inn
  27. Summary: InterNetNews Usenet Server
  28. URL: http://www.isc.org/products/INN/
  29. Vendor: Internet Software Consortium
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: BASE
  33. Group: News
  34. License: ISC
  35. Version: 2.4.1
  36. Release: 20041113
  37. # package options
  38. %option with_fsl yes
  39. # list of sources
  40. Source0: ftp://ftp.isc.org/isc/inn/inn-%{version}.tar.gz
  41. Source1: rc.inn
  42. Source2: fsl.inn
  43. Patch0: inn.patch
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, gzip, make, perl, bison, flex
  48. PreReq: OpenPKG, openpkg >= 20040130, gcc, gzip, perl, MTA
  49. BuildPreReq: db >= 4.3, openssl
  50. PreReq: db >= 4.3, openssl
  51. %if "%{with_fsl}" == "yes"
  52. BuildPreReq: fsl >= 1.2.0
  53. PreReq: fsl >= 1.2.0
  54. %endif
  55. AutoReq: no
  56. AutoReqProv: no
  57. %description
  58. InterNetNews (INN) is a complete Usenet system. It includes innd, an
  59. NNTP server, and nnrpd, a newsreading server. INN separates hosts
  60. that feed you news from those that have users reading news.
  61. %track
  62. prog inn = {
  63. version = %{version}
  64. url = ftp://ftp.isc.org/isc/inn/
  65. regex = inn-(__VER__)\.tar\.gz
  66. }
  67. %prep
  68. %setup -q
  69. %patch -p0
  70. %build
  71. # adjust some too strange INN paths
  72. %{l_shtool} subst \
  73. -e "s;^\\(PATHBIN.*=\\).*;\\1 \$(PATHNEWS)/libexec/inn;" \
  74. Makefile.global.in
  75. %{l_shtool} subst \
  76. -e "s;^\\(pathbin:.*\\)@prefix@.*;\\1@prefix@/libexec/inn;" \
  77. -e "s;^#bindaddress:.*;bindaddress: 127.0.0.1;" \
  78. -e "s;^#sourceaddress:.*;sourceaddress: 127.0.0.1;" \
  79. samples/inn.conf.in
  80. %{l_shtool} subst \
  81. -e 's;\(ExtUtils::Embed.*ldopts.*tail -1\);\1 | sed -e "s/ -lc\\$/ /" -e "s/ -lc / /";' \
  82. configure
  83. # configure the source tree
  84. CC="%{l_cc}" \
  85. CFLAGS="%{l_cflags -O} %{l_cppflags}" \
  86. LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
  87. LIBS="%{l_fsl_libs}" \
  88. ./configure \
  89. --prefix=%{l_prefix} \
  90. --bindir=%{l_prefix}/libexec/inn \
  91. --with-etc-dir=%{l_prefix}/etc/inn \
  92. --with-db-dir=%{l_prefix}/var/inn/db \
  93. --with-control-dir=%{l_prefix}/libexec/inn/control \
  94. --with-filter-dir=%{l_prefix}/libexec/inn/filter \
  95. --with-lib-dir=%{l_prefix}/lib/inn \
  96. --with-log-dir=%{l_prefix}/var/inn/log \
  97. --with-run-dir=%{l_prefix}/var/inn/run \
  98. --with-spool-dir=%{l_prefix}/var/inn/spool \
  99. --with-tmp-dir=%{l_prefix}/var/inn/tmp \
  100. --with-openssl=%{l_prefix} \
  101. --with-berkeleydb=%{l_prefix} \
  102. --with-news-user=%{l_rusr} \
  103. --with-news-group=%{l_rgrp} \
  104. --with-news-master=%{l_rusr} \
  105. --with-sendmail=%{l_prefix}/sbin/sendmail \
  106. --enable-uucp-rnews \
  107. --with-perl
  108. # build the INN system
  109. %{l_make} %{l_mflags}
  110. %install
  111. rm -rf $RPM_BUILD_ROOT
  112. # determine current user and group
  113. thisuser=`%{l_shtool} echo -e '%u'`
  114. thisgroup=`%{l_shtool} echo -e '%g'`
  115. if [ ".$thisgroup" = . ]; then
  116. thisgroup="$thisuser"
  117. fi
  118. # adjust INN installation procedure
  119. %{l_shtool} subst \
  120. -e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  121. -e "s;^\\(PATH.*=[ ]*\\)\\(%{l_prefix}\\);\\1 $RPM_BUILD_ROOT\\2;" \
  122. -e "s;^\\(NEWSUSER.*=\\).*;\\1 $thisuser;" \
  123. -e "s;^\\(NEWSGROUP.*=\\).*;\\1 $thisgroup;" \
  124. -e "s;^\\(OWNER.*=\\).*;\\1;" \
  125. -e "s;^\\(ROWNER.*=\\).*;\\1;" \
  126. Makefile.global
  127. # perform installation procedure
  128. %{l_make} %{l_mflags} install
  129. # make some programs manually accessible
  130. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  131. for bin in controlbatch controlchan news2mail startinnfeed overchan \
  132. archive innmail innconfval ctlinnd inews rnews nntpsend; do
  133. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/$bin \
  134. $RPM_BUILD_ROOT%{l_prefix}/bin/$bin
  135. done
  136. # strip installation
  137. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/*.py
  138. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/*.tcl
  139. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/lib*.a
  140. rm -rf $RPM_BUILD_ROOT%{l_prefix}/doc
  141. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
  142. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  143. # adjust configuration
  144. ( echo ''
  145. echo '# dummy entry to make INN happy as long as'
  146. echo '# this server has no real newsfeeds configured.'
  147. echo 'dummy-feed:!*::'
  148. echo ''
  149. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/newsfeeds
  150. ( echo ''
  151. echo '# use the traditional spool area for storage'
  152. echo 'method tradspool {'
  153. echo ' newsgroups: *'
  154. echo ' class: 1'
  155. echo '}'
  156. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/storage.conf
  157. # create initial history database
  158. touch $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/history
  159. # adjust permissions
  160. chmod 664 $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/active
  161. # install run-command script
  162. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  163. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  164. %{SOURCE rc.inn} \
  165. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  166. # install OSSP fsl configuration
  167. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  168. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  169. %{SOURCE fsl.inn} \
  170. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  171. # strip binaries
  172. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
  173. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/* 2>/dev/null || true
  174. # create temporary directory
  175. %{l_shtool} mkdir -f -p -m 770 \
  176. $RPM_BUILD_ROOT%{l_prefix}/var/inn/tmp
  177. # move default db to template space
  178. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/db
  179. mv $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/* \
  180. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/db/
  181. # determine file list
  182. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  183. %{l_files_std} \
  184. '%not %dir %{l_prefix}/etc/fsl' \
  185. '%config %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/fsl/fsl.inn' \
  186. '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/inn/*' \
  187. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/inn/innreport_inn.pm' \
  188. '%attr(6550,%{l_rusr},%{l_rgrp}) %{l_prefix}/libexec/inn/rnews' \
  189. '%attr(6750,%{l_susr},%{l_rgrp}) %{l_prefix}/libexec/inn/inndstart' \
  190. '%attr(6750,%{l_susr},%{l_rgrp}) %{l_prefix}/libexec/inn/startinnfeed' \
  191. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/cnfsheadconf' \
  192. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/ctlinnd' \
  193. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/expire' \
  194. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/expireover' \
  195. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/expirerm' \
  196. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/imapfeed' \
  197. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/inews' \
  198. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/inncheck' \
  199. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innd' \
  200. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innfeed' \
  201. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innreport' \
  202. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innstat' \
  203. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innupgrade' \
  204. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innwatch' \
  205. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/makedbz' \
  206. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/makehistory' \
  207. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/mod-active' \
  208. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/news.daily' \
  209. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/ovdb_*' \
  210. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/overchan' \
  211. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/procbatch' \
  212. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/prunehistory' \
  213. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/rc.news' \
  214. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/scanlogs' \
  215. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/tally.control' \
  216. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/tdx-util' \
  217. '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/writelog' \
  218. '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/db' \
  219. '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/log' \
  220. '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/run' \
  221. '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/spool' \
  222. '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/spool/*' \
  223. '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/tmp'
  224. %files -f files
  225. %clean
  226. rm -rf $RPM_BUILD_ROOT
  227. %post
  228. # after install, create db as restricted user
  229. if [ $1 -eq 1 ]; then
  230. for f in active active.times history newsgroups; do
  231. %{l_shtool} install -c -m 644 -o %{l_rusr} -g %{l_rgrp} \
  232. $RPM_INSTALL_PREFIX/libexec/inn/db/$f \
  233. $RPM_INSTALL_PREFIX/var/inn/db/
  234. done
  235. su - %{l_rusr} -c "$RPM_INSTALL_PREFIX/libexec/inn/makedbz -i -o"
  236. fi
  237. # after upgrade, restart service
  238. [ $1 -eq 2 ] || exit 0
  239. eval `%{l_rc} inn status 2>/dev/null`
  240. [ ".$inn_active" = .yes ] && %{l_rc} inn restart
  241. exit 0
  242. %preun
  243. # before erase, stop service and remove log files
  244. [ $1 -eq 0 ] || exit 0
  245. %{l_rc} inn stop 2>/dev/null
  246. rm -rf $RPM_INSTALL_PREFIX/var/inn/log/* >/dev/null 2>&1 || true
  247. exit 0