summaryrefslogtreecommitdiff
path: root/scripts/build/chroot_hooks
diff options
context:
space:
mode:
authorjnqnfe <jnqnfe@gmail.com>2015-01-07 21:53:42 +0000
committerLuca Boccassi <bluca@debian.org>2020-03-10 12:41:15 +0000
commit532144ce66aaba2678124dc759f3b4270cf56882 (patch)
tree86cf56114a586aa2cf2df40048f9f71be018784e /scripts/build/chroot_hooks
parent0dee07f122ca2d77c9815d095084064fcd4a7f75 (diff)
downloadvyos-live-build-532144ce66aaba2678124dc759f3b4270cf56882.tar.gz
vyos-live-build-532144ce66aaba2678124dc759f3b4270cf56882.zip
chroot: improve directory creation/destruction efficiency
Closes: #952924
Diffstat (limited to 'scripts/build/chroot_hooks')
-rwxr-xr-xscripts/build/chroot_hooks6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/build/chroot_hooks b/scripts/build/chroot_hooks
index f00820991..8c79f9313 100755
--- a/scripts/build/chroot_hooks
+++ b/scripts/build/chroot_hooks
@@ -47,6 +47,7 @@ mount -o bind config chroot/live-build/config
mount -o remount,ro,bind config chroot/live-build/config
# Copying hooks
+mkdir -p chroot/root/lb_chroot_hooks
for _HOOK in ${LB_CHROOT_HOOKS}
do
for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
@@ -55,7 +56,6 @@ do
do
if [ -e "${FILE}" ]
then
- mkdir -p chroot/root/lb_chroot_hooks
cp "${FILE}" chroot/root/lb_chroot_hooks
fi
done
@@ -70,9 +70,9 @@ then
Chroot chroot "/root/lb_chroot_hooks/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
rm -f chroot/root/lb_chroot_hooks/"$(basename ${_HOOK})"
done
-
- rmdir chroot/root/lb_chroot_hooks
fi
+rmdir chroot/root/lb_chroot_hooks
+rmdir --ignore-fail-on-non-empty chroot/root
## Processing local hooks
if ls config/hooks/normal/*.chroot config/hooks/live/*.chroot > /dev/null 2>&1