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