clamav.spec 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. ##
  2. ## clamav.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: clamav
  27. Summary: Clam Antivirus
  28. URL: http://www.clamav.net/
  29. Vendor: Tomasz Kojm
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: PLUS
  33. Group: Filesystem
  34. License: GPL
  35. Version: 0.75.1
  36. Release: 20040802
  37. # list of sources
  38. Source0: http://osdn.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz
  39. Source1: rc.clamav
  40. Patch0: clamav.patch
  41. # build information
  42. Prefix: %{l_prefix}
  43. BuildRoot: %{l_buildroot}
  44. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, bzip2
  45. PreReq: OpenPKG, openpkg >= 20040130
  46. BuildPreReq: zlib
  47. PreReq: zlib
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. Clam AntiVirus is an anti-virus toolkit for UNIX. The main
  52. purpose of this software is the integration with mail servers
  53. (attachment scanning). The package provides a flexible and scalable
  54. multi-threaded daemon, a command line scanner, and a tool for
  55. automatic updating via Internet. The programs are based on a shared
  56. library distributed with the Clam AntiVirus package, which you can
  57. use with your own software. The virus database is based on the virus
  58. database from OpenAntiVirus, but contains additional signatures.
  59. %track
  60. prog clamav = {
  61. version = %{version}
  62. url = http://prdownloads.sourceforge.net/clamav/
  63. regex = clamav-(__VER__(-rc)?)\.tar\.gz
  64. }
  65. %prep
  66. %setup -q
  67. %patch -p0
  68. %build
  69. # configure package
  70. CC="%{l_cc}" \
  71. CFLAGS="%{l_cflags -O}" \
  72. CPPFLAGS="%{l_cppflags}" \
  73. LDFLAGS="%{l_ldflags}" \
  74. ./configure \
  75. --prefix=%{l_prefix} \
  76. --sysconfdir=%{l_prefix}/etc/clamav \
  77. --with-user=%{l_rusr} \
  78. --with-group=%{l_rgrp} \
  79. --disable-clamav \
  80. --disable-clamuko \
  81. --disable-urandom \
  82. --disable-cr \
  83. --disable-shared
  84. # build package
  85. %{l_make} %{l_mflags -O}
  86. %install
  87. rm -rf $RPM_BUILD_ROOT
  88. # perform standard package installation
  89. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  90. # install default configuration
  91. %{l_shtool} mkdir -f -p -m 755 \
  92. $RPM_BUILD_ROOT%{l_prefix}/etc/clamav
  93. %{l_shtool} install -c -m 644 \
  94. -e 's;^\(Example\);#\1;' \
  95. -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \
  96. -e 's;^#\(LogTime\).*;\1;' \
  97. -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \
  98. -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \
  99. -e 's;^#\(FixStaleSocket\).*;\1;' \
  100. -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
  101. -e 's;^#\(User\).*;\1 %{l_rusr};' \
  102. etc/clamav.conf \
  103. $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
  104. %{l_shtool} install -c -m 644 \
  105. -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
  106. -e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \
  107. -e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamav.conf;' \
  108. etc/freshclam.conf \
  109. $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
  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.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  115. # strip-down installation hierarchy
  116. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  117. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  118. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/clamav-milter.1
  119. # create additional installation directory
  120. %{l_shtool} mkdir -f -p -m 755 \
  121. $RPM_BUILD_ROOT%{l_prefix}/var/clamav
  122. # determine installation files
  123. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  124. %{l_files_std} \
  125. '%config %{l_prefix}/etc/clamav/*.conf' \
  126. '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/clamav' \
  127. '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/clamav'
  128. %files -f files
  129. %clean
  130. rm -rf $RPM_BUILD_ROOT
  131. %pre
  132. # before upgrade, save status and stop service
  133. [ $1 -eq 2 ] || exit 0
  134. eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}`
  135. %{l_rc} clamav stop 2>/dev/null
  136. exit 0
  137. %post
  138. if [ $1 -eq 2 ]; then
  139. # after upgrade, restore status
  140. eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
  141. [ ".$clamav_active" = .yes ] && %{l_rc} clamav start
  142. fi
  143. exit 0
  144. %preun
  145. # before erase, stop service and remove log files
  146. [ $1 -eq 0 ] || exit 0
  147. %{l_rc} clamav stop 2>/dev/null
  148. rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true
  149. exit 0