delegate.spec 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. ##
  2. ## delegate.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: delegate
  27. Summary: Multi-purpose Application-Level Network Gateway
  28. URL: http://www.delegate.org/
  29. Vendor: Yutaka Sato
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: BASE
  33. Group: Network
  34. License: Freely distributable
  35. Version: 8.9.1
  36. Release: 20040225
  37. # list of sources
  38. Source0: ftp://ftp:openpkg-dev%40openpkg.org@ftp.delegate.org/pub/DeleGate/delegate%{version}.tar.gz
  39. Source1: rc.delegate
  40. Source2: delegated.cf
  41. # build information
  42. Prefix: %{l_prefix}
  43. BuildRoot: %{l_buildroot}
  44. BuildPreReq: OpenPKG, openpkg >= 20040130
  45. PreReq: OpenPKG, openpkg >= 20040130
  46. AutoReq: no
  47. AutoReqProv: no
  48. %description
  49. DeleGate is a multi-purpose application level gateway, or a proxy
  50. server. It mediates communication of various protocols (HTTP, FTP,
  51. NNTP, POP, Telnet, etc.), applying cache and conversion for mediated
  52. data, controlling access from clients and routing toward servers. It
  53. translates protocols between clients and servers, merging several
  54. servers into a single server view with aliasing and filtering.
  55. Besides proxy, DeleGate can be used as a simple origin server for
  56. some protocols (HTTP, FTP and NNTP).
  57. %track
  58. prog delegate = {
  59. comment = "rse: just FYI: server hates fw & requires valid email"
  60. version = %{version}
  61. url = ftp://ftp.delegate.org/pub/DeleGate/
  62. regex = delegate(\d+\.\d+\.\d+)\.tar\.(gz|bz2)
  63. }
  64. %prep
  65. %setup -q -n delegate%{version}
  66. %{l_shtool} subst \
  67. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_OWNER[ ]\{1,\}=\).*$;\1 "%{l_rusr}/%{l_rgrp}"\;;' \
  68. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ETCDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/etc/delegate"\;;' \
  69. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_CONFIG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/etc/delegate/delegated.cf"\;;' \
  70. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_DGROOT[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate"\;;' \
  71. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_VARDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate"\;;' \
  72. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ACTDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/act"\;;' \
  73. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_PIDFILE[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/delegate.pid"\;;' \
  74. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_LOGDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log"\;;' \
  75. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ABORTLOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/abort.log"\;;' \
  76. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_LOGFILE[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/common.log"\;;' \
  77. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ERRORLOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/error.log"\;;' \
  78. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_PROTOLOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/proto.log"\;;' \
  79. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_TRACELOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/trace.log"\;;' \
  80. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_WORKDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/work"\;;' \
  81. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_TMPDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/tmp"\;;' \
  82. src/conf.c
  83. %build
  84. ( %{l_shtool} echo -e "ADMIN = %u@%h%d"
  85. echo "CC = %{l_cc}"
  86. echo "CFLAGS = %{l_cflags -O}"
  87. ) >src/DELEGATE_CONF
  88. %{l_make} %{l_mflags -O}
  89. %install
  90. rm -rf $RPM_BUILD_ROOT
  91. # install DeleGate files
  92. %{l_shtool} mkdir -f -p -m 755 \
  93. $RPM_BUILD_ROOT%{l_prefix}/etc/delegate \
  94. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  95. $RPM_BUILD_ROOT%{l_prefix}/share/delegate
  96. %{l_shtool} mkdir -f -p -m 700 \
  97. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/act \
  98. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/adm \
  99. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/cache \
  100. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/log \
  101. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/work \
  102. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/tmp
  103. %{l_shtool} install -c -s -m 755 \
  104. src/delegated $RPM_BUILD_ROOT%{l_prefix}/sbin/
  105. %{l_shtool} install -c -m 644 \
  106. doc/Manual.htm $RPM_BUILD_ROOT%{l_prefix}/share/delegate/manual.html
  107. # install default configuration
  108. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  109. %{SOURCE delegated.cf} $RPM_BUILD_ROOT%{l_prefix}/etc/delegate/
  110. # install run-command script
  111. %{l_shtool} mkdir -f -p -m 755 \
  112. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  113. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  114. %{SOURCE rc.delegate} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  115. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  116. '%config %{l_prefix}/etc/delegate/*' \
  117. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate' \
  118. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/act' \
  119. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/adm' \
  120. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/cache' \
  121. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/log' \
  122. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/work' \
  123. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/tmp'
  124. %files -f files
  125. %clean
  126. rm -rf $RPM_BUILD_ROOT
  127. %post
  128. # after upgrade, restart service
  129. [ $1 -eq 2 ] || exit 0
  130. eval `%{l_rc} delegate status 2>/dev/null`
  131. [ ".$delegate_active" = .yes ] && %{l_rc} delegate restart
  132. exit 0
  133. %preun
  134. # before erase, stop service
  135. [ $1 -eq 0 ] || exit 0
  136. %{l_rc} delegate stop 2>/dev/null
  137. rm -f $RPM_INSTALL_PREFIX/var/delegate/*.log* >/dev/null 2>&1 || true
  138. exit 0