Welcome to the Linux Foundation Forum!

Is it possible to change the color of systemd (?) [FAILURE] [OK] or [SUCCESS] etc. in boot sequence?

Hi all!

I'm not sure if I am right here in the kernel section, but it is hard to find a place for asking this on the net.
My problem is, that any script / command in /etc/init.d seems to be overridden by something else or disregarded.
So I guess that this must be something to be configured in the kernel.

For example using /etc/init.d:


Column number to place the status message
RES_COL=60
Command to move out to the configured column number
MOVE_TO_COL="echo -en \033[${RES_COL}G"
Command to set the color to SUCCESS (Green)
SETCOLOR_SUCCESS="echo -en \033[1;36m"
Command to set the color to FAILED (Red)
SETCOLOR_FAILURE="echo -en \033[1;31m"
Command to set the color back to normal
SETCOLOR_NORMAL="echo -en \033[0;39m"

Function to print the SUCCESS status
echo_success() {
$MOVE_TO_COL
echo -n "["
$SETCOLOR_SUCCESS
echo -n $" OK "
$SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 0
}

Function to print the FAILED status message
echo_failure() {
$MOVE_TO_COL
echo -n "["
$SETCOLOR_FAILURE
echo -n $"FAILED"
$SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}


I've been looking around inside the kernel- and other sources but found nothing about that in there.
/drivers/tty/vt/vt.c seems to be some global config for the VT. That's not what I need.

I would be happy to receive a few tips.

Greetings
Jens

Categories

Upcoming Training