1 TITLE: Fancy boot scripts
3 AUTHOR: Gabriel Sandor <gabriel@elvikingo.com.ar>
6 How to have fancy boot scripts, with green OKs and red FAILEDs, much like RedHat's bootscripts. (This is now part of the standard LFS, as of version 2.3.7)
9 Whoever used Red Hat or Mandrake will be missing those fancy boot
10 scripts withe the green [ OK ] for successful service or the red
11 [FAILED] for the (obviously) failed service, all perfectly aligned in
13 I was trying to hack those scripts to incrporate them to my LFS, but
14 those scripts are very complex, because they do a lot of checking that
15 we really don't need (after all, we are configuring all by hand), and
16 also, I didn't want to put something I really don't understand. So I
17 extracted the cosmetics, and put them into the original LFS boot scripts
18 with almost no change.
21 First back-up your /etc/init.d directory
23 Create a new file /etc/init.d/funcions, with the same permitions of the
26 #!/bin/sh Begin /etc/init.d/funcions
28 # First set up a default search path.
29 export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
31 # Get a sane screen with
32 [ -z "$COLUMNS" ] && COLUMNS=80
34 # Set some variables (not all are necessary by now)
37 MOVE_TO_COL="echo -en \\033[${RES_COL}G"
38 SETCOLOR_SUCCESS="echo -en \\033[1;32m"
39 SETCOLOR_FAILURE="echo -en \\033[1;31m"
40 SETCOLOR_WARNING="echo -en \\033[1;33m"
41 SETCOLOR_NORMAL="echo -en \\033[0;39m"
44 # New version of check_status
57 # This are the new functions
60 [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
62 [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
64 [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
70 [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
72 [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
74 [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
80 # This one is not used by now, may be next version.........
83 [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
85 [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
87 [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
93 # End /etc/init.d/functions
95 For this to work, you need to include this file in every boot script
96 that invokes the function "check_status" like this
98 # Begin /etc/init.d/bootscript
99 # Include the funtions file Note the space between the dot and the
101 . /etc/init.d/functions
105 # End /etc/init.d/bootscript
108 Of course you need to remove the original function check_status from all
112 Check they are working correctly with the command
114 /etc/init.d/bootscript stop | start | reload | restart
115 You can do something else to change the face of tour LFS
116 The gettys are able to display a message banner before the login prompt.
117 This banner text is taken from the file /etc/issue.
118 So, create a new file /etc/issue and put the following, leaving a first
119 line blank: (No comments here, everything is displayed)
122 Welcome to myhostname.mydomain
124 This is Linux From Scrath release 1.3 (A_Name_you_Like)
125 Kernel 2.2.14 on an i686 on \l
128 Reboot. Then you'll see the banner in each console, before the login
130 The escaped caracter "\l" will display the number of console you are in
131 as you have it in the inittab (/dev/tty?)
132 so if you want to strip the "/dev/" part, strip it from the inittab file
135 1:2345:respawn:/sbin/agetty tty1 9600