inn.spec 8.1 KB

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