images-build: Handle errors.
This commit is contained in:
parent
5541b73e20
commit
05f04a30ee
1 changed files with 13 additions and 1 deletions
|
|
@ -13,9 +13,12 @@ jpegoptim
|
||||||
fdp
|
fdp
|
||||||
zopflipng'
|
zopflipng'
|
||||||
|
|
||||||
|
__fatal_error='false'
|
||||||
|
|
||||||
while read -r __program; do
|
while read -r __program; do
|
||||||
if ! which "${__program}" &>/dev/null; then
|
if ! which "${__program}" &>/dev/null; then
|
||||||
echo "Error: Need '${__program}'"
|
echo "Need '${__program}'"
|
||||||
|
__fatal_error='true'
|
||||||
fi
|
fi
|
||||||
done <<<"${__needed_programs}"
|
done <<<"${__needed_programs}"
|
||||||
|
|
||||||
|
|
@ -67,6 +70,13 @@ PNG_SCALE'
|
||||||
# Functions
|
# Functions
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
__fatal_error_handler(){
|
||||||
|
if [ "${__fatal_error}" == 'true' ]; then
|
||||||
|
echo 'Fatal Error: Exiting'
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# __set_env <env file>
|
# __set_env <env file>
|
||||||
########################################
|
########################################
|
||||||
|
|
@ -340,6 +350,8 @@ __check_file() {
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
__fatal_error_handler
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
pushd "$(dirname "$0")"
|
pushd "$(dirname "$0")"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue