2 # Copyright © 2010 Raphaël Hertzog <hertzog@debian.org>
3 # Copyright © 2011-2015 Guillem Jover <guillem@debian.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20 # Standard ANSI colors and attributes.
29 COLOR_MAGENTA
='\e[35m'
32 COLOR_BOLD_BLACK
='\e[1;30m'
33 COLOR_BOLD_RED
='\e[1;31m'
34 COLOR_BOLD_GREEN
='\e[1;32m'
35 COLOR_BOLD_YELLOW
='\e[1;33m'
36 COLOR_BOLD_BLUE
='\e[1;34m'
37 COLOR_BOLD_MAGENTA
='\e[1;35m'
38 COLOR_BOLD_CYAN
='\e[1;36m'
39 COLOR_BOLD_WHITE
='\e[1;37m'
43 : "${DPKG_COLORS=auto}"
45 case "$DPKG_COLORS" in
61 if [ $USE_COLORS = yes ]; then
62 COLOR_PROG
="$COLOR_BOLD"
63 COLOR_INFO
="$COLOR_GREEN"
64 COLOR_NOTICE
="$COLOR_YELLOW"
65 COLOR_WARN
="$COLOR_BOLD_YELLOW"
66 COLOR_ERROR
="$COLOR_BOLD_RED"
70 FMT_PROG
="$COLOR_PROG$PROGNAME$COLOR_RESET"
74 if [ -n "$DPKG_DEBUG" ]; then
75 echo "DEBUG: $FMT_PROG: $*" >&2
80 echo "$FMT_PROG: ${COLOR_ERROR}error${COLOR_RESET}: $*" >&2
85 echo "$FMT_PROG: ${COLOR_WARN}warning${COLOR_RESET}: $*" >&2
89 echo "$FMT_PROG: ${COLOR_ERROR}error${COLOR_RESET}: $1" >&2
91 echo "Use '$PROGNAME --help' for program usage information." >&2