[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Make build configuration available to chroot hooks



Hello,

 Please accept this patch which updates lb_chroot_local-hooks to bind mount (read-only) the build configuration directory (config) inside the chroot while the chroot hooks are running. This permits chroot hooks to source the build configuration and have dynamic behaviour based on the build's configuration (both live-build's and even a custom file with options or data).

Cheers,

--
Cody A.W. Somerville
Release Engineer
Foundations Team
Custom Engineering Solutions Group
Canonical OEM Services
Phone: +1 781 850 2087
Cell: +1 613 401 5141
Fax: +1 613 687 7368
Email: cody.somerville@canonical.com
=== modified file 'scripts/build/lb_chroot_local-hooks'
--- scripts/build/lb_chroot_local-hooks	2011-03-09 18:17:33 +0000
+++ scripts/build/lb_chroot_local-hooks	2011-05-30 17:27:56 +0000
@@ -44,6 +44,11 @@
 	# Restoring cache
 	Restore_cache cache/packages_chroot
 
+	# Make build config available to chroot hooks.
+	mkdir -p chroot/root/config/
+	mount --bind config/ chroot/root/config/
+	mount -o remount,ro chroot/root/config/
+
 	for HOOK in config/chroot_local-hooks/*
 	do
 		# Copying hook
@@ -62,6 +67,10 @@
 		rm -f chroot/root/"$(basename ${HOOK})"
 	done
 
+	# Remove bind mount of build config inside chroot.
+	umount chroot/root/config/
+	rmdir chroot/root/config/
+
 	# Saving cache
 	Save_cache cache/packages_chroot
 


Reply to: