Use either ${LIVE_BUILD}/share/hooks or /usr/share/live/build/hooks, not both

This commit is contained in:
Roland Clobus 2023-03-04 10:26:02 +01:00
parent 2bd841f835
commit 27f50aef9a
No known key found for this signature in database
GPG Key ID: 62C57C6AA61495BD
4 changed files with 11 additions and 73 deletions

View File

@ -32,26 +32,7 @@ Check_stagefile
# Acquire lock file # Acquire lock file
Acquire_lockfile Acquire_lockfile
## Processing distribution hooks ## Processing hooks
# Running hooks
for _HOOK in ${LB_BINARY_HOOKS}
do
for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
do
for FILE in "${LOCATION}"/????-"${_HOOK}".binary
do
if [ -e "${FILE}" ]
then
cd binary
"${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
cd "${OLDPWD}"
fi
done
done
done
## Processing local hooks
for HOOK in config/hooks/normal/*.binary config/hooks/live/*.binary for HOOK in config/hooks/normal/*.binary config/hooks/live/*.binary
do do
if [ ! -e "${HOOK}" ] if [ ! -e "${HOOK}" ]

View File

@ -32,8 +32,6 @@ Check_stagefile
# Acquire lock file # Acquire lock file
Acquire_lockfile Acquire_lockfile
## Processing distribution hooks
# Make build config available to chroot hooks. First, make the bind # Make build config available to chroot hooks. First, make the bind
# mount and then make it read-only. This can't happen in one mount # mount and then make it read-only. This can't happen in one mount
# command, then the resulting mount will be rw (see mount(8)). Making it # command, then the resulting mount will be rw (see mount(8)). Making it
@ -43,35 +41,7 @@ mkdir -p chroot/live-build/config
mount -o bind config chroot/live-build/config mount -o bind config chroot/live-build/config
mount -o remount,ro,bind config chroot/live-build/config mount -o remount,ro,bind config chroot/live-build/config
# Copying hooks ## Processing 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
do
for FILE in "${LOCATION}"/????-"${_HOOK}".chroot
do
if [ -e "${FILE}" ]
then
cp "${FILE}" chroot/root/lb_chroot_hooks
fi
done
done
done
# Running hooks
if ls chroot/root/lb_chroot_hooks/* > /dev/null 2>&1
then
for _HOOK in chroot/root/lb_chroot_hooks/*
do
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
fi
rmdir chroot/root/lb_chroot_hooks
rmdir --ignore-fail-on-non-empty chroot/root
## Processing local hooks
if ls config/hooks/normal/*.chroot > /dev/null 2>&1 && ( if ls config/hooks/normal/*.chroot > /dev/null 2>&1 && (
ls config/hooks/live/*.chroot > /dev/null 2>&1 || ls config/hooks/live/*.chroot > /dev/null 2>&1 ||
ls config/hooks/live/*.container > /dev/null 2>&1 ) ls config/hooks/live/*.container > /dev/null 2>&1 )

View File

@ -1347,8 +1347,14 @@ mkdir -p config/rootfs
mkdir -p local/bin mkdir -p local/bin
Echo_message "Symlinking hooks..." Echo_message "Symlinking hooks..."
if [ -n "${LIVE_BUILD}" ] && [ -d "${LIVE_BUILD}/share/hooks" ]
then
LOCATION="${LIVE_BUILD}/share/hooks"
else
LOCATION=/usr/share/live/build/hooks
fi
for _HOOK in "${LIVE_BUILD}"/share/hooks/normal/*.hook* /usr/share/live/build/hooks/normal/*.hook* for _HOOK in "${LOCATION}"/normal/*.hook*
do do
if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/normal/$(basename ${_HOOK})" ] if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/normal/$(basename ${_HOOK})" ]
then then
@ -1356,7 +1362,7 @@ do
fi fi
done done
for _HOOK in "${LIVE_BUILD}"/share/hooks/live/*.hook* /usr/share/live/build/hooks/live/*.hook* for _HOOK in "${LOCATION}"/live/*.hook*
do do
if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/live/$(basename ${_HOOK})" ] if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/live/$(basename ${_HOOK})" ]
then then

View File

@ -32,26 +32,7 @@ Check_stagefile
# Acquire lock file # Acquire lock file
Acquire_lockfile Acquire_lockfile
## Processing distribution hooks ## Processing hooks
# Running hooks
for _HOOK in ${LB_BINARY_HOOKS}
do
for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
do
for FILE in "${LOCATION}"/????-"${_HOOK}".source
do
if [ -e "${FILE}" ]
then
cd source
"${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
cd "${OLDPWD}"
fi
done
done
done
## Processing local hooks
for HOOK in config/hooks/normal/*.source config/hooks/live/*.source for HOOK in config/hooks/normal/*.source config/hooks/live/*.source
do do
if [ ! -e "${HOOK}" ] if [ ! -e "${HOOK}" ]