clamav: Move database directory to /var partition
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Oct 2018 11:25:24 +0000 (11:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Oct 2018 11:25:24 +0000 (11:25 +0000)
The clamav database is quite large and occupies valuable
space on the root partition that on older systems is only
2GB large. This change moves the virus definition database
to the /var partition which is larger and supposed to hold
data like this anyway.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/rootfiles/packages/clamav
lfs/clamav
src/initscripts/packages/clamav
src/paks/clamav/update.sh

index ec5e09c..40ee46f 100644 (file)
@@ -27,7 +27,6 @@ usr/lib/libclamunrar_iface.so.7.1.1
 #usr/lib/pkgconfig/libclamav.pc
 #usr/lib/pkgconfig/libclammspack.pc
 usr/sbin/clamd
-usr/share/clamav
 #usr/share/man/man1/clambc.1
 #usr/share/man/man1/clamconf.1
 #usr/share/man/man1/clamdscan.1
@@ -45,5 +44,6 @@ var/ipfire/clamav/clamd.conf
 var/ipfire/clamav/clamd.conf.sample
 var/ipfire/clamav/freshclam.conf
 var/ipfire/clamav/freshclam.conf.sample
+var/lib/clamav
 etc/rc.d/init.d/clamav
 usr/local/bin/clamavctrl
index ad89e13..2b3baa9 100644 (file)
@@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = clamav
-PAK_VER    = 40
+PAK_VER    = 41
 
 DEPS       = ""
 
@@ -40,6 +40,8 @@ ifeq "$(BUILD_PLATFORM)" "arm"
 CONFIGURE_FLAGS = --disable-fanotify
 endif
 
+DATABASE_DIR = /var/lib/clamav
+
 ###############################################################################
 # Top-level Rules
 ###############################################################################
@@ -84,13 +86,14 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        cd $(DIR_APP) && ./configure \
                --prefix=/usr \
                --sysconfdir=/var/ipfire/clamav \
+               --with-dbdir=$(DATABASE_DIR) \
                $(CONFIGURE_FLAGS)
        cd $(DIR_APP) && make $(MAKETUNING)
        cd $(DIR_APP) && make install
-       mkdir -p /usr/share/clamav/
-       chown clamav.clamav -R /usr/share/clamav/
+       mkdir -pv $(DATABASE_DIR)
+       chown clamav.clamav -R $(DATABASE_DIR)
+       rm -rfv $(DATABASE_DIR)/*.cvd
        cp -rf $(DIR_SRC)/config/clamav/* /var/ipfire/clamav/
-       rm -rfv /usr/share/clamav/*.cvd
        mkdir -p /var/run/clamav
        chown clamav:clamav /var/run/clamav
        #install initscripts
index fa080a6..d2f63a9 100644 (file)
@@ -12,12 +12,12 @@ case "$1" in
 
                        COUNTER=0
                        while [ "$COUNTER" -lt "61" ]; do
-                               [ -e "/usr/share/clamav/main.cvd" ] && \
-                                       [ -e "/usr/share/clamav/daily.cvd" ] || \
-                                       [ -e "/usr/share/clamav/daily.cld" ] && \
+                               [ -e "/var/lib/clamav/main.cvd" ] && \
+                                       [ -e "/var/lib/clamav/daily.cvd" ] || \
+                                       [ -e "/var/lib/clamav/daily.cld" ] && \
                                break
                                if [ "$COUNTER" -lt "1" ]; then
-                                       boot_mesg -n "Download db "
+                                       boot_mesg -n "Downloading database"
                                else
                                        boot_mesg -n "."
                                fi
@@ -46,7 +46,7 @@ case "$1" in
        stop)
                boot_mesg "Stopping Clamav Definition Updater..."
                killproc /usr/bin/freshclam
-               rm -rf /usr/share/clamav/*.tmp
+               rm -rf /var/lib/clamav/*.tmp
 
                boot_mesg "Stopping Clamav Daemon..."
                killproc /usr/sbin/clamd
index 303f036..0a4af73 100644 (file)
@@ -22,7 +22,7 @@
 ############################################################################
 #
 . /opt/pakfire/lib/functions.sh
-mv /usr/share/clamav /usr/share/clamav-update
+mv /var/lib/clamav /var/lib/clamav-update
 ./uninstall.sh
-mv /usr/share/clamav-update /usr/share/clamav
+mv /var/lib/clamav-update /var/lib/clamav
 ./install.sh