Splitting non-live specific hooks into their own subdirectory within hooks.

This commit is contained in:
Daniel Baumann 2015-05-20 08:19:39 +02:00
parent 3c303e7f53
commit 50794b1de1
26 changed files with 53 additions and 40 deletions

View File

@ -58,21 +58,22 @@ do
done
## Processing local hooks
for HOOK in config/hooks/normal/*.binary config/hooks/live/*.binary
do
if [ ! -e "${HOOK}" ]
then
continue
fi
if Find_files config/hooks/live/*.binary
then
for HOOK in config/hooks/live/*.binary
do
# Making hook executable
if [ ! -x "${HOOK}" ]
then
chmod +x "${HOOK}"
fi
# Making hook executable
if [ ! -x "${HOOK}" ]
then
chmod +x "${HOOK}"
fi
# Executing hook
./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
done
# Executing hook
./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
done
# Creating stage file
Create_stagefile .build/binary_hooks
fi
# Creating stage file
Create_stagefile .build/binary_hooks

View File

@ -78,28 +78,32 @@ then
fi
## Processing local hooks
if Find_files config/hooks/live/*.chroot
if ls config/hooks/*.chroot > /dev/null 2>&1
then
# Restoring cache
Restore_cache cache/packages.chroot
for _HOOK in config/hooks/live/*.chroot
for HOOK in config/hooks/normal/*.binary config/hooks/live/*.binary
do
if [ ! -e "${HOOK}" ]
then
continue
fi
# Copying hook
cp "${_HOOK}" chroot/root
cp "${HOOK}" chroot/root
# Making hook executable
if [ ! -x chroot/root/"$(basename ${_HOOK})" ]
if [ ! -x chroot/root/"$(basename ${HOOK})" ]
then
chmod +x chroot/root/"$(basename ${_HOOK})"
chmod +x chroot/root/"$(basename ${HOOK})"
fi
# Executing hook
Chroot chroot "/root/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
Chroot chroot "/root/$(basename ${HOOK})" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
# Removing hook
rm -f chroot/root/"$(basename ${_HOOK})"
rm -f chroot/root/"$(basename ${HOOK})"
done
# Saving cache
@ -112,4 +116,3 @@ fi
# Remove bind mount of build config inside chroot.
umount chroot/live-build/config
rmdir chroot/live-build/config

View File

@ -1312,11 +1312,19 @@ then
rmdir --ignore-fail-on-non-empty local > /dev/null 2>&1 || true
fi
mkdir -p config/hooks/live
mkdir -p config/hooks/normal config/hooks/live
mkdir -p config/includes config/includes.bootstrap config/includes.chroot config/includes.binary config/includes.source
Echo_message "Symlinking hooks..."
for _HOOK in "${LIVE_BUILD}"/share/hooks/normal/*.hook* /usr/share/normal/build/hooks/normal/*.hook*
do
if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/normal/$(basename ${_HOOK})" ]
then
ln -s "${_HOOK}" "config/hooks/normal/$(basename ${_HOOK})"
fi
done
for _HOOK in "${LIVE_BUILD}"/share/hooks/live/*.hook* /usr/share/live/build/hooks/live/*.hook*
do
if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/live/$(basename ${_HOOK})" ]

View File

@ -58,21 +58,22 @@ do
done
## Processing local hooks
for HOOK in config/hooks/normal/*.source config/hooks/live/*.source
do
if [ ! -e "${HOOK}" ]
then
continue
fi
if Find_files config/hooks/live/*.source
then
for HOOK in config/hooks/live/*.source
do
# Making hook executable
if [ ! -x "${HOOK}" ]
then
chmod +x "${HOOK}"
fi
# Making hook executable
if [ ! -x "${HOOK}" ]
then
chmod +x "${HOOK}"
fi
# Executing hook
./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
done
# Executing hook
./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
done
# Creating stage file
Create_stagefile .build/source_hooks
fi
# Creating stage file
Create_stagefile .build/source_hooks