slitaz-boot-scripts view etc/init.d/rcS @ rev 20

Modified rc.shutdown(killall5) + typo
author Christophe Lincoln <pankso@slitaz.org>
date Mon Jan 14 10:21:08 2008 +0100 (2008-01-14)
parents 3659b58f2398
children 8d77d0bba811
line source
1 #!/bin/sh
2 # /etc/init.d/rcS - Initial boot script for SliTaz GNU/Linux. rcS is the main
3 # initialisation script used to check fs, mount, clean, run scripts and start
4 # daemons.
5 #
6 # Config file is : /etc/rcS.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/rcS.conf
11 # Start by sleeping a bit.
12 echo "Processing /etc/init.d/rcS... "
13 sleep 1
15 # Mount /proc.
16 echo -n "Mounting proc filesystem... "
17 /bin/mount proc
18 status && sleep 1
20 # Before mounting filesystems we check fs specified in the file
21 # /etc/rcS.conf and variable $CHECK_FS.
22 if [ ! "$CHECK_FS" = "" ]; then
23 mount -o remount,ro /
24 for i in $CHECK_FS
25 do
26 echo "Checking filesystem on : $i"
27 /sbin/e2fsck -p $i
28 sleep 2
29 done
30 fi
32 # Remount rootfs rw.
33 echo "Remounting rootfs read/write... "
34 /bin/mount -o remount,rw /
36 # Mount all stuff from /etc/fstab.
37 echo "Mounting all staff from fstab... "
38 /bin/mount -a
40 # Start Udev to populate /dev and handle hotplug events
41 if [ "$UDEV" = "yes" ]; then
42 echo -n "Starting udev daemon..."
43 /sbin/udevd --daemon
44 status
45 echo -n "Executing : udevstart..."
46 /sbin/udevstart
47 status
48 echo "/sbin/udevd" > /proc/sys/kernel/hotplug
49 fi
51 # Creat /dev/cdrom if needed (symlink does not exist on LiveCD). Chmod
52 # hack for Asunder and burnbox allowing all users to burn/rip CD/DVD.
53 # Add also /dev/cdrom to fstab if entry dos not exist.
54 #
55 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3`
56 if [ ! "`readlink /dev/cdrom`" ]; then
57 echo -n "Creating symlink : /dev/cdrom..."
58 ln -s /dev/$DRIVE_NAME /dev/cdrom
59 chmod 0666 /dev/cdrom
60 status
61 fi
62 if ! grep -q "/dev/cdrom" /etc/fstab; then
63 echo -n "Adding /dev/cdrom to fstab..."
64 echo '/dev/cdrom /media/cdrom iso9660 user,noauto 0 0' \
65 >> /etc/fstab
66 status
67 fi
68 chmod 0666 /dev/$DRIVE_NAME
70 # Handle kernel cmdline parameter modprobe=<module_list>
71 if grep -q " modprobe=" /proc/cmdline; then
72 MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
73 for i in $MODULES; do
74 echo -n "Loading kernel module $i"
75 /sbin/modprobe $i
76 status
77 done
78 fi
80 # Handle kernel cmdline parameter config=<device>,<path> to source a
81 # disk init script
82 if grep -q " config=" /proc/cmdline; then
83 CONFIG=`cat /proc/cmdline | sed 's/.* config=\([^ ]*\).*/\1/'`
84 DEVICE=${CONFIG%,*}
85 SCRIPT=${CONFIG#*,}
86 echo -n "Source $SCRIPT from $DEVICE... "
87 if /bin/mount -r $DEVICE /mnt; then
88 . /mnt/$SCRIPT
89 /bin/umount /mnt
90 fi
91 status
92 fi
94 # Start syslogd and klogd.
95 if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
96 echo -n "Starting system log deamon: syslogd... "
97 /sbin/syslogd -s $SYSLOGD_ROTATED_SIZE && status
98 echo -n "Starting kernel log daemon: klogd... "
99 /sbin/klogd && status
100 else
101 echo "Kernel log daemons are disabled in /etc/rc.conf... "
102 fi
104 # Clean up the system.
105 if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then
106 echo -n "Cleaning up the system... "
107 rm -rf /tmp/*
108 rm -f /var/run/*.pid
109 status
110 else
111 echo "System clean up is disabled in /etc/rcS.conf... "
112 echo "Keeping all tmp and pid files... "
113 status
114 fi
116 # Set up tmp X11 and ICE dir.
117 echo -n "Setting up tmp X11 and ICE unix dir... "
118 /bin/mkdir -p /tmp/.X11-unix
119 /bin/mkdir -p /tmp/.ICE-unix
120 /bin/chmod 1777 /tmp/.X11-unix
121 /bin/chmod 1777 /tmp/.ICE-unix
122 status
124 # Load all modules listed in config file.
125 if [ ! "$LOAD_MODULES" = "" ]; then
126 for mod in $LOAD_MODULES
127 do
128 modprobe $mod
129 done
130 fi
132 # Start all scripts specified with $RUN_SCRIPTS.
133 echo "Executing all initialisation scripts..."
134 for script in $RUN_SCRIPTS
135 do
136 /etc/init.d/$script
137 done
139 # Start all daemons specified with $RUN_DAEMONS.
140 echo "Starting all daemons specified in /etc/rcS.conf..."
141 for daemon in $RUN_DAEMONS
142 do
143 /etc/init.d/$daemon start
144 done
146 # Reset screen and display a bold message.
147 if [ -n "$MESSAGE" ]; then
148 /usr/bin/reset
149 echo -e "\033[1m$MESSAGE\033[0m"
150 fi