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