From 4c19d792b24f120eddec3fd2a48831bb65fffddf Mon Sep 17 00:00:00 2001 From: Ravi Teja Date: Thu, 8 Aug 2019 10:56:15 -0500 Subject: [PATCH] Avahi:Fix to check and create avahi group and user before starting avahi service. Avahi service fails to start when we code update from image which has no avahi service to image which has avahi service,As part of code update. we don't touch the persistent file(/etc/group or /etc/password). Now the image which is going to be updated needs these persistent files to be updated. I have tried to add avahi user using extrausers and pkg_postinst scripts I could see updated /etc/group and /etc/password files with avahi entry in rootfs build directory, but after code update to this new BMC image we dont see these udpated files on the system, where as this new image requires avahi user and the group to be present in the /etc/passwd and /etc/group on the system. Implemented service override file to check and create avahi group and user before starting avahi service. Tested By: 1.Code updating images 2.Reboot Signed-off-by: Ravi Teja Change-Id: I797333404dad515a1bd8c22833ff73c3316e3216 --- .../avahi/avahi-daemon/avahi-daemon-override.conf | 3 +++ recipes-connectivity/avahi/avahi_%.bbappend | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 recipes-connectivity/avahi/avahi-daemon/avahi-daemon-override.conf create mode 100644 recipes-connectivity/avahi/avahi_%.bbappend diff --git a/recipes-connectivity/avahi/avahi-daemon/avahi-daemon-override.conf b/recipes-connectivity/avahi/avahi-daemon/avahi-daemon-override.conf new file mode 100644 index 0000000000..099988954c --- /dev/null +++ b/recipes-connectivity/avahi/avahi-daemon/avahi-daemon-override.conf @@ -0,0 +1,3 @@ +[Service] +ExecStartPre=/bin/sh -c "grep -q avahi: /etc/group || /usr/sbin/addgroup --system avahi +grep -q avahi: /etc/passwd || /usr/sbin/adduser --system --no-create-home --ingroup avahi avahi" diff --git a/recipes-connectivity/avahi/avahi_%.bbappend b/recipes-connectivity/avahi/avahi_%.bbappend new file mode 100644 index 0000000000..9008d3aa05 --- /dev/null +++ b/recipes-connectivity/avahi/avahi_%.bbappend @@ -0,0 +1,11 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/avahi-daemon:" + +SRC_URI += "file://avahi-daemon-override.conf" + +FILES_avahi-daemon_append += "${systemd_system_unitdir}/avahi-daemon.service.d/avahi-daemon-override.conf" + +do_install_append() { + + install -Dm 0755 ${WORKDIR}/avahi-daemon-override.conf \ + ${D}${systemd_system_unitdir}/avahi-daemon.service.d/avahi-daemon-override.conf +}