Exclude /tmp/images from cleanup

/tmp is deleted every 10 days
/usr/lib/tmpfiles.d/tmp.conf does this cleanup with this entry,
"q /tmp 1777 root root 10d".
Exclude /tmp/images from the cleanup, by adding "x /tmp/images"
to /usr/lib/tmpfiles.d/software.conf, if a feature of the machine is
obmc-ubi-fs or openpower-ubi-fs.

Resolves openbmc/openbmc#2544

Change-Id: I3ead88724adcd63ebfd809d310109a19232b1def
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/common/recipes-core/systemd/systemd_%.bbappend b/common/recipes-core/systemd/systemd_%.bbappend
index dd8cddd..52edfc5 100644
--- a/common/recipes-core/systemd/systemd_%.bbappend
+++ b/common/recipes-core/systemd/systemd_%.bbappend
@@ -16,6 +16,7 @@
 SRC_URI += "file://0005-dont-return-error-if-unable-to-create-network-namespace.patch"
 SRC_URI += "file://0006-journal-Create-journald-dbus-object.patch"
 SRC_URI += "file://0007-journal-Add-Synchronize-dbus-method.patch"
+SRC_URI += "${@mf_enabled(d, 'obmc-ubi-fs', 'file://software.conf')}"
 
 RRECOMMENDS_${PN} += "obmc-targets"
 FILES_${PN} += "${libdir}/systemd/network/default.network"
@@ -30,4 +31,11 @@
         #TODO Remove after this issue is resolved
         #https://github.com/openbmc/openbmc/issues/152
         ln -s /dev/null ${D}/etc/systemd/system/systemd-hwdb-update.service
+
+        # /tmp/images is the software image upload directory.
+        # It should not be deleted since it is watched by the Image Manager
+        # for new images.
+        if ${@bb.utils.contains('MACHINE_FEATURES', 'obmc-ubi-fs', 'true', 'false', d)}; then
+                install -m 0644 ${WORKDIR}/software.conf ${D}${exec_prefix}/lib/tmpfiles.d/
+        fi
 }