diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-05-20 08:19:39 +0200 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-05-20 08:19:56 +0200 |
commit | 50794b1de1b0211ee4c040a83bba9a5f3148d066 (patch) | |
tree | 81416e66e8478945470b097fd69436ef9fe98625 /scripts/build | |
parent | 3c303e7f53f7843c1f621d0889c4c6fec241ffbf (diff) | |
download | vyos-live-build-50794b1de1b0211ee4c040a83bba9a5f3148d066.tar.gz vyos-live-build-50794b1de1b0211ee4c040a83bba9a5f3148d066.zip |
Splitting non-live specific hooks into their own subdirectory within hooks.
Diffstat (limited to 'scripts/build')
-rwxr-xr-x | scripts/build/binary_hooks | 35 | ||||
-rwxr-xr-x | scripts/build/chroot_hooks | 21 | ||||
-rwxr-xr-x | scripts/build/config | 10 | ||||
-rwxr-xr-x | scripts/build/source_hooks | 35 |
4 files changed, 57 insertions, 44 deletions
diff --git a/scripts/build/binary_hooks b/scripts/build/binary_hooks index bdad671cc..b40139797 100755 --- a/scripts/build/binary_hooks +++ b/scripts/build/binary_hooks @@ -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 + + # 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 -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 - - # 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 diff --git a/scripts/build/chroot_hooks b/scripts/build/chroot_hooks index e25f3b7fd..26ffdd701 100755 --- a/scripts/build/chroot_hooks +++ b/scripts/build/chroot_hooks @@ -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 - diff --git a/scripts/build/config b/scripts/build/config index 8e2109594..e6dcd4341 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -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})" ] diff --git a/scripts/build/source_hooks b/scripts/build/source_hooks index 6f3e08dcd..d3059de98 100755 --- a/scripts/build/source_hooks +++ b/scripts/build/source_hooks @@ -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 + + # 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 -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 - - # 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 |