2007-09-23 08:05:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2012-02-04 19:41:41 -01:00
|
|
|
## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
2012-07-29 23:59:00 +00:00
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
2010-09-02 11:12:37 +00:00
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
2007-09-23 08:05:12 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Including common functions
|
2012-08-13 10:23:34 +00:00
|
|
|
. "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || . /usr/lib/live/build.sh
|
2007-09-23 08:05:12 +00:00
|
|
|
|
|
|
|
# Setting static variables
|
2011-07-19 17:03:01 +00:00
|
|
|
DESCRIPTION="$(Echo 'execute hooks in binary')"
|
2007-09-23 08:05:12 +00:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
|
|
|
# Reading configuration files
|
2008-10-28 14:26:17 -01:00
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
2007-09-23 08:05:12 +00:00
|
|
|
Set_defaults
|
|
|
|
|
2011-07-19 17:03:01 +00:00
|
|
|
Echo_message "Begin executing hooks..."
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2007-09-23 08:05:12 +00:00
|
|
|
# Requiring stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Require_stagefile .build/config .build/bootstrap
|
2007-09-23 08:05:12 +00:00
|
|
|
|
|
|
|
# Checking stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Check_stagefile .build/binary_hooks
|
2007-09-23 08:05:12 +00:00
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
2011-07-19 17:03:01 +00:00
|
|
|
## Processing distribution hooks
|
|
|
|
|
|
|
|
# Running hooks
|
|
|
|
for _HOOK in ${LB_BINARY_HOOKS}
|
|
|
|
do
|
2012-08-27 12:43:27 +00:00
|
|
|
for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
|
|
|
|
do
|
|
|
|
for FILE in "${LOCATION}"/???-"${_HOOK}".binary
|
2012-07-19 17:37:26 +00:00
|
|
|
do
|
2012-08-27 12:43:27 +00:00
|
|
|
if [ -e "${FILE}" ]
|
2012-07-19 17:37:26 +00:00
|
|
|
then
|
|
|
|
cd binary
|
2012-08-27 12:43:27 +00:00
|
|
|
./"${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
|
2012-07-19 17:37:26 +00:00
|
|
|
cd "${OLDPWD}"
|
|
|
|
fi
|
|
|
|
done
|
2012-08-27 12:43:27 +00:00
|
|
|
done
|
2011-07-19 17:03:01 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
## Processing local hooks
|
|
|
|
|
2011-07-19 08:57:02 +00:00
|
|
|
if Find_files config/hooks/*.binary
|
2007-09-23 08:05:12 +00:00
|
|
|
then
|
2011-07-19 08:57:02 +00:00
|
|
|
for HOOK in config/hooks/*.binary
|
2007-09-23 08:05:12 +00:00
|
|
|
do
|
2007-09-23 12:05:12 +00:00
|
|
|
# Making hook executable
|
|
|
|
if [ ! -x "${HOOK}" ]
|
|
|
|
then
|
|
|
|
chmod +x "${HOOK}"
|
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:12 +00:00
|
|
|
# Executing hook
|
2011-05-18 17:42:51 +00:00
|
|
|
./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
|
2007-09-23 08:05:12 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Creating stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Create_stagefile .build/binary_hooks
|
2007-09-23 08:05:12 +00:00
|
|
|
fi
|