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

Bug#685534: live-build: chroot hooks broken



On Tue, Aug 21, 2012 at 06:33:30PM +0100, Colin Watson wrote:
> LB_CHROOT_HOOKS doesn't work, because lb_chroot_hooks looks for the
> wrong file names.  Here's a patch.

It was actually more broken than I thought.  Wildcard expansion inside
quotes isn't going to work; it was looking inside an extra level of
"hooks/" directories; and the "continue" effectively at the end of a
for-loop body was entirely pointless, so I removed it (if you want to
put it back, it probably ought to be something like "break 2" instead).

Index: b/scripts/build/lb_chroot_hooks
===================================================================
--- a/scripts/build/lb_chroot_hooks
+++ b/scripts/build/lb_chroot_hooks
@@ -54,12 +54,14 @@
 do
 	for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
 	do
-		if [ -e "${LOCATION}/hooks/???-${_HOOK}.binary" ]
-		then
-			mkdir -p chroot/root/lb_chroot_hooks
-			cp "${LOCATION}"/hooks/???-"${_HOOK}".chroot chroot/root/lb_chroot_hooks
-			continue
-		fi
+		for FILE in "${LOCATION}"/???-"${_HOOK}".chroot
+		do
+			if [ -e "${FILE}" ]
+			then
+				mkdir -p chroot/root/lb_chroot_hooks
+				cp "${FILE}" chroot/root/lb_chroot_hooks
+			fi
+		done
 	done
 done
 
Index: b/scripts/build/lb_binary_hooks
===================================================================
--- a/scripts/build/lb_binary_hooks
+++ b/scripts/build/lb_binary_hooks
@@ -43,17 +43,18 @@
 # Running hooks
 for _HOOK in ${LB_BINARY_HOOKS}
 do
-		for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
+	for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
+	do
+		for FILE in "${LOCATION}"/???-"${_HOOK}".binary
 		do
-			if [ -e "${LOCATION}/hooks/???-${_HOOK}.binary" ]
+			if [ -e "${FILE}" ]
 			then
 				cd binary
-				./"${LOCATION}/hooks/???-${_HOOK}.binary" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
+				./"${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
 				cd "${OLDPWD}"
-
-				continue
 			fi
 		done
+	done
 done
 
 ## Processing local hooks

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


Reply to: