website annotate en/doc/scratchbook/boot-scripts.html @ rev 1006

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