website view en/doc/cookbook/boot-scripts.html @ rev 535

en: localy browseable (with file://)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 19 14:09:59 2009 +0200 (2009-08-19)
parents 63bc31b092a5
children b8788d938e18
line source
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <title>SliTaz Cookbook (en) - Boot Scripts</title>
6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
7 <meta name="description" content="slitaz English cookbook" />
8 <meta name="expires" content="never" />
9 <meta name="modified" content="2008-02-26 18:30:00" />
10 <meta name="publisher" content="www.slitaz.org" />
11 <meta name="author" content="Christophe Lincoln"/>
12 <link rel="shortcut icon" href="favicon.ico" />
13 <link rel="stylesheet" type="text/css" href="book.css" />
14 </head>
15 <body bgcolor="#ffffff">
17 <!-- Header and quick navigation -->
18 <div id="header">
19 <div align="right" id="quicknav">
20 <a name="top"></a>
21 <a href="slitaz-tools.html">SliTaz Tools</a> |
22 <a href="index.html">Table of contents</a>
23 </div>
24 <h1><font color="#3E1220">SliTaz Cookbook (en)</font></h1>
25 </div>
27 <!-- Content. -->
28 <div id="content">
29 <div class="content-right"></div>
31 <h2><font color="#df8f06">Boot scripts</font></h2>
32 <p>
33 The startup and shutdown scripts with their configuration files.
34 </p>
36 <ul>
37 <li><a href="index.html#intro">SliTaz and startup.</a></li>
38 <li><a href="index.html#init.d">/etc/init.d/*</a> - Directory of scripts and daemons.</li>
39 <li><a href="index.html#rcS">/etc/init.d/rcS</a> - Primary initialization script.</li>
40 <li><a href="index.html#rc-scripts">Specific scripts and daemons</a> - Scripts and
41 daemons with a very specific task.</li>
42 <li><a href="index.html#inittab">/etc/inittab</a> - Configuration file init.</li>
43 </ul>
45 <a name="intro"></a>
46 <h3><font color="#6c0023">SliTaz and startup</font></h3>
48 <p>
49 SliTaz does not use a level of execution (runlevel), the
50 system is initialized via a primary script and its main
51 configuration file. This script itself launches some other smaller
52 scripts which deal with the internationalization or the
53 commands placed for the system to start.
54 </p>
56 <a name="init.d"></a>
57 <h3><font color="#6c0023">/etc/init.d/* - Directory of scripts and daemons</font></h3>
58 <p>
59 The directory /etc/init.d contains all of the rc scripts,
60 scripts finishing with '.sh' are simple shell scripts and
61 daemons such as 'dropbear' or 'lighttpd' are scripts
62 that launch a service. The daemon scripts can start, stop or
63 restart through the command:
64 </p>
65 <pre> # /etc/init.d/daemon [start|stop|restart]
66 </pre>
67 <p>
68 On SliTaz you will find a /etc/init.d/README describing the
69 basic function of rc scripts. Also note that all startup
70 scripts and daemons can call upon the <code>/etc/init.d/rc.functions</code>
71 file. This file makes it possible to include various functions
72 in rc scripts. For example, SliTaz uses a function <code>status</code> to
73 check whether the previous command has succeeded (0) or not.
74 </p>
76 <a name="rcS"></a>
77 <h3><font color="#6c0023">/etc/init.d/rcS - Primary initialization script</font></h3>
78 <p>
79 The <code>/etc/init.d/rcS</code> script configures all the
80 basic services and initializes the base system. It begins by
81 mounting the filesystems and starts services like syslogd, klogd,
82 mdev and cleans up the system and so on. It
83 uses the configuration file <code>/etc/rcS.conf</code> to locate which daemons
84 and scripts to launch at startup. You can browse the script
85 to know which commands are executed:
86 </p>
87 <pre> # nano rootfs/etc/init.d/rcS
88 </pre>
91 <a name="rc-scripts"></a>
92 <h3><font color="#6c0023">Specific scripts and daemons</font></h3>
94 <h4>bootopts.sh - LiveCD mode options</h4>
95 <p>
96 This script is used to configure the LiveCD options passed
97 at boot time and is readable via the /proc/cmdline file.
98 This is the script that allows you to use a USB key or
99 external hard disk <code>/home</code> partition with the option home=usb
100 or home=sda[1-9]. Note, it can also directly specify the language and
101 keyboard parameters.
102 </p>
104 <h4>network.sh - Initializing the network</h4>
105 <p>
106 This script searches the network.sh configuration file
107 /etc/network.conf for the network interface to use; if one wants to
108 launch the DHCP client (or not) or if you want to use a fixed
109 (static) IP. On SliTaz the /etc/init.d/network.sh
110 script configures the network interfaces to start using the
111 information contained in /etc/network.conf. If the variable
112 $DHCP is equal to yes, then the /etc/init.d/network.sh
113 script launches the DHCP client on the $INTERFACE interface.
114 </p>
116 <h4>i18n.sh - Internationalization</h4>
117 <p>
118 SliTaz backs up the configuration of the default locale in
119 /etc/locale.conf which is read by /etc/profile at each
120 login. The /etc/locale.conf is generated during boot time
121 thanks to the /etc/i18n.sh script. This script launches the
122 'tazlocale' application if /etc/locale.conf doesn't exist.
123 We use the same process for the keyboard layout using 'tazkmap'
124 and the /etc/kmap.conf configuration file. Both applications
125 are installed and located in /sbin and use dialog and the
126 ncurses library. The script also checks whether the
127 configuration file for the time zone /etc/TZ exists,
128 otherwise it creates one relying on the keyboard configuration.
129 </p>
131 <h4>local.sh - Local commands</h4>
132 <p>
133 The /etc/init.d/local.sh script allows the system administrator
134 to add local commands to be executed at boot. Example:
135 </p>
136 <pre class="script">#!/bin/sh
137 # /etc/init.d/local.sh: Local startup commands.
138 # All commands here will be executed at boot time.
139 #
140 . /etc/init.d/rc.functions
142 echo "Starting local startup commands... "
144 </pre>
146 <h4>rc.shutdown</h4>
147 <p>
148 This script is invoked by /etc/inittab during system shutdown.
149 It also stops all daemons via the variable RUN_DAEMONS in
150 the primary <code>/etc/rcS.conf</code> configuration file.
151 </p>
153 <a name="inittab"></a>
154 <h3><font color="#6c0023">/etc/inittab - Configuration file init</font></h3>
155 <p>
156 The first file read by the Kernel at boot. It defines the
157 initialization script (/etc/init.d/rcS), shells (ttys) and
158 actions in the event of a reboot or disruption. You will find
159 a complete example with accompanying notes in <a href="slitaz-tools.html">SliTaz tools</a>:
160 </p>
161 <pre class="script"># /etc/inittab: init configuration for SliTaz GNU/Linux.
162 # Boot-time system configuration/initialization script.
163 #
164 ::sysinit:/etc/init.d/rcS
166 # /sbin/getty respawn shell invocations for selected ttys.
167 tty1::respawn:/sbin/getty 38400 tty1
168 tty2::respawn:/sbin/getty 38400 tty2
169 tty3::respawn:/sbin/getty 38400 tty3
170 tty4::respawn:/sbin/getty 38400 tty4
171 tty5::respawn:/sbin/getty 38400 tty5
172 tty6::respawn:/sbin/getty 38400 tty6
174 # Stuff to do when restarting the init
175 # process, or before rebooting.
176 ::restart:/etc/init.d/rc.shutdown
177 ::restart:/sbin/init
178 ::ctrlaltdel:/sbin/reboot
179 ::shutdown:/etc/init.d/rc.shutdown
181 </pre>
183 <!-- End of content -->
184 </div>
186 <!-- Footer. -->
187 <div id="footer">
188 <div class="footer-right"></div>
189 <a href="index.html#top">Top of the page</a> |
190 <a href="index.html">Table of contents</a>
191 </div>
193 <div id="copy">
194 Copyright &copy; 2008 <a href="http://www.slitaz.org/en/">SliTaz</a> -
195 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
196 Documentation is under
197 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
198 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
199 </div>
201 </body>
202 </html>