Releasing debian version 5.0~a7-1.
[debian-live-build.git] / functions / echo.sh
blob96b742cefc356badf191e6ebcbac5cef4f99ce6e
1 #!/bin/sh
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
5 ##
6 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
11 Echo ()
13 STRING="${1}"
14 shift
16 printf "${STRING}\n" "${@}"
19 Echo_debug ()
21 if [ "${_DEBUG}" = "true" ]
22 then
23 STRING="${1}"
24 shift
26 printf "D: ${STRING}\n" "${@}"
30 Echo_debug_running ()
32 if [ "${_DEBUG}" = "true" ]
33 then
34 STRING="${1}"
35 shift
37 printf "D: ${STRING}" "${@}"
39 if [ "${_COLOR}" = "false" ]
40 then
41 printf "..."
42 else
43 printf "... ${YELLOW}${BLINK}running${NO_COLOR}"
48 Echo_error ()
50 STRING="${1}"
51 shift
53 if [ "${_COLOR}" = "false" ]
54 then
55 printf "E:"
56 else
57 printf "${RED}E${NO_COLOR}:"
60 printf " ${STRING}\n" "${@}" >&2
63 Echo_message ()
65 if [ "${_QUIET}" != "true" ]
66 then
67 STRING="${1}"
68 shift
70 if [ "${_COLOR}" = "false" ]
71 then
72 printf "P:"
73 else
74 printf "${WHITE}P${NO_COLOR}:"
77 printf " ${STRING}\n" "${@}"
81 Echo_message_running ()
83 if [ "${_QUIET}" != "true" ]
84 then
85 STRING="${1}"
86 shift
88 if [ "${_COLOR}" = "false" ]
89 then
90 printf "P:"
91 else
92 printf "${WHITE}P${NO_COLOR}:"
95 printf " ${STRING}" "${@}"
97 if [ "${_COLOR}" = "true" ]
98 then
99 printf "... ${YELLOW}${BLINK}running${NO_COLOR}"
100 else
101 printf "..."
106 Echo_verbose ()
108 if [ "${_VERBOSE}" = "true" ]
109 then
110 STRING="${1}"
111 shift
113 printf "I: ${STRING}\n" "${@}"
117 Echo_verbose_running ()
119 if [ "${_VERBOSE}" != "true" ]
120 then
121 STRING="${1}"
122 shift
124 printf "I: ${STRING}" "${@}"
126 if [ "${_COLOR}" = "true" ]
127 then
128 printf "... ${YELLOW}${BLINK}running${NO_COLOR}"
129 else
130 printf "..."
135 Echo_warning ()
137 STRING="${1}"
138 shift
140 if [ "${_COLOR}" = "false" ]
141 then
142 printf "W:"
143 else
144 printf "${YELLOW}W${NO_COLOR}:"
147 printf " ${STRING}\n" "${@}"
150 Echo_status ()
152 __RETURN="${?}"
154 if [ "${_COLOR}" = "false" ]
155 then
156 if [ "${__RETURN}" = "0" ]
157 then
158 printf " done.\n"
159 else
160 printf " failed.\n"
162 else
163 Cursor_columns_backward 8
165 if [ "${__RETURN}" = "0" ]
166 then
167 printf " ${GREEN}done${NO_COLOR}. \n"
168 else
169 printf " ${RED}failed${NO_COLOR}.\n"
174 Echo_done ()
176 if [ "${_COLOR}" = "false" ]
177 then
178 printf " already done.\n"
179 else
180 Cursor_columns_backward 8
182 printf " ${GREEN}already done${NO_COLOR}.\n"
186 Echo_file ()
188 while read LINE
190 echo "${1}: ${LINE}"
191 done < "${1}"
194 Echo_breakage ()
196 case "${LB_PARENT_DISTRIBUTION}" in
197 sid)
198 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."
201 Echo_message "If the following stage fails, the most likely cause of the problem is with your mirror configuration or a caching proxy."
203 esac
205 Echo_message "${@}"