This page shows version 017. The current version can be found here.
GoboLinux is flexible enough to offer you a choice of themes to control how your
GoboLinux looks when starting up.
You can select a theme by setting BootTheme=<ThemeName> in
/System/Settings/BootOptions. Available themes include:
CheckList - Shows tasks and others that depend on them, then checks
them off.
Hat - A Red-Hat look-alike: lots of colored [ OK ]s and [FAILED]s
are echoed as things are initialized.
Progress, Progress-II, or Progress-III - Fancy themes that
stress your terminal with tons of escape codes.
Quotes - Prints short random quotes to indicate success or failure of
every initialized item.
Slack - This theme is inspired by the feel of old-school Slackware
boots: no distracting messages, no colors, no special effects.
Check /Programs/BootScripts/Current/Themes/ to see all the available themes.
You can use the TestBootTheme script to see how a boot theme looks like without
actually rebooting your computer. TestBootTheme is described on section Testing
a boot theme.
You can also set the boot theme from GRUB by adding BootTheme=<ThemeName> to
the boot line. This can be handy if BootOptions file specifies a broken or
nonexistent theme, because GoboLinux will not boot without a valid one.
Physically, a GoboLinux boot theme is a single script file located in
/Programs/BootScripts/*<version>*/Themes.
The theme file is loaded by the boot scripts core, and is called once for every
runlevel change. Although interesting stuff can be done in the script body, a
compliant boot script has only to implement the following functions:
ThemeInit
ThemeFile
ThemeBefore
ThemeAfter
ThemeFinish
These functions are the hotspots that glue the theme and the boot scripts core
together.
This page shows version 017. The current version can be found here.
This section explains how you can create your own boot script theme.
Section “The boot scripts anatomy” already explained that a theme is a single
script file. In fact, if you really want, you can create a theme that spreads
through multiple files (but this is not necessarily a good idea). The point here
is that one file is enough. This file implements a five functions: ThemeInit,
ThemeFinish, ThemeBefore ThemeAfter, and ThemeFile.
So, if you want to create a boot theme for GoboLinux, all you have to do is to
create a script file like
/Programs/BootScripts/*<version>*/Themes/MyVeryOwnBootTheme that implements
those functions (and optionally something in the script body) with all the bells
and whistles you want.
This page shows version 017. The current version can be found here.
This section describes how each of the obligatory theme functions must be
implemented.
ThemeInit
This, as the name implies, is the standard location to perform initializations.
Below is an example on how you can use the standard $PREVLEVEL variable (from
the Sysvinit init program) to echo some message when system initializes or
goes down.
if [ "$PREVLEVEL" = "N" ]
then echo "GoboLinux is initializing..."else echo "GoboLinux is going down..."fi
ThemeFile
GoboLinux boot scripts work by processing a sequence of files (again, check
section
“Customizing the initialization”
for more details). Before starting to process each of these files, the boot
scripts core will call ThemeFile passing as the first (and only) parameter the
name of the file that is starting to be processed. Needless to say, you are not
obligated to give feedback on what file is being processed (the “Hat” theme,
example, does nothing in its implementation of ThemeFile.
A very simple example implementation of ThemeFile follows.
function ThemeFile() {
echo "Entering file '$1'..."}
ThemeBefore and ThemeAfter
These functions wrap the execution of commands. ThemeBefore runs before a
program is executed and ThemeAfter, as expected, afterwards.
ThemeBefore is given two parameters: an identifier and a message. The
identifier is a numeric id so you can match calls to ThemeBefore and
ThemeAfter. Likewise, ThemeAfter is given two parameters, the identifier and
a numeric result code, indicating success (zero) or failure (other values).
If your theme supports only sequential booting (ie, does not use Fork and
Wait to parallelize the execution of the boot tasks), you can ignore the
identifier – most themes do, as sequential boots are more common and that makes
the themes simpler. On parallel boot, however, programs can end in a different
order than they were started; with some escape code trickery, one can represent
graphically the intrincacies of parallel booting (the CheckList theme is an
attempt at that).
Here’s a quick example of ThemeBefore and ThemeAfter:
function ThemeBefore() {
shift # ignore id echo -n "===> $@... "}
function ThemeAfter() {
if [ "$2" -eq 0 ]
then echo "{SUCCESS}"else echo "{ERROR}"fi}
ThemeFinish
The ThemeFinish function is called as the last step in a runlevel switch
(after everything else was done). Hence, this is the place to add any
finalization code. A common task performed by ThemeFinish is writing to the
issue file, whose contents are displayed on the screen just before the login
prompt. The issue file name is passed as the first (and only) ThemeFinish
parameter.
The following example shows a sample ThemeFinish implementation that just
writes an issue file that clears the screen.
function ThemeFinish() {
clear > $1 echo "Welcome!!" >> $1}
Testing a boot theme
Details
This page shows version 017. The current version can be found here.
Fortunately you don’t have to reboot your computer to test every feature you add
to your boot theme. The TestBootTheme script is your friend. Just run it
passing your boot script name as a parameter:
TestBootTheme MyVeryOwnBootTheme
This will simulate a boot procedure with lots of things getting executed. Some
of them will be quiet, some will echo a lot of text, some will succeed, some
will fail… Just press enter when it ends up at the “login” prompt to finish.
If you don’t give it a Theme name, it will output the list of available Themes
from /Programs/BootScripts/Current/Themes/ instead.
Of course, this script is also useful to see how the various boot themes are, so
that you can choose which one is your favorite.
Note
Some themes may not display correctly in an
Xterm/Konsole/other graphical terminal, or with a non-standard console font.
It’s probably best to run TestBootTheme in the same environment you boot in!