delegate.spec 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.2
  36. Release: 20040304
  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. version = %{version}
  60. url = ftp://ftp.delegate.org/pub/DeleGate/
  61. regex = delegate(\d+\.\d+\.\d+)\.tar\.(gz|bz2)
  62. }
  63. %prep
  64. %setup -q -n delegate%{version}
  65. %{l_shtool} subst \
  66. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_OWNER[ ]\{1,\}=\).*$;\1 "%{l_rusr}/%{l_rgrp}"\;;' \
  67. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ETCDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/etc/delegate"\;;' \
  68. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_CONFIG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/etc/delegate/delegated.cf"\;;' \
  69. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_DGROOT[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate"\;;' \
  70. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_VARDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate"\;;' \
  71. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ACTDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/act"\;;' \
  72. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_PIDFILE[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/delegate.pid"\;;' \
  73. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_LOGDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log"\;;' \
  74. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ABORTLOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/abort.log"\;;' \
  75. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_LOGFILE[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/common.log"\;;' \
  76. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_ERRORLOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/error.log"\;;' \
  77. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_PROTOLOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/proto.log"\;;' \
  78. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_TRACELOG[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/log/trace.log"\;;' \
  79. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_WORKDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/work"\;;' \
  80. -e 's;^\([ ]*char[ ]\{1,\}\*DELEGATE_TMPDIR[ ]\{1,\}=\).*$;\1 "%{l_prefix}/var/delegate/tmp"\;;' \
  81. src/conf.c
  82. %build
  83. ( %{l_shtool} echo -e "ADMIN = %u@%h%d"
  84. echo "CC = %{l_cc}"
  85. echo "CFLAGS = %{l_cflags -O}"
  86. ) >src/DELEGATE_CONF
  87. %{l_make} %{l_mflags -O}
  88. %install
  89. rm -rf $RPM_BUILD_ROOT
  90. # install DeleGate files
  91. %{l_shtool} mkdir -f -p -m 755 \
  92. $RPM_BUILD_ROOT%{l_prefix}/etc/delegate \
  93. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  94. $RPM_BUILD_ROOT%{l_prefix}/share/delegate
  95. %{l_shtool} mkdir -f -p -m 700 \
  96. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/act \
  97. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/adm \
  98. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/cache \
  99. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/log \
  100. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/work \
  101. $RPM_BUILD_ROOT%{l_prefix}/var/delegate/tmp
  102. %{l_shtool} install -c -s -m 755 \
  103. src/delegated $RPM_BUILD_ROOT%{l_prefix}/sbin/
  104. %{l_shtool} install -c -m 644 \
  105. doc/Manual.htm $RPM_BUILD_ROOT%{l_prefix}/share/delegate/manual.html
  106. # install default configuration
  107. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  108. %{SOURCE delegated.cf} $RPM_BUILD_ROOT%{l_prefix}/etc/delegate/
  109. # install run-command script
  110. %{l_shtool} mkdir -f -p -m 755 \
  111. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  112. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  113. %{SOURCE rc.delegate} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  114. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  115. '%config %{l_prefix}/etc/delegate/*' \
  116. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate' \
  117. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/act' \
  118. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/adm' \
  119. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/cache' \
  120. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/log' \
  121. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/work' \
  122. '%attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/delegate/tmp'
  123. %files -f files
  124. %clean
  125. rm -rf $RPM_BUILD_ROOT
  126. %post
  127. # after upgrade, restart service
  128. [ $1 -eq 2 ] || exit 0
  129. eval `%{l_rc} delegate status 2>/dev/null`
  130. [ ".$delegate_active" = .yes ] && %{l_rc} delegate restart
  131. exit 0
  132. %preun
  133. # before erase, stop service
  134. [ $1 -eq 0 ] || exit 0
  135. %{l_rc} delegate stop 2>/dev/null
  136. rm -f $RPM_INSTALL_PREFIX/var/delegate/*.log* >/dev/null 2>&1 || true
  137. exit 0