2015-03-20 00:12:12 +00:00
|
|
|
---
|
|
|
|
created: 2008-08-06 00:18:47 +0200
|
2022-01-23 17:14:59 +00:00
|
|
|
layout: redirect
|
|
|
|
layout_old: default
|
|
|
|
redirect_to: https://blog.mbirth.de/archives/2008/08/06/colourful-boot-messages.html
|
2015-03-20 00:12:12 +00:00
|
|
|
tags:
|
2022-01-23 17:14:59 +00:00
|
|
|
- know-how
|
|
|
|
- software
|
|
|
|
- linux
|
|
|
|
- software
|
|
|
|
- bootup
|
|
|
|
- colours
|
|
|
|
title: Colourful boot messages
|
|
|
|
toc: false
|
|
|
|
updated: 2009-03-31 11:16:03 +0200
|
2015-03-20 00:12:12 +00:00
|
|
|
---
|
2022-01-23 17:14:59 +00:00
|
|
|
|
2015-03-20 00:12:12 +00:00
|
|
|
The functions used for the status messages upon boot are defined in `/lib/lsb/init-functions` and may be overwritten
|
|
|
|
in `/etc/lsb-base-logging.sh`.
|
|
|
|
|
|
|
|
To add colours, in that `init-functions` file find the function *log_use_fancy_output()* and below the `fi` add the lines
|
|
|
|
|
|
|
|
{% highlight bash %}
|
2015-04-13 20:20:11 +01:00
|
|
|
…
|
2015-03-20 00:12:12 +00:00
|
|
|
else
|
|
|
|
FANCYTTY=0
|
|
|
|
fi
|
|
|
|
# BEGIN --- colour definition
|
|
|
|
if [ -n "$TERM" ]; then
|
|
|
|
NORMAL=`$TPUT sgr0`
|
|
|
|
BOLD=`$TPUT bold`
|
|
|
|
BLINK=`$TPUT blink`
|
|
|
|
BLACK=`$TPUT setaf 0`
|
|
|
|
RED=`$TPUT setaf 1`
|
|
|
|
GREEN=`$TPUT setaf 2`
|
|
|
|
YELLOW=`$TPUT setaf 3`
|
|
|
|
BLUE=`$TPUT setaf 4`
|
|
|
|
MAGENTA=`$TPUT setaf 5`
|
|
|
|
CYAN=`$TPUT setaf 6`
|
|
|
|
WHITE=`$TPUT setaf 7`
|
|
|
|
fi
|
|
|
|
# END --- colour definition
|
|
|
|
case "$FANCYTTY" in
|
|
|
|
1|Y|yes|true) true;;
|
2015-04-13 20:20:11 +01:00
|
|
|
…
|
2015-03-20 00:12:12 +00:00
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
After that, edit the `lsb-base-logging.sh` and change e.g. the output of *log_end_msg()*:
|
|
|
|
|
|
|
|
{% highlight bash %}
|
2015-04-13 20:20:11 +01:00
|
|
|
…
|
2015-03-20 00:12:12 +00:00
|
|
|
if [ "$COL" ] && [ -x "$TPUT" ]; then
|
|
|
|
printf "\r"
|
|
|
|
$TPUT hpa $COL
|
|
|
|
if [ "$1" -eq 0 ]; then
|
|
|
|
echo "${BOLD}${BLUE}[${GREEN} OK ${BLUE}]${NORMAL}"
|
|
|
|
else
|
|
|
|
echo "${BOLD}${BLUE}[${RED}fail${BLUE}]${NORMAL}"
|
|
|
|
fi
|
|
|
|
else
|
2015-04-13 20:20:11 +01:00
|
|
|
…
|
2015-03-20 00:12:12 +00:00
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
Your next boot will look like this:
|
|
|
|
|
2022-01-23 17:14:59 +00:00
|
|
|
![]({{ site.url }}/assets/colorboot.png)
|