#!/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.0.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 #mkdir build && cd build 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 \ -Wno-dev \ -B build \ -G Ninja \ -S . ninja -C build DESTDIR=$PKG ninja -C build 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/init.d $PKG/var/lib/pkgtools/setup $PKG/etc/cron.hourly ginstall -o root -g root -m 755 $CWD/clamd $PKG/etc/rc.d/init.d ginstall -o root -g root -m 755 $CWD/setup.clamd $PKG/var/lib/pkgtools/setup 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/* 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