#!/bin/bash # # clamav.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # clamav.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # default settings PACKAGE="clamav" PACKAGE_EXT="gz" VERSION=${VERSION:=1.3.1} BUILD=${BUILD:=1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi check_required # These accounts must exist during build # if [ -z "`grep ^clamav /etc/group`" ]; then groupadd -g 203 clamav USERADDED="yes" fi if [ -z "`grep ^clamav /etc/passwd`" ]; then useradd -u 203 -g 203 -s /bin/false -c "Clam AntiVirus" clamav fi SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT" URL="https://www.clamav.net/downloads/production/$SRC" get_source $SRC $URL unpack_source $SRC $PACKAGE-$VERSION cmake \ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DAPP_CONFIG_DIRECTORY=/etc/clamav \ -DDATABASE_DIRECTORY=/var/lib/clamav \ -DENABLE_STATIC_LIB=OFF \ -DENABLE_SHARED_LIB=ON \ -DENABLE_TESTS=OFF \ -DENABLE_APP=ON \ -DENABLE_MILTER=ON \ -DENABLE_CLAMONACC=OFF \ -DENABLE_MILTER=ON \ -DENABLE_SYSTEMD=OFF \ -Wno-dev # -D CMAKE_INSTALL_LIBDIR=lib \ cmake --build . DESTDIR=$PKG cmake --build . --target install # Move man pages mv $PKG/usr/share/man $PKG/usr # Removes html docs too rm -rf $PKG/usr/share mkdir -p $PKG/etc/rc.d $PKG/etc/cron.hourly ginstall -o root -g root -m 644 $CWD/rc.clamd $PKG/etc/rc.d/rc.clamd.new ginstall -o root -g root -m 755 $CWD/freshclam $PKG/etc/cron.hourly mkdir -p $DOCS cp -a COPYING* ChangeLog.md INSTALL* NEWS.md README.md SECURITY.md $DOCS mkdir -p $PKG/var/lock/subsys # Remove default database rm -f $PKG/var/lib/clamav/* # I think we don't need this rm -f $PKG//usr/lib64/libclamav_rust.a fixup_package $PKG # If accounts were added for build, remove them set +u if [ ! -z $USERADDED ]; then echo "Removing build accounts" userdel clamav fi # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi