inn.spec 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. ##
  2. ## inn.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2001 Ralf S. Engelschall <rse@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. %define V_build stable
  25. %define V_release 2.3.2
  26. %define V_stable 20011019
  27. # package information
  28. Name: inn
  29. Summary: InterNetNews Usenet Server
  30. URL: http://www.isc.org/products/INN/
  31. Vendor: Internet Software Consortium
  32. Packager: The OpenPKG Project
  33. Distribution: OpenPKG [EXP]
  34. Group: News
  35. License: ISC
  36. %if "%{V_build}" == "release"
  37. Version: %{V_release}
  38. %else
  39. Version: %{V_release}.%{V_stable}
  40. %endif
  41. Release: %{l_branch}.0
  42. # list of sources
  43. Source0: ftp://ftp.openpkg.org/DST/inn/fakesyslog.tar.gz
  44. Source1: ftp://ftp.isc.org/isc/inn/inn-%{V_release}.tar.gz
  45. Source2: ftp://ftp.isc.org/isc/inn/snapshots/inn-STABLE-%{V_stable}.tar.gz
  46. Source3: rc.inn
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20011023.0, make, perl, db, openssl
  51. PreReq: OpenPKG, openpkg >= 20011023.0, perl, MTA
  52. AutoReq: no
  53. AutoReqProv: no
  54. %description
  55. InterNetNews (INN) is a complete Usenet system. It includes innd, an
  56. NNTP server, and nnrpd, a newsreading server. INN separates hosts
  57. that feed you news from those that have users reading news.
  58. %prep
  59. %setup0 -q -c
  60. %if "%{V_build}" == "release"
  61. %setup1 -q -T -D -a 1
  62. %else
  63. %setup2 -q -T -D -a 2
  64. %endif
  65. %build
  66. # make sure INN finds our own files
  67. PATH="%{l_prefix}/bin:$PATH"
  68. export PATH
  69. # build faked syslog(3) library
  70. fakesyslogdir="`pwd`/fakesyslog"
  71. ( cd fakesyslog
  72. CC="%{l_cc}" \
  73. CFLAGS="%{l_cflags -O}" \
  74. ./configure \
  75. --with-logfile=%{l_prefix}/var/inn/log/news.log
  76. %{l_make} %{l_mflags}
  77. )
  78. %if "%{V_build}" == "release"
  79. cd inn-%{V_release}
  80. %else
  81. cd inn-STABLE-%{V_stable}
  82. %endif
  83. # adjust some too strange INN paths
  84. %{l_rpmtool} subst \
  85. "s;^\\(PATHBIN.*=\\).*;\\1 \$(PATHNEWS)/libexec/inn;" \
  86. -- Makefile.global.in
  87. %{l_rpmtool} subst \
  88. "s;^\\(pathbin:.*\\)@prefix@.*;\\1@prefix@/libexec/inn;" \
  89. -- samples/inn.conf.in
  90. # configure the source tree
  91. CC="%{l_cc}" \
  92. CFLAGS="%{l_cflags -O}" \
  93. LDFLAGS="-L$fakesyslogdir" \
  94. LIBS="-lfakesyslog" \
  95. ./configure \
  96. --prefix=%{l_prefix} \
  97. --bindir=%{l_prefix}/libexec/inn \
  98. --with-etc-dir=%{l_prefix}/etc/inn \
  99. --with-db-dir=%{l_prefix}/var/inn/db \
  100. --with-control-dir=%{l_prefix}/libexec/inn/control \
  101. --with-filter-dir=%{l_prefix}/libexec/inn/filter \
  102. --with-lib-dir=%{l_prefix}/lib/inn \
  103. --with-log-dir=%{l_prefix}/var/inn/log \
  104. --with-run-dir=%{l_prefix}/var/inn/run \
  105. --with-spool-dir=%{l_prefix}/var/inn/spool \
  106. --with-tmp-path=%{l_prefix}/var/inn/tmp \
  107. --with-openssl=%{l_prefix} \
  108. --with-berkeleydb=%{l_prefix} \
  109. --with-news-user=%{l_fsusr} \
  110. --with-news-group=%{l_fsusr} \
  111. --with-news-master=%{l_fsusr} \
  112. --with-sendmail=%{l_prefix}/sbin/sendmail \
  113. --enable-uucp-rnews \
  114. --with-perl
  115. # build the INN system
  116. %{l_make} %{l_mflags}
  117. %install
  118. rm -rf $RPM_BUILD_ROOT
  119. %if "%{V_build}" == "release"
  120. cd inn-%{V_release}
  121. %else
  122. cd inn-STABLE-%{V_stable}
  123. %endif
  124. # determine current user and group
  125. thisuser=`(id -un) 2>/dev/null ||\
  126. (whoami) 2>/dev/null ||\
  127. (who am i | cut "-d " -f1) 2>/dev/null ||\
  128. echo $LOGNAME`
  129. thisgroup=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
  130. grep "^${thisuser}:" | awk -F: '{ print $4; }' | head -1`
  131. thisgroup=`(cat /etc/group; ypcat group) 2>/dev/null |\
  132. grep ":${thisgroup}:" | awk -F: '{ print $1; }' | head -1`
  133. if [ ".$thisgroup" = . ]; then
  134. thisgroup="$thisuser"
  135. fi
  136. # adjust INN installation procedure
  137. %{l_rpmtool} subst \
  138. "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  139. "s;^\\(PATH.*=[ ]*\\)\\(%{l_prefix}\\);\\1 $RPM_BUILD_ROOT\\2;" \
  140. "s;^\\(NEWSUSER.*=\\).*;\\1 $thisuser;" \
  141. "s;^\\(NEWSGROUP.*=\\).*;\\1 $thisgroup;" \
  142. "s;^\\(OWNER.*=\\).*;\\1;" \
  143. "s;^\\(ROWNER.*=\\).*;\\1;" \
  144. -- Makefile.global
  145. # perform installation procedure
  146. %{l_make} %{l_mflags} install
  147. # make some programs manually accessible
  148. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin/
  149. for bin in controlbatch controlchan news2mail startinnfeed overchan \
  150. archive innmail innconfval ctlinnd inews rnews nntpsend; do
  151. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/$bin \
  152. $RPM_BUILD_ROOT%{l_prefix}/bin/$bin
  153. done
  154. # strip installation
  155. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/*.py
  156. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/*.tcl
  157. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/lib*.a
  158. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  159. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_recover \
  160. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  161. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  162. # adjust configuration
  163. ( echo ''
  164. echo '# dummy entry to make INN happy as long as'
  165. echo '# this server has no real newsfeeds configured.'
  166. echo 'echo "dummy-feed:!*::'
  167. echo ''
  168. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/newsfeeds
  169. ( echo ''
  170. echo '# use the traditional spool area for storage'
  171. echo 'method tradspool {'
  172. echo ' newsgroups: *'
  173. echo ' class: 1'
  174. echo '}'
  175. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/storage.conf
  176. # create initial history database
  177. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/inn/db
  178. touch history
  179. INNCONF=$RPM_BUILD_ROOT%{l_prefix}/etc/inn/inn.conf \
  180. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/makedbz -i -f ./history
  181. chmod 644 history*
  182. )
  183. # adjust permissions
  184. chmod 664 $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/active
  185. # create empty logfiles
  186. touch $RPM_BUILD_ROOT%{l_prefix}/var/inn/log/news.log
  187. # install run-command script
  188. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  189. %{l_shtool} install -c -m 755 \
  190. -e 's;@l_prefix@;%{l_prefix};g' \
  191. -e 's;@l_fsusr@;%{l_fsusr};g' \
  192. -e 's;@l_fsgrp@;%{l_fsgrp};g' \
  193. %{SOURCE rc.inn} \
  194. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  195. # determine file list
  196. %{l_rpmtool} files -v -o../files -r$RPM_BUILD_ROOT \
  197. %{l_files_std} \
  198. '%config %{l_prefix}/etc/inn/*' \
  199. '%attr(4550,root,%{l_fsgrp}) %{l_prefix}/bin/rnews' \
  200. '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/libexec/inn/inndstart' \
  201. '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/libexec/inn/startinnfeed' \
  202. '%config %{l_prefix}/var/inn/db/*'
  203. %files -f files
  204. %clean
  205. rm -rf $RPM_BUILD_ROOT