From 85916f59c35d0eaa2d779bad74b9f3677e58d371 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sat, 13 Feb 2010 06:53:25 -0600 Subject: [PATCH] script/gentree: make cpio subshells fail if cd(1) fails. --- script/gentree | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script/gentree b/script/gentree index 551d395..d05a81f 100755 --- a/script/gentree +++ b/script/gentree @@ -117,7 +117,7 @@ do_patch() { do note "... $(basename "${file}")" echo "... $(basename "${file}")" >&2 - ( cd "${sroot}"; patch < "${file}" ) || chk + ( cd "${sroot}" && patch < "${file}" ) || chk done } @@ -169,16 +169,16 @@ do_imgboot() { chk mkdir -p "${sroot}/boot/kernel" # Link all modules into the root fs - ( cd "${sboot}/kernel"; find . -name '*.ko' -o -name 'linker.hints' | cpio -p --link "${sroot}/boot/kernel" ) || chk + ( cd "${sboot}/kernel" && find . -name '*.ko' -o -name 'linker.hints' | cpio -p --link "${sroot}/boot/kernel" ) || chk # Remove all modules from the root fs that are preloaded by the loader cat "${sboot}/loader.conf" | grep '_load=' | sed -e 's#^\(.*\)_load=.*$#'"${sroot}/boot/kernel/"'\1.ko#' | xargs rm -f # Remove all modules from the boot fs that are present in the root fs - ( cd "${sroot}/boot/kernel"; ls -1 ) | sed -e 's#^#'"${sboot}/kernel/"'#' | xargs rm -f + ( cd "${sroot}/boot/kernel" && ls -1 ) | sed -e 's#^#'"${sboot}/kernel/"'#' | xargs rm -f # Link the preloaded modules from the boot fs to the root fs, to provide a homogenous view - ( cd "${sboot}/kernel"; ls -1 ) | while read mod + ( cd "${sboot}/kernel" && ls -1 ) | while read mod do ln -sf "../boot/kernel/${mod}" "${sroot}/boot/kernel/${mod}" done @@ -201,7 +201,7 @@ do_imgetc() { chk mkdir -p "${sroot}/etc" chk cp -p "${stage}/etc/rc" "${stage}/etc/rc.subr" "${stage}/etc/rc.initdiskless" "${stage}/etc/login.conf.db" "${stage}/etc/diskless" "${sroot}/etc" echo "10240" > "${sconf}/base/etc/md_size" || chk - ( cd "${stage}"; find etc | cpio -o ) | gzip -9 > "${sconf}/base/etc.cpio.gz" || chk + ( cd "${stage}" && find etc | cpio -o ) | gzip -9 > "${sconf}/base/etc.cpio.gz" || chk chk rm -Rf "${stage}/etc" } @@ -210,7 +210,7 @@ do_imgvar() { chk mv "${sroot}/var" "${stage}" chk mkdir -p "${sroot}/var" echo "131072" > "${sconf}/base/var/md_size" || chk - ( cd "${stage}"; find var | cpio -o ) | gzip -9 > "${sconf}/base/var.cpio.gz" || chk + ( cd "${stage}" && find var | cpio -o ) | gzip -9 > "${sconf}/base/var.cpio.gz" || chk chk rm -Rf "${stage}/var" } -- 2.42.0