clamav.spec 5.9 KB

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