summaryrefslogtreecommitdiff
path: root/init-functions.d
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-05-22 12:54:02 +0200
committerDidier Raboud <odyx@debian.org>2012-05-22 13:28:00 +0200
commit6c5b3ff6e324a17e9c982e319a34e1a214257ea6 (patch)
tree6c7bb031b343704abe5dfb4deaf904d5382e84ed /init-functions.d
parentae335d70e4346653b4ab81b27debceb0a5a0f88c (diff)
Safe-guard calls to echo with || true.
This helps towards making sure init.d scripts called with `set -e` continue to work, see #661002. In particular, this avoids blocking all init.d scripts run on a terminal where civis and cnorm are capabilities not available, such as cmd.exe . Thanks-to: Sam Hocevar <sho@debian.org>
Diffstat (limited to 'init-functions.d')
-rw-r--r--init-functions.d/20-left-info-blocks22
-rw-r--r--init-functions.d/50-ubuntu-logging42
2 files changed, 32 insertions, 32 deletions
diff --git a/init-functions.d/20-left-info-blocks b/init-functions.d/20-left-info-blocks
index 39f6039..9b9f3b1 100644
--- a/init-functions.d/20-left-info-blocks
+++ b/init-functions.d/20-left-info-blocks
@@ -1,7 +1,7 @@
# Default info blocks put to the left of the screen
log_daemon_msg_pre () {
if log_use_fancy_output; then
- /bin/echo -n "[....] "
+ /bin/echo -n "[....] " || true
fi
}
log_begin_msg_pre () {
@@ -14,25 +14,25 @@ log_end_msg_pre () {
YELLOW=$( $TPUT setaf 3)
NORMAL=$( $TPUT op)
- $TPUT civis
- $TPUT sc
- $TPUT hpa 0
+ $TPUT civis || true
+ $TPUT sc && \
+ $TPUT hpa 0 && \
if [ $1 -eq 0 ]; then
- /bin/echo -ne "[${GREEN} ok ${NORMAL}"
+ /bin/echo -ne "[${GREEN} ok ${NORMAL}" || true
elif [ $1 -eq 255 ]; then
- /bin/echo -ne "[${YELLOW}warn${NORMAL}"
+ /bin/echo -ne "[${YELLOW}warn${NORMAL}" || true
else
- /bin/echo -ne "[${RED}FAIL${NORMAL}"
- fi
- $TPUT rc
- $TPUT cnorm
+ /bin/echo -ne "[${RED}FAIL${NORMAL}" || true
+ fi && \
+ $TPUT rc || true
+ $TPUT cnorm || true
fi
}
log_action_msg_pre () {
if log_use_fancy_output; then
CYAN=$( $TPUT setaf 6)
NORMAL=$( $TPUT op)
- /bin/echo -ne "[${CYAN}info${NORMAL}] "
+ /bin/echo -ne "[${CYAN}info${NORMAL}] " || true
fi
}
log_action_begin_msg_pre () {
diff --git a/init-functions.d/50-ubuntu-logging b/init-functions.d/50-ubuntu-logging
index ac22357..4fdadcf 100644
--- a/init-functions.d/50-ubuntu-logging
+++ b/init-functions.d/50-ubuntu-logging
@@ -10,16 +10,16 @@ log_use_plymouth () {
}
log_success_msg () {
- echo " * $@"
+ echo " * $@" || true
}
log_failure_msg () {
if log_use_fancy_output; then
RED=`$TPUT setaf 1`
NORMAL=`$TPUT op`
- echo " $RED*$NORMAL $@"
+ echo " $RED*$NORMAL $@" || true
else
- echo " * $@"
+ echo " * $@" || true
fi
}
@@ -27,9 +27,9 @@ log_warning_msg () {
if log_use_fancy_output; then
YELLOW=`$TPUT setaf 3`
NORMAL=`$TPUT op`
- echo " $YELLOW*$NORMAL $@"
+ echo " $YELLOW*$NORMAL $@" || true
else
- echo " * $@"
+ echo " * $@" || true
fi
}
@@ -71,14 +71,14 @@ log_daemon_msg () {
# and we won't be able to reliably know where the colourful
# asterisk ought to go.
- printf " * $* "
+ printf " * $* " || true
# Enough trailing spaces for ` [fail]' to fit in; if the message
# is too long it wraps here rather than later, which is what we
# want.
- $TPUT hpa `$EXPR $COLS - 1`
- printf ' '
+ $TPUT hpa `$EXPR $COLS - 1` || true
+ printf ' ' || true
else
- echo " * $@"
+ echo " * $@" || true
COL=
fi
}
@@ -102,37 +102,37 @@ log_end_msg () {
fi
fi
- printf "\r"
+ printf "\r" || true
$TPUT hpa $COL
if [ "$1" -eq 0 ]; then
- echo "[ OK ]"
+ echo "[ OK ]" || true
else
- printf '['
- $TPUT setaf 1 # red
- printf fail
- $TPUT op # normal
- echo ']'
+ printf '[' || true
+ $TPUT setaf 1 || true # red
+ printf fail || true
+ $TPUT op || true # normal
+ echo ']' || true
fi
else
if [ "$1" -eq 0 ]; then
- echo " ...done."
+ echo " ...done." || true
else
- echo " ...fail!"
+ echo " ...fail!" || true
fi
fi
return $1
}
log_action_msg () {
- echo " * $@"
+ echo " * $@" || true
}
log_action_begin_msg () {
- log_daemon_msg "$@..."
+ log_daemon_msg "$@..." || true
}
log_action_cont_msg () {
- log_daemon_msg "$@..."
+ log_daemon_msg "$@..." || true
}
log_action_end_msg () {