openembedded / meta-openembedded

MIT License
416 stars 714 forks source link

scarthgap: auditd recipe broken when systemd is enabled #826

Open embetrix opened 6 months ago

embetrix commented 6 months ago
ERROR: audit-4.0.1-r0 do_package: Didn't find service unit 'auditd.service', specified in SYSTEMD_SERVICE:auditd. 
ERROR: Logfile of failure stored in: /workspaces/meta-ozyx/build/tmp/work/core2-32-ozyx-linux/audit/4.0.1/temp/log.do_package.2949105
ERROR: Task (/workspaces/meta-example/build/../layers/meta-openembedded/meta-oe/recipes-security/audit/audit_4.0.1.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 6613 tasks of which 4859 didn't need to be rerun and 1 failed.
embetrix commented 6 months ago

the unit files install step is missing:

do_install:append() {

    install -d ${D}${systemd_unitdir}/system
    install -m 0644 ${B}/init.d/auditd.service      ${D}${systemd_unitdir}/system/
    install -m 0644 ${B}/init.d/audit-rules.service ${D}${systemd_unitdir}/system/

}
pityhelplessnessandfat commented 4 months ago

The following modifications need to be add. If a DISTRO_FEATURES of project contains sysvinit and systemd, ${D}${libdir}/systemd will be deleted. Error. So if DISTRO_FEATURES contains sysvinit and systemd , don't delete them.

if DISTRO_FEATURES only contains sysvinit, it will carry auditd.service and audit-rules.service to ${D}${libdir}. If don't delte them, yocto print error log.

ERROR: audit-4.0.1-r0 do_package: QA Issue: audit: Files/directories were installed but not shipped in any package:

So if DISTRO_FEATURES only contains sysvinit , delete them.

     if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
         install -D -m 0755 ${WORKDIR}/auditd ${D}/etc/init.d/auditd
-        rm -rf ${D}${libdir}/systemd
+
+        if ! ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+            rm -rf ${D}${libdir}/systemd
+        fi
+
     `fi`
akuster commented 1 month ago

I'll be taking a look into this. Will check master too

akuster commented 1 month ago

Yeah, master fails too

akuster commented 1 month ago

patch sent to mailing list.