[oe-commits] Christopher Larson : image.bbclass: add rootfs_check_host_user_contaminated

git at git.openembedded.org git at git.openembedded.org
Mon Aug 31 11:44:19 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: a67430e0f87e6cb74051f3a681bf4a40aabd44a3
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=a67430e0f87e6cb74051f3a681bf4a40aabd44a3

Author: Christopher Larson <chris_larson at mentor.com>
Date:   Mon Aug 24 15:19:17 2015 -0700

image.bbclass: add rootfs_check_host_user_contaminated

This function is intended to be used in ROOTFS_POSTPROCESS_COMMAND, and checks
for any paths outside of /home which are owned by the user running bitbake.

Signed-off-by: Christopher Larson <chris_larson at mentor.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/image.bbclass | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4e66535..fc7d64d 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -460,6 +460,20 @@ rootfs_trim_schemas () {
 	done
 }
 
+rootfs_check_host_user_contaminated () {
+	contaminated="${WORKDIR}/host-user-contaminated.txt"
+	HOST_USER_UID="$(PSEUDO_UNLOAD=1 id -u)"
+	HOST_USER_GID="$(PSEUDO_UNLOAD=1 id -g)"
+
+	find "${IMAGE_ROOTFS}" -wholename "${IMAGE_ROOTFS}/home" -prune \
+	    -user "$HOST_USER_UID" -o -group "$HOST_USER_GID" >"$contaminated"
+
+	if [ -s "$contaminated" ]; then
+		echo "WARNING: Paths in the rootfs are owned by the same user or group as the user running bitbake. See the logfile for the specific paths."
+		cat "$contaminated" | sed "s,^,  ,"
+	fi
+}
+
 # Make any absolute links in a sysroot relative
 rootfs_sysroot_relativelinks () {
 	sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}



More information about the Openembedded-commits mailing list