slitaz-boot-scripts rev 153
Improve and tidy scripts, start tazhw from rcS and start network.sh earlier
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Apr 21 01:46:21 2009 +0200 (2009-04-21) |
parents | b0ae1b67d5ed |
children | 1392ada2e985 |
files | etc/init.d/bootopts.sh etc/init.d/hwconf.sh etc/init.d/i18n.sh etc/init.d/local.sh etc/init.d/rcS etc/rcS.conf |
line diff
1.1 --- a/etc/init.d/bootopts.sh Thu Apr 16 17:35:23 2009 +0200 1.2 +++ b/etc/init.d/bootopts.sh Tue Apr 21 01:46:21 2009 +0200 1.3 @@ -1,12 +1,14 @@ 1.4 #!/bin/sh 1.5 # /etc/init.d/bootopts.sh - SliTaz boot options from the cmdline. 1.6 # 1.7 +# Earlier boot options are in rcS: config= and modprobe= 1.8 +# 1.9 . /etc/init.d/rc.functions 1.10 1.11 # Update fstab for swapon/swapoff 1.12 add_swap_in_fstab() 1.13 { 1.14 - grep -q "$1 " /etc/fstab || cat >> /etc/fstab <<EOT 1.15 + grep -q "$1 " /etc/fstab || cat >> /etc/fstab <<EOT 1.16 $1 swap swap default 0 0 1.17 EOT 1.18 } 1.19 @@ -81,6 +83,11 @@ 1.20 1.21 echo "Parsing kernel cmdline for SliTaz live options... " 1.22 1.23 +# eject: Eject cdrom 1.24 +if grep -q -w "eject" /proc/cmdline; then 1.25 + eject /dev/cdrom 1.26 +fi 1.27 + 1.28 # user=name: Default user account without password (uid=1000). 1.29 # 1.30 if ! grep -q "1000:1000" /etc/passwd; then
2.1 --- a/etc/init.d/hwconf.sh Thu Apr 16 17:35:23 2009 +0200 2.2 +++ b/etc/init.d/hwconf.sh Tue Apr 21 01:46:21 2009 +0200 2.3 @@ -1,14 +1,11 @@ 2.4 #!/bin/sh 2.5 -# /etc/init.d/hwconf.sh - SliTaz hardware autoconfiguration. 2.6 +# /etc/init.d/hwconf.sh - SliTaz hardware configuration. 2.7 +# 2.8 +# This script configure the sound card and screen. Tazhw is used earlier 2.9 +# at boot time to autoconfigure PCI and USB devices. 2.10 # 2.11 . /etc/init.d/rc.functions 2.12 2.13 -# Detect PCI and USB devices with Tazhw from slitaz-tools. We load 2.14 -# kernel module only at first boot or in LiveCD mode. 2.15 -if [ ! -s /var/lib/detected-modules ]; then 2.16 - /sbin/tazhw init 2.17 -fi 2.18 - 2.19 # Sound configuration stuff. First check if sound=no and remove all 2.20 # sound Kernel modules. 2.21 if grep -q "sound=" /proc/cmdline; then
3.1 --- a/etc/init.d/i18n.sh Thu Apr 16 17:35:23 2009 +0200 3.2 +++ b/etc/init.d/i18n.sh Tue Apr 21 01:46:21 2009 +0200 3.3 @@ -1,11 +1,11 @@ 3.4 #!/bin/sh 3.5 -# /etc/init.d/i18n.sh - Internalisation initialisation. 3.6 -# This script configure SliTaz default keymap, locale and timezone. 3.7 +# /etc/init.d/i18n.sh - Internationalization initialisation. 3.8 +# 3.9 +# This script configure SliTaz default keymap, locale, timezone. 3.10 # 3.11 . /etc/init.d/rc.functions 3.12 3.13 # Locale config. 3.14 -# 3.15 echo "Cheking if /etc/locale.conf exist... " 3.16 if [ -s "/etc/locale.conf" ]; then 3.17 echo -n "Locale configuration file exists... " 3.18 @@ -15,7 +15,6 @@ 3.19 fi 3.20 3.21 # Keymap config. 3.22 -# 3.23 if [ -s "/etc/keymap.conf" ]; then 3.24 KEYMAP=`cat /etc/keymap.conf` 3.25 echo "Keymap configuration: $KEYMAP" 3.26 @@ -30,7 +29,6 @@ 3.27 3.28 # Timezone config. Set timezone using the keymap config for fr, be, fr_CH 3.29 # and ca with Montreal. 3.30 -# 3.31 if [ ! -s "/etc/TZ" ]; then 3.32 KEYMAP=`cat /etc/keymap.conf` 3.33 case "$KEYMAP" in 3.34 @@ -54,7 +52,6 @@ 3.35 fi 3.36 3.37 # Firefox hack to get the right locale. 3.38 -# 3.39 if grep -q "fr_*" /etc/locale.conf; then 3.40 # But is the fox installed ? 3.41 if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then 3.42 @@ -64,16 +61,15 @@ 3.43 fi 3.44 3.45 # Gen a motd in french if fr_* or in English by default. 3.46 -# 3.47 if [ ! -s "/etc/motd" ]; then 3.48 if grep -q "fr_*" /etc/locale.conf; then 3.49 # FR 3.50 cat > /etc/motd << "EOF" 3.51 3.52 3.53 - (°- { La documentation est dans /usr/share/doc. Utiliser 'less -EM' pour, 3.54 - //\ lire des fichiers et 'clex' pour les gérer, devenir root avec 'su', 3.55 - v_/_ éditer avec 'nano'. Taper 'startx' pour lancer une session X. } 3.56 + (°- { Documentation dans /usr/share/doc. Utiliser 'less -EM' pour, 3.57 + //\ lire des fichiers, devenir root avec 'su' et éditer avec 'nano'. 3.58 + v_/_ Taper 'startx' pour lancer une session X. } 3.59 3.60 SliTaz GNU/Linux est distribuée dans l'espoir qu'elle sera utile, mais 3.61 alors SANS AUCUNE GARANTIE. 3.62 @@ -85,8 +81,8 @@ 3.63 cat > /etc/motd << "EOF" 3.64 3.65 3.66 - (°- { Get documentation in /usr/share/doc. Use 'less -EM' to read files, 3.67 - //\ become root with 'su', manage files with 'clex', edit using 'nano'. 3.68 + (°- { Documentation in /usr/share/doc. Use 'less -EM' to read files, 3.69 + //\ become root with 'su' and edit using 'nano'. 3.70 v_/_ Type 'startx' to start a X window session. } 3.71 3.72 SliTaz GNU/Linux is distributed in the hope that it will be useful, but
4.1 --- a/etc/init.d/local.sh Thu Apr 16 17:35:23 2009 +0200 4.2 +++ b/etc/init.d/local.sh Tue Apr 21 01:46:21 2009 +0200 4.3 @@ -1,5 +1,6 @@ 4.4 #!/bin/sh 4.5 # /etc/init.d/local.sh - Local startup commands. 4.6 +# 4.7 # All commands here will be executed at boot time. 4.8 # 4.9 . /etc/init.d/rc.functions
5.1 --- a/etc/init.d/rcS Thu Apr 16 17:35:23 2009 +0200 5.2 +++ b/etc/init.d/rcS Tue Apr 21 01:46:21 2009 +0200 5.3 @@ -1,14 +1,14 @@ 5.4 #!/bin/sh 5.5 -# /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux. rcS is the main 5.6 -# initialization script used to check fs, mount, clean, run scripts and start 5.7 -# daemons. 5.8 +# /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux. 5.9 +# Config file is : /etc/rcS.conf 5.10 # 5.11 -# Config file is : /etc/rcS.conf 5.12 +# rcS is the main initialization script used to check fs, mount, clean, 5.13 +# run scripts and start daemons. 5.14 # 5.15 . /etc/init.d/rc.functions 5.16 . /etc/rcS.conf 5.17 5.18 -if [ "$1" != "logged" ]; then #logged 5.19 +if [ "$1" != "logged" ]; then # logged 5.20 5.21 echo "Processing /etc/init.d/rcS... " 5.22 5.23 @@ -17,9 +17,23 @@ 5.24 /bin/mount proc 5.25 status 5.26 5.27 +# Start Udev to populate /dev and handle hotplug events 5.28 +if [ "$UDEV" = "yes" ]; then 5.29 + echo -n "Starting udev daemon..." 5.30 + /sbin/udevd --daemon 5.31 + status 5.32 + echo -n "Udevadm requesting events from the Kernel..." 5.33 + udevadm trigger 5.34 + status 5.35 + echo -n "Udevadm waiting for the event queue to finish..." 5.36 + udevadm settle 5.37 + status 5.38 + echo "/sbin/udevd" > /proc/sys/kernel/hotplug 5.39 +fi 5.40 + 5.41 # Before mounting filesystems we check fs specified in the file 5.42 # /etc/rcS.conf and variable $CHECK_FS. 5.43 -if [ ! "$CHECK_FS" = "" ]; then 5.44 +if [ -n "$CHECK_FS" ]; then 5.45 mount -o remount,ro / 5.46 for i in $CHECK_FS 5.47 do 5.48 @@ -36,29 +50,14 @@ 5.49 echo "Mounting filesystems in fstab... " 5.50 /bin/mount -a 5.51 5.52 -# Start Udev to populate /dev and handle hotplug events 5.53 -if [ "$UDEV" = "yes" ]; then 5.54 - echo -n "Starting udev daemon..." 5.55 - /sbin/udevd --daemon 5.56 - status 5.57 - echo -n "Udevadm requesting events from the Kernel..." 5.58 - udevadm trigger 5.59 - status 5.60 - echo -n "Udevadm waiting for the event queue to finish..." 5.61 - udevadm settle 5.62 - status 5.63 - echo "/sbin/udevd" > /proc/sys/kernel/hotplug 5.64 -fi 5.65 - 5.66 /bin/dmesg > /var/log/dmesg.log 5.67 vcsa2txt < /dev/vcsa1 | awk 'BEGIN {s=0} /^Processing|^.witching/ {s=1} { if (s) print }' >/var/log/boot.log 5.68 script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log 5.69 5.70 -else #logged 5.71 +else # logged 5.72 5.73 # Create /dev/cdrom if needed (symlink does not exist on LiveCD). 5.74 # Also add /dev/cdrom to fstab if entry does not exist. 5.75 -# 5.76 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` 5.77 if grep -q " cdrom=" /proc/cmdline; then 5.78 DRIVE_NAME=`cat /proc/cmdline | sed 's/.* cdrom=\([^ ]*\).*/\1/'` 5.79 @@ -121,11 +120,6 @@ 5.80 status 5.81 fi 5.82 5.83 -# Eject option 5.84 -if grep -q -w "eject" /proc/cmdline; then 5.85 - eject /dev/cdrom 5.86 -fi 5.87 - 5.88 # Mount /proc/bus/usb. 5.89 if [ -d /proc/bus/usb ]; then 5.90 echo -n "Mounting /proc/bus/usb filesystem... " 5.91 @@ -146,26 +140,24 @@ 5.92 # Clean up the system. 5.93 if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then 5.94 echo -n "Cleaning up the system... " 5.95 - rm -rf /tmp/* /tmp/.* 2> /dev/null 5.96 - rm -f /var/run/*.pid /var/run/dbus/* /var/run/hald/pid 5.97 - rm -f /var/lock/* 5.98 + /bin/rm -rf /tmp /var/run/*.pid /var/run/dbus/* \ 5.99 + /var/run/hald/pid /var/lock/* 5.100 + /bin/mkdir -p /tmp && /bin/chmod 1777 /tmp 5.101 status 5.102 else 5.103 echo "System clean up is disabled in /etc/rcS.conf... " 5.104 - echo "Keeping all tmp and pid files... " 5.105 + echo -n "Keeping all tmp and pid files... " 5.106 status 5.107 fi 5.108 5.109 # Set up tmp X11 and ICE dir. 5.110 echo -n "Setting up tmp X11 and ICE unix dir... " 5.111 -/bin/mkdir -p /tmp/.X11-unix 5.112 -/bin/mkdir -p /tmp/.ICE-unix 5.113 -/bin/chmod 1777 /tmp/.X11-unix 5.114 -/bin/chmod 1777 /tmp/.ICE-unix 5.115 +/bin/mkdir -p /tmp/.X11-unix /tmp/.ICE-unix 5.116 +/bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix 5.117 status 5.118 5.119 # Load all modules listed in config file. 5.120 -if [ ! "$LOAD_MODULES" = "" ]; then 5.121 +if [ -n "$LOAD_MODULES" ]; then 5.122 for mod in $LOAD_MODULES 5.123 do 5.124 modprobe $mod 5.125 @@ -175,6 +167,12 @@ 5.126 # Be quiet on configuration to avoid message overwriting ncurses dialog 5.127 echo "0 0 0 0" > /proc/sys/kernel/printk 5.128 5.129 +# Detect PCI and USB devices with Tazhw from slitaz-tools. We load 5.130 +# kernel module only at first boot or in LiveCD mode. 5.131 +if [ ! -s /var/lib/detected-modules ]; then 5.132 + /sbin/tazhw init 5.133 +fi 5.134 + 5.135 # Start all scripts specified with $RUN_SCRIPTS. 5.136 echo "Executing all initialization scripts..." 5.137 for script in $RUN_SCRIPTS 5.138 @@ -185,7 +183,7 @@ 5.139 done 5.140 5.141 # Re-source main config file. In Live mode, daemons list can be modified 5.142 -# by boot options. 5.143 +# by boot options (screen=text will remove slim). 5.144 . /etc/rcS.conf 5.145 5.146 # Start all daemons specified with $RUN_DAEMONS.
6.1 --- a/etc/rcS.conf Thu Apr 16 17:35:23 2009 +0200 6.2 +++ b/etc/rcS.conf Tue Apr 21 01:46:21 2009 +0200 6.3 @@ -25,10 +25,11 @@ 6.4 LOAD_MODULES="vfat nls_utf8 ohci_hcd" 6.5 6.6 # Initialization scripts to run at boot time. Boot order is important, 6.7 -# bootopts.sh (boot options) must start first, then you are free to choose. 6.8 +# bootopts.sh (boot options) must start first, hwconf after network (tazx 6.9 +# need an active connexion to install Xorg) then you are free to choose. 6.10 # Note that the local.sh script exists to let you quickly add some local startup 6.11 # commands. 6.12 -RUN_SCRIPTS="bootopts.sh i18n.sh hwconf.sh network.sh local.sh" 6.13 +RUN_SCRIPTS="bootopts.sh i18n.sh network.sh hwconf.sh local.sh" 6.14 6.15 # Daemons to start at boot time. SliTaz only provides a few daemons: firewall, 6.16 # Web server (lighttpd), SSH server (dropbear) and rsyncd, so boot order is