slitaz-doc-wiki-data view pages/en/cookbook/bootscripts.txt @ rev 7

Add pages/en folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Feb 26 12:17:18 2011 +0000 (2011-02-26)
parents
children
line source
1 ====== Boot scripts ======
3 The startup and shutdown scripts with their configuration files.
5 * SliTaz and startup.
6 * /etc/init.d/* - Directory of scripts and daemons.
7 * /etc/init.d/rcS - Primary initialization script.
8 * Specific scripts and daemons - Scripts and daemons with a very specific task.
9 * /etc/inittab - Configuration file init.
11 ===== SliTaz and startup =====
13 SliTaz does not use a level of execution (runlevel), the system is initialized via a primary script and its main configuration file. This script itself launches some other smaller scripts which deal with the internationalization or any commands placed for the system to start.
15 ===== /etc/init.d/* - Directory of scripts/daemons =====
17 The directory ///etc/init.d// contains all of the rc scripts, scripts finishing with '.sh' are simple shell scripts and daemons such as 'dropbear' or 'lighttpd' are scripts that launch a service. The daemon scripts can start, stop or restart through the command:
19 <code> # /etc/init.d/daemon [start|stop|restart] </code>
21 On SliTaz you will find a ///etc/init.d/README// describing the basic function of rc scripts. Also note that all startup scripts and daemons can call upon the /etc/init.d/rc.functions file. This file makes it possible to include various functions in rc scripts. For example, SliTaz uses a function //status// to check whether the previous command has succeeded (0) or not.
23 ===== /etc/init.d/rcS - Primary initialization script =====
25 The ///etc/init.d/rcS// script configures all the basic services and initializes the base system. It begins by mounting the filesystems and starts services like syslogd, klogd, mdev and cleans up the system and so on. It uses the configuration file ///etc/rcS.conf// to locate which daemons and scripts to launch at startup. You can browse the script to learn which commands are executed:
27 <code> # nano rootfs/etc/init.d/rcS </code>
29 ===== Specific scripts and daemons ======
31 === bootopts.sh - LiveCD mode options ===
33 This script is used to configure the LiveCD options passed at boot time and is readable via the ///proc/cmdline// file. This is the script that enables you to use a USB key or external hard disk ///home// partition with the option //home=usb// or //home=sda[1-9]//. Note that it can also directly specify the language and keyboard parameters.
35 === network.sh - Initializing the network ===
37 This script searches the network.sh configuration file ///etc/network.conf// for the network interface to use; if one wants to launch the DHCP client (or not) or if you want to use a fixed (static) IP. On SliTaz the ///etc/init.d/network.sh// script configures the network interfaces to start using the information contained in ///etc/network.conf//. If the variable $DHCP is equal to yes, then the ///etc/init.d/network.sh// script launches the DHCP client on the $INTERFACE interface.
39 === i18n.sh - Internationalization ===
41 SliTaz backs up the configuration of the default locale in ///etc/locale.conf// which is read by ///etc/profile// at each login. The ///etc/locale.conf// is generated during boot time thanks to the ///etc/i18n.sh// script. This script launches the 'tazlocale' application if ///etc/locale.conf// doesn't exist. We use the same process for the keyboard layout using 'tazkmap' and the ///etc/kmap.conf// configuration file. Both applications are installed and located in ///sbin// and use dialog and the ncurses library. The script also checks whether the configuration file for the time zone ///etc/TZ// exists, otherwise it creates one relying on the keyboard configuration.
43 === local.sh - Local commands ===
45 The ///etc/init.d/local.sh// script allows the system administrator to add local commands to be executed at boot. Example:
47 <file>
48 #!/bin/sh
49 # /etc/init.d/local.sh: Local startup commands.
50 # All commands here will be executed at boot time.
51 #
52 . /etc/init.d/rc.functions
54 echo "Starting local startup commands... "
55 </file>
57 === wpa_action.sh - Wireless network ===
59 This script is applied by //network.sh// to start/restart the DHCP server if you use a dynamic IP.
61 === rc.shutdown ===
63 This script is invoked by ///etc/inittab// during system shutdown. It also stops all daemons via the variable RUN_DAEMONS in the primary ///etc/rcS.conf// configuration file.
65 ===== /etc/inittab - Configuration file init ======
67 The first file read by the Kernel at boot. It defines the initialization script (///etc/init.d/rcS//), virtual terminals (ttys) and actions in the event of a reboot or disruption. You will find a complete example with accompanying notes in [[en:cookbook:slitaztools|SliTaz tools]]:
69 <file>
70 # /etc/inittab: init configuration for SliTaz GNU/Linux.
71 # Boot-time system configuration/initialization script.
72 #
73 ::sysinit:/etc/init.d/rcS
75 # /sbin/getty respawn shell invocations for selected ttys.
76 tty1::respawn:/sbin/getty 38400 tty1
77 tty2::respawn:/sbin/getty 38400 tty2
78 tty3::respawn:/sbin/getty 38400 tty3
79 tty4::respawn:/sbin/getty 38400 tty4
80 tty5::respawn:/sbin/getty 38400 tty5
81 tty6::respawn:/sbin/getty 38400 tty6
83 # Stuff to do when restarting the init
84 # process, or before rebooting.
85 ::restart:/etc/init.d/rc.shutdown
86 ::restart:/sbin/init
87 ::ctrlaltdel:/sbin/reboot
88 ::shutdown:/etc/init.d/rc.shutdown
89 </file>