2014-08-27 21:14:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
## live-build(7) - System Build Scripts
|
2020-03-11 09:07:21 -01:00
|
|
|
## Copyright (C) 2016-2020 The Debian Live team
|
2015-01-04 18:05:39 -01:00
|
|
|
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
2014-08-27 21:14:12 +00:00
|
|
|
##
|
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Including common functions
|
|
|
|
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
|
|
|
|
|
|
|
|
# Setting static variables
|
2015-02-05 02:30:47 -01:00
|
|
|
DESCRIPTION="Execute hooks in binary"
|
2014-08-27 21:14:12 +00:00
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
2015-02-05 02:30:47 -01:00
|
|
|
# Processing arguments and configuration files
|
|
|
|
Init_config_data "${@}"
|
2014-08-27 21:14:12 +00:00
|
|
|
|
|
|
|
Echo_message "Begin executing hooks..."
|
|
|
|
|
|
|
|
# Requiring stage file
|
2020-03-15 12:05:44 -01:00
|
|
|
Require_stagefiles config bootstrap
|
2014-08-27 21:14:12 +00:00
|
|
|
|
|
|
|
# Checking stage file
|
2020-03-13 16:11:53 -01:00
|
|
|
Check_stagefile
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2020-03-13 15:19:59 -01:00
|
|
|
# Acquire lock file
|
2015-02-05 02:30:47 -01:00
|
|
|
Acquire_lockfile
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2023-03-04 08:26:02 -01:00
|
|
|
## Processing hooks
|
2015-05-20 06:19:39 +00:00
|
|
|
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
|
2022-02-11 09:51:37 -01:00
|
|
|
Echo_message "Executing hook ${HOOK}..."
|
2015-06-05 20:28:50 +00:00
|
|
|
cd binary
|
|
|
|
../"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
|
|
|
|
cd "${OLDPWD}"
|
2015-05-20 06:19:39 +00:00
|
|
|
done
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-05-20 06:19:39 +00:00
|
|
|
# Creating stage file
|
2020-03-13 16:11:53 -01:00
|
|
|
Create_stagefile
|