diff options
author | Zoltán Böszörményi <zboszor@gmail.com> | 2021-09-26 14:25:53 +0200 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2021-09-28 16:18:59 -0700 |
commit | ea062563aaa5c27fa7fda84b83bb9d0e60870f42 (patch) | |
tree | 28e6d13a371d6aa16230679e1b048190dea179d5 | |
parent | 650e6d6d4bba0b7f6dcf879ba8970925f9fc1412 (diff) | |
download | meta-security-ea062563aaa5c27fa7fda84b83bb9d0e60870f42.tar.gz |
clamav: Set clamav:clamav ownership on /var/lib/clamav in do_install
Also, rearrange the runtime-dependencies a little so
clamav-freshclam is installed later than clamav.
The issue is that clamav-freshclam ships /var/lib/clamav
and the main clamav package uses chown in pkg_postinst to set
the ownership of this directory. But pkg_postinst is not
marked as "ontarget" so this chown only took effect when
upgrading or reinstalling the package.
So when clamav is part of an OS image out of the box, freshclamd
cannot populate this directory since it's running under the clamav
user.
Fix this by creating /var/lib/clamav with the proper ownership
in do_install and rearrange runtime-dependencies, so clamav-freshclam
RDEPENDS on clamav and clamav relaxes its runtime-dependency into
RRECOMMENDS so clamav-freshclam is installed later than clamav,
avoiding these warnings:
Installing : clamav-freshclam-... 487/1954
warning: user clamav does not exist - using root
warning: group clamav does not exist - using root
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | recipes-scanners/clamav/clamav_0.104.0.bb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/recipes-scanners/clamav/clamav_0.104.0.bb b/recipes-scanners/clamav/clamav_0.104.0.bb index 0d3a678..25123dc 100644 --- a/recipes-scanners/clamav/clamav_0.104.0.bb +++ b/recipes-scanners/clamav/clamav_0.104.0.bb | |||
@@ -54,7 +54,7 @@ export OECMAKE_C_FLAGS += " -I${STAGING_INCDIR} -L ${RECIPE_SYSROOT}${nonarch_li | |||
54 | 54 | ||
55 | do_install:append () { | 55 | do_install:append () { |
56 | install -d ${D}/${sysconfdir} | 56 | install -d ${D}/${sysconfdir} |
57 | install -d ${D}/${localstatedir}/lib/clamav | 57 | install -d -o ${CLAMAV_UID} -g ${CLAMAV_GID} ${D}/${localstatedir}/lib/clamav |
58 | install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles | 58 | install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles |
59 | 59 | ||
60 | install -m 644 ${WORKDIR}/clamd.conf ${D}/${prefix}/${sysconfdir} | 60 | install -m 644 ${WORKDIR}/clamd.conf ${D}/${prefix}/${sysconfdir} |
@@ -83,7 +83,6 @@ pkg_postinst:${PN} () { | |||
83 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then | 83 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then |
84 | ${sysconfdir}/init.d/populate-volatile.sh update | 84 | ${sysconfdir}/init.d/populate-volatile.sh update |
85 | fi | 85 | fi |
86 | chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav | ||
87 | fi | 86 | fi |
88 | } | 87 | } |
89 | 88 | ||
@@ -149,5 +148,7 @@ SYSTEMD_PACKAGES = "${PN}-daemon ${PN}-freshclam" | |||
149 | SYSTEMD_SERVICE:${PN}-daemon = "clamav-daemon.service" | 148 | SYSTEMD_SERVICE:${PN}-daemon = "clamav-daemon.service" |
150 | SYSTEMD_SERVICE:${PN}-freshclam = "clamav-freshclam.service" | 149 | SYSTEMD_SERVICE:${PN}-freshclam = "clamav-freshclam.service" |
151 | 150 | ||
152 | RDEPENDS:${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav" | 151 | RDEPENDS:${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-libclamav" |
153 | RDEPENDS:${PN}-daemon = "clamav" | 152 | RRECOMMENDS:${PN} = "clamav-freshclam" |
153 | RDEPENDS:${PN}-freshclam = "clamav" | ||
154 | RDEPENDS:${PN}-daemon = "clamav clamav-freshclam" | ||