website view pt/doc/scratchbook/boot-scripts.html @ rev 551

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