slitaz-boot-scripts rev 305

rcS: log readwrite
author Christophe Lincoln <pankso@slitaz.org>
date Sat Jun 02 00:22:08 2012 +0200 (2012-06-02)
parents 1ac4d1be812e
children 175982c0484c
files etc/init.d/rcS
line diff
     1.1 --- a/etc/init.d/rcS	Fri Jun 01 22:35:36 2012 +0200
     1.2 +++ b/etc/init.d/rcS	Sat Jun 02 00:22:08 2012 +0200
     1.3 @@ -18,10 +18,10 @@
     1.4  
     1.5  readonly)
     1.6  
     1.7 -colorize 34 "Processing /etc/init.d/rcS..."
     1.8 +colorize 34 "Processing: /etc/init.d/rcS..."
     1.9  
    1.10  # Mount /proc.
    1.11 -echo -n "Mounting proc filesystem..."
    1.12 +echo -n "Mounting proc filesystem on /proc"
    1.13  mount proc && status
    1.14  
    1.15  # Mount /run as tmpfs to avoid pidfile and other runtime data behing
    1.16 @@ -30,26 +30,9 @@
    1.17  mount -t tmpfs tmpfs /run
    1.18  status
    1.19  
    1.20 -# Before mounting filesystems we check fs specified in the file
    1.21 -# /etc/rcS.conf and variable $CHECK_FS.
    1.22 -if [ "$CHECK_FS" ]; then
    1.23 -	mount -o remount,ro /
    1.24 -	for i in $CHECK_FS; do
    1.25 -		colorize 36 "Checking filesystem: $i"
    1.26 -		e2fsck -p $i
    1.27 -	done
    1.28 -fi
    1.29 -
    1.30 -# Remount rootfs rw.
    1.31 -echo "Remounting rootfs read/write..."
    1.32 -mount -o remount,rw /
    1.33 -;;
    1.34 -
    1.35 -readwrite)
    1.36 -
    1.37  # Trigger Udev and handle hotplug events
    1.38 -if [ "$UDEV" = "yes" ]; then
    1.39 -	echo -n "Mounting devtmpfs filesystem..."
    1.40 +if [ "$UDEV" == "yes" ]; then
    1.41 +	echo -n "Mounting devtmpfs filesystem on: /dev"
    1.42  	mount -t devtmpfs devtmpfs /dev
    1.43  	status
    1.44  	echo "Starting udev daemon..."
    1.45 @@ -62,15 +45,37 @@
    1.46  	echo "" > /proc/sys/kernel/hotplug
    1.47  fi
    1.48  
    1.49 +# Busybox mdev is an udev alternative tu Udev.
    1.50 +if [ "$UDEV" == "mdev" ]; then
    1.51 +	echo -n "Executing mdev -s to populate /dev..."
    1.52 +	mdev -s && echo "mdev" > /proc/sys/kernel/hotplug
    1.53 +	status
    1.54 +fi
    1.55 +
    1.56 +# Before mounting filesystems we check fs specified in the file
    1.57 +# /etc/rcS.conf and variable $CHECK_FS. WE need udev started to
    1.58 +# have /dev/* populated
    1.59 +if [ "$CHECK_FS" ]; then
    1.60 +	mount -o remount,ro /
    1.61 +	for i in $CHECK_FS; do
    1.62 +		colorize 36 "Checking filesystem: $i"
    1.63 +		e2fsck -p $i
    1.64 +	done
    1.65 +fi
    1.66 +
    1.67 +# Remount rootfs rw.
    1.68 +echo "Remounting rootfs read/write..."
    1.69 +mount -o remount,rw /
    1.70 +
    1.71  # Mount filesystems in /etc/fstab.
    1.72  echo "Mounting filesystems in fstab..."
    1.73  mount -a
    1.74 +;;
    1.75 +
    1.76 +readwrite)
    1.77  
    1.78  # Be quiet
    1.79  echo "0 0 0 0" > /proc/sys/kernel/printk
    1.80 -;;
    1.81 -
    1.82 -logged)
    1.83  
    1.84  # Store boot messages to log files.
    1.85  dmesg > /var/log/dmesg.log &
    1.86 @@ -205,22 +210,20 @@
    1.87  ;;
    1.88  
    1.89  *)
    1.90 -	# --> readonly --> readwrite --> logged.
    1.91 -	#if [ ! -s /run/boot.log ]; then
    1.92 +	# --> readonly --> readwrite
    1.93 +	#if [ ! -s /tmp/boot.log ]; then
    1.94 +		#mount -t tmpfs tmpfs /tmp
    1.95  		#mount -t devpts devpts /dev/pts
    1.96 -		#mount -t tmpfs tmpfs /run
    1.97  	#fi
    1.98 -	#script -aqc '/etc/init.d/rcS readonly' /run/boot.log
    1.99 -	#script -aqc '/etc/init.d/rcS readwrite' /run/boot.log
   1.100 +	#script -aqc '/etc/init.d/rcS readonly' /tmp/boot.log
   1.101  	/etc/init.d/rcS readonly
   1.102 -	/etc/init.d/rcS readwrite
   1.103 +	#umount /tmp
   1.104  	# Lograde boot.log
   1.105 -	#last=.9
   1.106 -	#for i in .8 .7 .6 .5 .4 .3 .2 .1 .0 '' ; do
   1.107 -		#mv -f /var/log/boot.log$i /var/log/boot.log$last 2>/dev/null
   1.108 -		#last=$i
   1.109 -	#done
   1.110 -	#mv -f /run/boot.log /var/log/boot.log
   1.111 -	#script -aqc '/etc/init.d/rcS logged' /var/log/boot.log
   1.112 -	/etc/init.d/rcS logged ;;
   1.113 +	last=.9
   1.114 +	for i in .8 .7 .6 .5 .4 .3 .2 .1 .0 '' ; do
   1.115 +		mv -f /var/log/boot.log$i /var/log/boot.log$last 2>/dev/null
   1.116 +		last=$i
   1.117 +	done
   1.118 +	#mv -f /tmp/boot.log /var/log/boot.log
   1.119 +	script -aqc '/etc/init.d/rcS readwrite' /var/log/boot.log ;;
   1.120  esac