X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fgrml%2Flsb-functions;h=de1cd4cd933295e989ec732b0d280d04a0609a12;hb=274a68ff62ffdef8754c2b73bca957f81e16661a;hp=d55d776e21e4a8b20d72e8c9022138f14e6c3ed2;hpb=1a3788d3ee7bbc52266ca8d8324b065dca438258;p=grml-etc-core.git diff --git a/etc/grml/lsb-functions b/etc/grml/lsb-functions index d55d776..de1cd4c 100644 --- a/etc/grml/lsb-functions +++ b/etc/grml/lsb-functions @@ -174,9 +174,18 @@ 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? -RC_ENDCOL="yes" +if [ "${RC_NOCOLOR}" = "yes" ]; then + RC_ENDCOL="no" +else + RC_ENDCOL="yes" +fi # Setup COLS and ENDCOL so eend can line up the [ ok ] # width of [ ok ] == 7 @@ -404,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