lsb-functions: avoid usage of SYSTEMD variable
[grml-etc-core.git] / etc / grml / lsb-functions
index d6513db..de1cd4c 100644 (file)
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] ; then
-  SYSTEMD=true
-else
-  SYSTEMD=false
-fi
-
 # log_*() functions {{{
 TPUT="${TPUT:-"/usr/bin/tput"}"
 
@@ -180,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
@@ -414,9 +413,9 @@ ewend() {
 }
 #}}}
 
-# if we're using systemd then redfine functions for
-# output in systemd style
-if $SYSTEMD ; then
+# 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" "$*"
   }
@@ -434,7 +433,4 @@ if $SYSTEMD ; then
   }
 fi
 
-# don't expose unneeded local variables
-unset SYSTEMD
-
 # vim: ft=sh tw=80 ts=4 foldmethod=marker