inn.spec 11 KB

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