By properly hooking into /etc/grml/lsb-functions
we can get systemd like output without having to
rewrite any further scripts.
Adjust /etc/grml_colors to have same color style
(non-highlighted colors) as systemd iff running
under systemd.
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# 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"}"
# log_*() functions {{{
TPUT="${TPUT:-"/usr/bin/tput"}"
+# if we're using systemd then redfine functions for
+# output in systemd style
+if $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
+
+# don't expose unneeded local variables
+unset SYSTEMD
+
# vim: ft=sh tw=80 ts=4 foldmethod=marker
# vim: ft=sh tw=80 ts=4 foldmethod=marker
# License: This file is licensed under the GPL v2.
################################################################################
# License: This file is licensed under the GPL v2.
################################################################################
+# don't use highlighed colors under systemd to match its style
+if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] ; then
+ HIGHLIGHT=0
+else
+ HIGHLIGHT=1
+fi
+
# ANSI COLORS
CRE="\r\e[K"
NORMAL="\e[0;39m"
# RED: Failure or error message
# ANSI COLORS
CRE="\r\e[K"
NORMAL="\e[0;39m"
# RED: Failure or error message
+RED="\e[${HIGHLIGHT};31m"
+GREEN="\e[${HIGHLIGHT};32m"
+YELLOW="\e[${HIGHLIGHT};33m"
+BLUE="\e[${HIGHLIGHT};34m"
# MAGENTA: Found devices or drivers
# MAGENTA: Found devices or drivers
+MAGENTA="\e[${HIGHLIGHT};35m"
+CYAN="\e[${HIGHLIGHT};36m"
+WHITE="\e[${HIGHLIGHT};37m"
+
+# don't expose unneeded local variables
+unset HIGHLIGHT
## END OF FILE #################################################################
## END OF FILE #################################################################