diff options
author | Didier Raboud <odyx@debian.org> | 2012-05-15 11:03:15 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2012-05-15 16:50:24 +0200 |
commit | 853585067b1551c399c78ae2d9aa0cbffae0f971 (patch) | |
tree | 775bb9eb4da85f116185f303ed048a4e44220c8b /init-functions.d | |
parent | d36e7c1dfc80552675c9afb6a63c1681c3b23b68 (diff) |
Move the "left info blocks" code to a hook.
Diffstat (limited to 'init-functions.d')
-rw-r--r-- | init-functions.d/20-left-info-blocks | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/init-functions.d/20-left-info-blocks b/init-functions.d/20-left-info-blocks new file mode 100644 index 0000000..39f6039 --- /dev/null +++ b/init-functions.d/20-left-info-blocks @@ -0,0 +1,43 @@ +# Default info blocks put to the left of the screen +log_daemon_msg_pre () { + if log_use_fancy_output; then + /bin/echo -n "[....] " + fi +} +log_begin_msg_pre () { + log_daemon_msg_pre "$@" +} +log_end_msg_pre () { + if log_use_fancy_output; then + RED=$( $TPUT setaf 1) + GREEN=$( $TPUT setaf 2) + YELLOW=$( $TPUT setaf 3) + NORMAL=$( $TPUT op) + + $TPUT civis + $TPUT sc + $TPUT hpa 0 + if [ $1 -eq 0 ]; then + /bin/echo -ne "[${GREEN} ok ${NORMAL}" + elif [ $1 -eq 255 ]; then + /bin/echo -ne "[${YELLOW}warn${NORMAL}" + else + /bin/echo -ne "[${RED}FAIL${NORMAL}" + fi + $TPUT rc + $TPUT cnorm + fi +} +log_action_msg_pre () { + if log_use_fancy_output; then + CYAN=$( $TPUT setaf 6) + NORMAL=$( $TPUT op) + /bin/echo -ne "[${CYAN}info${NORMAL}] " + fi +} +log_action_begin_msg_pre () { + log_daemon_msg_pre "$@" +} +log_action_end_msg_pre () { + log_end_msg_pre "$@" +} |