/usr/share/live/build/functions/stagefile.sh is in open-infrastructure-system-build 20161101-lts2-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #!/bin/sh
## live-build(7) - System Build Scripts
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
##
## 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.
Check_stagefile ()
{
FILE="${1}"
NAME="$(basename ${1})"
# Checking stage file
if [ -f "${FILE}" ]
then
if [ "${_FORCE}" != "true" ]
then
# Skipping execution
Echo_warning "skipping %s, already done" "${NAME}"
exit 0
else
# Forcing execution
Echo_message "forcing %s" "${NAME}"
rm -f "${FILE}"
fi
fi
}
Create_stagefile ()
{
FILE="${1}"
DIRECTORY="$(dirname ${1})"
# Creating stage directory
mkdir -p "${DIRECTORY}"
# Creating stage file
touch "${FILE}"
}
Require_stagefile ()
{
NAME="$(basename ${0})"
FILES="${@}"
NUMBER="$(echo ${@} | wc -w)"
for FILE in ${FILES}
do
# Find at least one of the required stages
if [ -f ${FILE} ]
then
CONTINUE="true"
NAME="${NAME} $(basename ${FILE})"
fi
done
if [ "${CONTINUE}" != "true" ]
then
if [ "${NUMBER}" -eq 1 ]
then
Echo_error "%s: %s missing" "${NAME}" "${FILE}"
else
Echo_error "%s: one of %s is missing" "${NAME}" "${FILES}"
fi
exit 1
fi
}
|