2007-09-23 08:04:49 +00:00
#!/bin/sh
# echo.sh - define output methods
2008-03-06 14:43:00 -01:00
# Copyright (C) 2006-2008 Daniel Baumann <daniel@debian.org>
2007-09-23 08:04:49 +00:00
#
# live-helper 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.
2008-08-14 18:25:29 +00:00
Echo ( )
{
STRING = " ${ 1 } "
shift
2008-11-01 12:52:35 -01:00
if [ " ${ _L10N } " = "false" ]
2008-10-29 07:36:29 -01:00
then
printf " ${ STRING } \n "
else
printf " $( eval_gettext " ${ STRING } " ) " " ${ @ } " ; echo;
fi
2008-08-14 18:25:29 +00:00
}
2007-09-23 08:04:49 +00:00
Echo_debug ( )
{
2007-09-23 08:04:51 +00:00
STRING = " ${ 1 } "
2008-08-11 20:28:54 +00:00
shift
2007-09-23 08:04:51 +00:00
2008-11-01 12:57:17 -01:00
if [ " ${ _DEBUG } " = "enabled" ]
2007-09-23 08:04:49 +00:00
then
2008-11-01 12:52:35 -01:00
if [ " ${ _L10N } " = "false" ]
2008-10-29 07:36:29 -01:00
then
printf " D: ${ STRING } \n "
else
printf " D: $( eval_gettext " ${ STRING } " ) " " ${ @ } " ; echo;
fi
2007-09-23 08:04:49 +00:00
fi
}
Echo_error ( )
{
2007-09-23 08:04:51 +00:00
STRING = " ${ 1 } "
2008-08-11 20:28:54 +00:00
shift
2007-09-23 08:04:51 +00:00
2008-11-01 12:52:35 -01:00
if [ " ${ _L10N } " = "false" ]
2008-10-29 07:36:29 -01:00
then
printf " E: ${ STRING } \n " >& 2
else
( printf " E: $( eval_gettext " ${ STRING } " ) " " ${ @ } " ; echo; ) >& 2
fi
2007-09-23 08:04:49 +00:00
}
Echo_message ( )
{
2007-09-23 08:04:51 +00:00
STRING = " ${ 1 } "
2008-08-11 20:28:54 +00:00
shift
2007-09-23 08:04:51 +00:00
2008-11-01 12:59:51 -01:00
if [ " ${ _QUIET } " != "enabled" ]
2007-09-23 08:04:49 +00:00
then
2008-11-01 12:52:35 -01:00
if [ " ${ _L10N } " = "false" ]
2008-10-29 07:36:29 -01:00
then
printf " P: ${ STRING } \n "
else
printf " P: $( eval_gettext " ${ STRING } " ) " " ${ @ } " ; echo;
fi
2007-09-23 08:04:49 +00:00
fi
}
Echo_verbose ( )
{
2007-09-23 08:04:51 +00:00
STRING = " ${ 1 } "
2008-08-11 20:28:54 +00:00
shift
2007-09-23 08:04:51 +00:00
2008-11-01 13:01:33 -01:00
if [ " ${ _VERBOSE } " = "enabled" ]
2007-09-23 08:04:49 +00:00
then
2008-11-01 12:52:35 -01:00
if [ " ${ _L10N } " = "false" ]
2008-10-29 07:36:29 -01:00
then
printf " I: ${ STRING } \n "
else
printf " I: $( eval_gettext " ${ STRING } " ) " " ${ @ } " ; echo;
fi
2007-09-23 08:04:49 +00:00
fi
}
Echo_warning ( )
{
2007-09-23 08:04:51 +00:00
STRING = " ${ 1 } "
2008-08-11 20:28:54 +00:00
shift
2007-09-23 08:04:51 +00:00
2008-11-01 12:52:35 -01:00
if [ " ${ _L10N } " = "false" ]
2008-10-29 07:36:29 -01:00
then
printf " W: ${ STRING } \n "
else
printf " W: $( eval_gettext " ${ STRING } " ) " " ${ @ } " ; echo;
fi
2007-09-23 08:04:49 +00:00
}
2008-06-14 17:25:05 +00:00
Echo_breakage ( )
{
case " ${ LH_DISTRIBUTION } " in
sid| unstable)
2008-08-11 20:28:54 +00:00
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."
2008-06-14 17:25:05 +00:00
; ;
*)
2008-08-11 20:28:54 +00:00
Echo_message "If the following stage fails, the most likely cause of the problem is with your mirror configuration or a caching proxy."
2008-06-14 17:25:05 +00:00
; ;
esac
2008-06-15 00:58:07 +00:00
Echo_message " ${ @ } "
2008-06-14 17:25:05 +00:00
}
2008-10-22 19:08:56 +00:00
Echo_file ( )
{
while read LINE
do
echo " ${ 1 } : ${ LINE } "
done < " ${ 1 } "
}