summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2021-05-15 15:21:17 +0000
committerArmin Kuster <akuster808@gmail.com>2021-05-16 13:23:55 -0700
commit448426a1bae9e4b25bc9691c221d6fb618508cb4 (patch)
tree64f8fc1e1db3faefe6f5c8b35ae3db798efd9675
parent10f866a458069c1ce3a71baad6f347c15472fc86 (diff)
downloadmeta-security-448426a1bae9e4b25bc9691c221d6fb618508cb4.tar.gz
clamav: fix systemd startup
cleanup recipe Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--recipes-scanners/clamav/clamav_0.104.0.bb44
-rw-r--r--recipes-scanners/clamav/files/fix_systemd_socket.patch25
2 files changed, 48 insertions, 21 deletions
diff --git a/recipes-scanners/clamav/clamav_0.104.0.bb b/recipes-scanners/clamav/clamav_0.104.0.bb
index 6892bb0..ce5b0ea 100644
--- a/recipes-scanners/clamav/clamav_0.104.0.bb
+++ b/recipes-scanners/clamav/clamav_0.104.0.bb
@@ -16,9 +16,9 @@ SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=dev/0.104 \
16 file://freshclam.conf \ 16 file://freshclam.conf \
17 file://volatiles.03_clamav \ 17 file://volatiles.03_clamav \
18 file://tmpfiles.clamav \ 18 file://tmpfiles.clamav \
19 file://${BPN}.service \
20 file://headers_fixup.patch \ 19 file://headers_fixup.patch \
21 file://oe_cmake_fixup.patch \ 20 file://oe_cmake_fixup.patch \
21 file://fix_systemd_socket.patch \
22" 22"
23S = "${WORKDIR}/git" 23S = "${WORKDIR}/git"
24 24
@@ -70,31 +70,29 @@ do_install_append () {
70 rm ${D}/${libdir}/libmspack.so 70 rm ${D}/${libdir}/libmspack.so
71 71
72 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then 72 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
73 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
74 install -d ${D}${sysconfdir}/tmpfiles.d 73 install -d ${D}${sysconfdir}/tmpfiles.d
75 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf 74 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
76 fi 75 fi
77 oe_multilib_header clamav-types.h 76 oe_multilib_header clamav-types.h
78} 77}
79 78
80pkg_postinst_ontarget_${PN} () { 79pkg_postinst_${PN} () {
81 if command -v systemd-tmpfiles >/dev/null; then 80 if [ -z "$D" ]; then
82 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf 81 if command -v systemd-tmpfiles >/dev/null; then
83 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then 82 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
84 ${sysconfdir}/init.d/populate-volatile.sh update 83 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
84 ${sysconfdir}/init.d/populate-volatile.sh update
85 fi
86 chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav
85 fi 87 fi
86 mkdir -p ${localstatedir}/lib/clamav
87 chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav
88} 88}
89 89
90 90PACKAGES += "${PN}-daemon ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav"
91PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc \
92 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
93 91
94FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit ${sbindir}/clamonacc \ 92FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit ${sbindir}/clamonacc \
95 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \ 93 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
96 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \ 94 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
97 ${docdir}/clamav/* ${libdir}/libmspack* " 95 ${docdir}/clamav/*"
98 96
99FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ 97FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
100 ${docdir}/clamdscan/* \ 98 ${docdir}/clamdscan/* \
@@ -106,11 +104,11 @@ FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
106 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \ 104 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
107 ${sysconfdir}/clamd.conf* \ 105 ${sysconfdir}/clamd.conf* \
108 /usr/etc/clamd.conf* \ 106 /usr/etc/clamd.conf* \
109 ${systemd_unitdir}/system/clamav-daemon/* \ 107 ${systemd_system_unitdir}/clamav-daemon/* \
110 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \ 108 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
111 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon \ 109 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon \
112 ${systemd_unitdir}/system/clamav-daemon.service \ 110 ${systemd_system_unitdir}/clamav-daemon.service \
113 ${systemd_unitdir}/system/clamav-clamonacc.service \ 111 ${systemd_system_unitdir}/clamav-clamonacc.service \
114 " 112 "
115 113
116FILES_${PN}-freshclam = "${bindir}/freshclam \ 114FILES_${PN}-freshclam = "${bindir}/freshclam \
@@ -121,7 +119,7 @@ FILES_${PN}-freshclam = "${bindir}/freshclam \
121 ${localstatedir}/lib/clamav \ 119 ${localstatedir}/lib/clamav \
122 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ 120 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
123 ${mandir}/man5/freshclam.conf.* \ 121 ${mandir}/man5/freshclam.conf.* \
124 ${systemd_unitdir}/system/clamav-freshclam.service" 122 ${systemd_system_unitdir}/clamav-freshclam.service"
125 123
126FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ 124FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
127 ${libdir}/pkgconfig/*.pc \ 125 ${libdir}/pkgconfig/*.pc \
@@ -131,7 +129,8 @@ FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
131FILES_${PN}-staticdev = "${libdir}/*.a" 129FILES_${PN}-staticdev = "${libdir}/*.a"
132 130
133FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so* \ 131FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so* \
134 ${libdir}/libfreshclam.so* ${docdir}/libclamav/* " 132 ${libdir}/libfreshclam.so* ${docdir}/libclamav/* \
133 ${libdir}/libmspack* "
135 134
136FILES_${PN}-doc = "${mandir}/man/* \ 135FILES_${PN}-doc = "${mandir}/man/* \
137 ${datadir}/man/* \ 136 ${datadir}/man/* \
@@ -140,12 +139,15 @@ FILES_${PN}-doc = "${mandir}/man/* \
140USERADD_PACKAGES = "${PN}" 139USERADD_PACKAGES = "${PN}"
141GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}" 140GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}"
142USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \ 141USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \
143 ${localstatedir}/spool/${BPN} \ 142 ${localstatedir}/lib/${BPN} \
144 --no-create-home --shell /bin/false ${BPN}" 143 --no-create-home --shell /sbin/nologin ${BPN}"
145 144
146RPROVIDES_${PN} += "${PN}-systemd" 145RPROVIDES_${PN} += "${PN}-systemd"
147RREPLACES_${PN} += "${PN}-systemd" 146RREPLACES_${PN} += "${PN}-systemd"
148RCONFLICTS_${PN} += "${PN}-systemd" 147RCONFLICTS_${PN} += "${PN}-systemd"
149SYSTEMD_SERVICE_${PN} = "${BPN}.service" 148SYSTEMD_PACKAGES = "${PN}-daemon ${PN}-freshclam"
149SYSTEMD_SERVICE_${PN}-daemon = "clamav-daemon.service"
150SYSTEMD_SERVICE_${PN}-freshclam = "clamav-freshclam.service"
150 151
151RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav" 152RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav"
153RDEPENDS_${PN}-daemon = "clamav"
diff --git a/recipes-scanners/clamav/files/fix_systemd_socket.patch b/recipes-scanners/clamav/files/fix_systemd_socket.patch
new file mode 100644
index 0000000..3e9abe2
--- /dev/null
+++ b/recipes-scanners/clamav/files/fix_systemd_socket.patch
@@ -0,0 +1,25 @@
1clamd not installing clamav-daemon.socket
2
3Fixes:
4__main__.SystemdUnitNotFoundError: (PosixPath('../security-build-image/1.0-r0/rootfs'), 'clamav-daemon.socket')
5%post(clamav-daemon-0.104.0-r0.core2_64): waitpid(3587571) rc 3587571 status 100
6warning: %post(clamav-daemon-0.104.0-r0.core2_64) scriptlet failed, exit status 1
7
8Upstream-Status: Pending
9Signed-off-by: Armin Kuster <akuster808@gmail.com>
10
11Index: git/clamd/CMakeLists.txt
12===================================================================
13--- git.orig/clamd/CMakeLists.txt
14+++ git/clamd/CMakeLists.txt
15@@ -54,4 +54,10 @@ if(SYSTEMD_FOUND)
16 install(
17 FILES ${CMAKE_CURRENT_BINARY_DIR}/clamav-daemon.service
18 DESTINATION ${SYSTEMD_UNIT_DIR})
19+ configure_file(
20+ ${CMAKE_CURRENT_SOURCE_DIR}/clamav-daemon.socket.in
21+ ${CMAKE_CURRENT_BINARY_DIR}/clamav-daemon.socket @ONLY)
22+ install(
23+ FILES ${CMAKE_CURRENT_BINARY_DIR}/clamav-daemon.socket
24+ DESTINATION ${SYSTEMD_UNIT_DIR})
25 endif()