live-build/functions/echo.sh

110 lines
1.7 KiB
Bash
Raw Normal View History

2007-09-23 08:04:49 +00:00
#!/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.
2007-09-23 08:04:49 +00:00
2008-08-14 18:25:29 +00:00
Echo ()
{
STRING="${1}"
shift
printf "${STRING}\n" "${@}" >&1
2008-08-14 18:25:29 +00:00
}
2007-09-23 08:04:49 +00:00
Echo_debug ()
{
if [ "${_DEBUG}" = "true" ]
2007-09-23 08:04:49 +00:00
then
STRING="${1}"
shift
printf "D: ${STRING}\n" "${@}" >&1
2007-09-23 08:04:49 +00:00
fi
}
Echo_error ()
{
2007-09-23 08:04:51 +00:00
STRING="${1}"
shift
2007-09-23 08:04:51 +00:00
if [ "${_COLOR}" = "false" ]
then
printf "E:" >&2
else
printf "${RED}E${NO_COLOR}:" >&2
fi
2012-06-05 18:38:37 +00:00
printf " ${STRING}\n" "${@}" >&2
2007-09-23 08:04:49 +00:00
}
Echo_message ()
{
if [ "${_QUIET}" != "true" ]
then
STRING="${1}"
shift
2007-09-23 08:04:51 +00:00
if [ "${_COLOR}" = "false" ]
then
printf "P:" >&1
else
printf "${WHITE}P${NO_COLOR}:" >&1
fi
printf " ${STRING}\n" "${@}" >&1
fi
}
2007-09-23 08:04:49 +00:00
Echo_verbose ()
{
if [ "${_VERBOSE}" = "true" ]
2007-09-23 08:04:49 +00:00
then
STRING="${1}"
shift
printf "I: ${STRING}\n" "${@}" >&1
2007-09-23 08:04:49 +00:00
fi
}
Echo_warning ()
{
2007-09-23 08:04:51 +00:00
STRING="${1}"
shift
2007-09-23 08:04:51 +00:00
if [ "${_COLOR}" = "false" ]
then
printf "W:" >&2
else
printf "${YELLOW}W${NO_COLOR}:" >&2
fi
printf " ${STRING}\n" "${@}" >&2
2007-09-23 08:04:49 +00:00
}
Echo_file ()
{
while read LINE
do
echo "${1}: ${LINE}" >&1
done < "${1}"
}
Echo_breakage ()
{
case "${LB_PARENT_DISTRIBUTION_BINARY}" in
sid)
Echo_message "If the following stage fails, the most likely cause of the problem is with your mirror configuration, a caching proxy or the sid distribution."
;;
*)
Echo_message "If the following stage fails, the most likely cause of the problem is with your mirror configuration or a caching proxy."
;;
esac
2008-06-15 00:58:07 +00:00
Echo_message "${@}"
}