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

/etc/init.d/rcS: avoid hardcoded path to help slitaz-loram-cdrom patch
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Mar 08 10:09:01 2008 +0000 (2008-03-08)
parents 1d23d97846bd
children 49cd9147d12d
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 if [ "$1" != "logged" ]; then #logged
13 # Start by sleeping a bit.
14 echo "Processing /etc/init.d/rcS... "
15 sleep 1
17 # Mount /proc.
18 echo -n "Mounting proc filesystem... "
19 /bin/mount proc
20 status && sleep 1
22 # Before mounting filesystems we check fs specified in the file
23 # /etc/rcS.conf and variable $CHECK_FS.
24 if [ ! "$CHECK_FS" = "" ]; then
25 mount -o remount,ro /
26 for i in $CHECK_FS
27 do
28 echo "Checking filesystem on : $i"
29 /sbin/e2fsck -p $i
30 sleep 2
31 done
32 fi
34 # Remount rootfs rw.
35 echo "Remounting rootfs read/write... "
36 /bin/mount -o remount,rw /
38 # Mount all stuff from /etc/fstab.
39 echo "Mounting all staff from fstab... "
40 /bin/mount -a
42 # Start Udev to populate /dev and handle hotplug events
43 if [ "$UDEV" = "yes" ]; then
44 echo -n "Starting udev daemon..."
45 /sbin/udevd --daemon
46 status
47 echo -n "Executing : udevstart..."
48 /sbin/udevstart
49 status
50 echo "/sbin/udevd" > /proc/sys/kernel/hotplug
51 fi
53 /bin/dmesg > /var/log/dmesg.log
54 vcsa2txt < /dev/vcsa1 > /var/log/boot.log
55 script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log
57 else #logged
59 # Creat /dev/cdrom if needed (symlink does not exist on LiveCD). Chmod
60 # hack for Asunder and burnbox allowing all users to burn/rip CD/DVD.
61 # Add also /dev/cdrom to fstab if entry dos not exist.
62 #
63 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3`
64 if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then
65 echo -n "Creating symlink : /dev/cdrom..."
66 ln -s /dev/$DRIVE_NAME /dev/cdrom
67 chmod 0666 /dev/cdrom
68 chmod 0666 /dev/$DRIVE_NAME
69 status
70 fi
71 if ! grep -q "/dev/cdrom" /etc/fstab; then
72 echo -n "Adding /dev/cdrom to fstab..."
73 echo '/dev/cdrom /media/cdrom iso9660 user,noauto 0 0' \
74 >> /etc/fstab
75 status
76 fi
78 # Handle kernel cmdline parameter modprobe=<module_list>
79 if grep -q " modprobe=" /proc/cmdline; then
80 MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
81 for i in $MODULES; do
82 echo -n "Loading kernel module $i"
83 /sbin/modprobe $i
84 status
85 done
86 fi
88 # Handle kernel cmdline parameter config=<device>,<path> to source a
89 # disk init script
90 if grep -q " config=" /proc/cmdline; then
91 CONFIG=`cat /proc/cmdline | sed 's/.* config=\([^ ]*\).*/\1/'`
92 DEVICE=${CONFIG%,*}
93 SCRIPT=${CONFIG#*,}
94 echo -n "Source $SCRIPT from $DEVICE... "
95 if /bin/mount -r $DEVICE /mnt; then
96 . /mnt/$SCRIPT
97 /bin/umount /mnt
98 fi
99 status
100 fi
102 # Start syslogd and klogd.
103 if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then
104 echo -n "Starting system log deamon: syslogd... "
105 /sbin/syslogd -s $SYSLOGD_ROTATED_SIZE && status
106 echo -n "Starting kernel log daemon: klogd... "
107 /sbin/klogd && status
108 else
109 echo "Kernel log daemons are disabled in /etc/rc.conf... "
110 fi
112 # Clean up the system.
113 if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then
114 echo -n "Cleaning up the system... "
115 rm -rf /tmp/*
116 rm -f /var/run/*.pid
117 rm -f /var/lock/*
118 status
119 else
120 echo "System clean up is disabled in /etc/rcS.conf... "
121 echo "Keeping all tmp and pid files... "
122 status
123 fi
125 # Set up tmp X11 and ICE dir.
126 echo -n "Setting up tmp X11 and ICE unix dir... "
127 /bin/mkdir -p /tmp/.X11-unix
128 /bin/mkdir -p /tmp/.ICE-unix
129 /bin/chmod 1777 /tmp/.X11-unix
130 /bin/chmod 1777 /tmp/.ICE-unix
131 status
133 # Load all modules listed in config file.
134 if [ ! "$LOAD_MODULES" = "" ]; then
135 for mod in $LOAD_MODULES
136 do
137 modprobe $mod
138 done
139 fi
141 # Start all scripts specified with $RUN_SCRIPTS.
142 echo "Executing all initialisation scripts..."
143 for script in $RUN_SCRIPTS
144 do
145 if [ -x /etc/init.d/$daemon ]; then
146 /etc/init.d/$script
147 fi
148 done
150 # Re-source main config file, in Live mode daemons list ca be modified
151 # by boot options.
152 . /etc/rcS.conf
154 # Start all daemons specified with $RUN_DAEMONS.
155 echo "Starting all daemons specified in /etc/rcS.conf..."
156 for daemon in $RUN_DAEMONS
157 do
158 if [ -x /etc/init.d/$daemon ]; then
159 /etc/init.d/$daemon start
160 fi
161 done
163 # Reset screen and display a bold message.
164 if [ -n "$MESSAGE" ]; then
165 /usr/bin/reset
166 echo -e "\033[1m$MESSAGE\033[0m"
167 fi
169 fi #logged