5 # /lib/lsb/init-functions for Debian -*- shell-script -*-
7 # Copyright (c) 2002-03 Chris Lawrence
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
18 # 3. Neither the name of the author nor the names of other contributors
19 # may be used to endorse or promote products derived from this software
20 # without specific prior written permission.
22 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 TPUT="${TPUT:-"/usr/bin/tput"}"
37 [ -x "$TPUT" ] && "$TPUT" hpa 60 >/dev/null 2>&1 \
48 RED="$("$TPUT" setaf 1)"
49 #NORMAL="$("$TPUT" op)"
50 printf " ${RED}*${NORMAL} $@\n"
58 YELLOW="$("$TPUT" setaf 3)"
59 #NORMAL="$("$TPUT" op")"
60 # printf " *${NORMAL} $@\n"
61 printf " ${BLUE}*${NORMAL} $@\n"
67 log_warning_msg_nn() {
69 YELLOW="$("$TPUT" setaf 3)"
70 printf " ${BLUE}*${NORMAL} $@"
76 # int log_begin_message (char *message)
78 if [ "$#" -eq 0 ]; then
81 printf " ${GREEN}*${NORMAL} $@\n"
85 if [ "$#" -eq 0 ]; then
88 printf " ${GREEN}*${NORMAL} $@"
92 SUBMSG=" ${GREEN}-${NORMAL} "
94 # int log_end_message (int exitstatus)
97 # If no arguments were passed, return
98 [ "$#" -eq 0 ] && return 1
100 # Only do the fancy stuff if we have an appropriate terminal
101 # and if /usr is already mounted
103 COLS="$("$TPUT" cols)"
104 if [ -n "$COLS" ]; then
110 END="$("$TPUT" hpa "$COL")"
111 START="$("$TPUT" hpa 0)"
112 #RED="$("$TPUT" setaf 1)"
113 #NORMAL="$("$TPUT" op)"
114 if [ "$1" -eq 0 ]; then
115 printf "${UP}${END}${BLUE}[ ${GREEN}ok ${BLUE}]${NORMAL}\n"
117 printf "${UP}${START} ${RED}*${NORMAL}${END}[${RED}fail${NORMAL}]\n"
120 if [ "$1" -eq 0 ]; then