X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fgrml%2Flsb-functions;h=17a42a38d2173c83cc0bd8209dc7f82f9c05babf;hb=31dc671f573000a4e83b715c2f1e52829d604e1c;hp=d95be1db89c32a94323f38dc8d6bac21a6420041;hpb=43b9baab8a85123b4f152cf0cbf450d869db1f0f;p=grml-etc-core.git diff --git a/etc/grml/lsb-functions b/etc/grml/lsb-functions index d95be1d..17a42a3 100644 --- a/etc/grml/lsb-functions +++ b/etc/grml/lsb-functions @@ -151,7 +151,7 @@ log_end_msg() { # initialisation {{{ # internal variables -# Dont output to stdout? +# Don't output to stdout? RC_QUIET_STDOUT="no" # Default values for e-message indentation and dots @@ -159,7 +159,7 @@ RC_INDENTATION='' RC_DEFAULT_INDENT=2 #RC_DOT_PATTERN=' .' RC_DOT_PATTERN='' -# dont output to stdout? +# don't output to stdout? rc_quiet_stdout="no" # default values for e-message indentation and dots @@ -174,6 +174,11 @@ if [ -r /proc/cmdline ] ; then fi [ -n "$NOCOLORS" ] && RC_NOCOLOR='yes' RC_NOCOLOR="${RC_NOCOLOR:-no}" +if [ "$RC_NOCOLOR" = "no" ] ; then + if [ -r /etc/grml_colors ] ; then + . /etc/grml_colors + fi +fi # Can the terminal handle endcols? if [ "${RC_NOCOLOR}" = "yes" ]; then @@ -408,4 +413,24 @@ ewend() { } #}}} +# if we're using systemd then redefine functions +# for output in systemd style +if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] ; then + einfo() { + printf "[ ${GREEN}OK${NORMAL} ] %s\n" "$*" + } + + ewarn() { + printf "[ ${YELLOW}WARN${NORMAL} ] %s\n" "$*" + } + + eerror() { + printf "[ ${RED}FAIL${NORMAL} ] %s\n" "$*" + } + + eend() { + : + } +fi + # vim: ft=sh tw=80 ts=4 foldmethod=marker