clamav.spec 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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
  30. Distribution: OpenPKG
  31. Class: PLUS
  32. Group: Filesystem
  33. License: GPL
  34. Version: 0.88.4
  35. Release: 20060809
  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 >= 20040130, gcc, bzip2
  43. PreReq: OpenPKG, openpkg >= 20040130
  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-(__VER__(-rc)?)\.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. ./configure \
  72. --prefix=%{l_prefix} \
  73. --sysconfdir=%{l_prefix}/etc/clamav \
  74. --with-zlib=%{l_prefix} \
  75. --with-libcurl \
  76. --with-user=%{l_rusr} \
  77. --with-group=%{l_rgrp} \
  78. --disable-clamav \
  79. --disable-clamuko \
  80. --disable-urandom \
  81. --disable-cr \
  82. --disable-shared
  83. # build package
  84. %{l_make} %{l_mflags -O}
  85. %install
  86. rm -rf $RPM_BUILD_ROOT
  87. # perform standard package installation
  88. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  89. # install default configuration
  90. %{l_shtool} mkdir -f -p -m 755 \
  91. $RPM_BUILD_ROOT%{l_prefix}/etc/clamav
  92. %{l_shtool} install -c -m 644 \
  93. -e 's;^\(Example\);#\1;' \
  94. -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \
  95. -e 's;^#\(LogTime\).*;\1;' \
  96. -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \
  97. -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \
  98. -e 's;^#\(FixStaleSocket\).*;\1;' \
  99. -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
  100. -e 's;^#\(User\).*;\1 %{l_rusr};' \
  101. etc/clamd.conf \
  102. $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
  103. %{l_shtool} install -c -m 644 \
  104. -e 's;^\(Example\);#\1;' \
  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/clamd.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