slitaz-boot-scripts diff etc/init.d/rcS @ rev 276

log from any boot console
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jan 24 11:30:41 2012 +0100 (2012-01-24)
parents 464ba1f4299a
children e5d3e6f80efd
line diff
     1.1 --- a/etc/init.d/rcS	Sat May 28 23:12:22 2011 +0200
     1.2 +++ b/etc/init.d/rcS	Tue Jan 24 11:30:41 2012 +0100
     1.3 @@ -10,9 +10,11 @@
     1.4  
     1.5  # Set TZ and boot time.
     1.6  [ -s /etc/TZ ] && export TZ="$(cat /etc/TZ)"
     1.7 -bootdate=`date +%s`
     1.8 +[ -n "$bootdate" ] || bootdate=`date +%s`
     1.9  
    1.10 -if [ "$1" != "logged" ]; then # logged
    1.11 +case "$1" in
    1.12 +
    1.13 +readonly)
    1.14  
    1.15  # Graphical boot start.
    1.16  if [ "$FBSPLASH" == "yes" ]; then
    1.17 @@ -32,26 +34,6 @@
    1.18  
    1.19  [ "$FBSPLASH" == "yes" ] && echo "10" > /etc/fbsplash/fifo
    1.20  
    1.21 -# Parse cmdline args for earlier boot options. All other boot options
    1.22 -# are in /etc/init./bootopts.sh.
    1.23 -echo -n "Searching for early boot options..."
    1.24 -for opt in `cat /proc/cmdline`
    1.25 -do
    1.26 -	case $opt in
    1.27 -		fastbootx|fbx)
    1.28 -			export FAST_BOOT_X="yes" ;;
    1.29 -		cdrom=*)
    1.30 -			export CDROM=${opt#cdrom=} ;;
    1.31 -		modprobe=*)
    1.32 -			export MODPROBE="yes" ;;
    1.33 -		config=*)
    1.34 -			export CONFIG=${opt#config=} ;;
    1.35 -		*)
    1.36 -			continue ;;
    1.37 -	esac
    1.38 -done
    1.39 -status
    1.40 -
    1.41  [ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo
    1.42  
    1.43  # Before mounting filesystems we check fs specified in the file
    1.44 @@ -68,6 +50,9 @@
    1.45  # Remount rootfs rw.
    1.46  echo "Remounting rootfs read/write..."
    1.47  /bin/mount -o remount,rw /
    1.48 +;;
    1.49 +
    1.50 +readwrite)
    1.51  
    1.52  # Trigger Udev and handle hotplug events
    1.53  if [ "$UDEV" = "yes" ]; then
    1.54 @@ -89,10 +74,29 @@
    1.55  
    1.56  # Store boot messages to log files.
    1.57  /bin/dmesg > /var/log/dmesg.log &
    1.58 -conspy -d | sed 's/ *$//;/^$/d;/^Processi\|^.witchi/,$!d' > /var/log/boot.log
    1.59 -script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log
    1.60 +;;
    1.61  
    1.62 -else # logged
    1.63 +logged)
    1.64 +
    1.65 +# Parse cmdline args for earlier boot options. All other boot options
    1.66 +# are in /etc/init./bootopts.sh.
    1.67 +echo -n "Searching for early boot options..."
    1.68 +for opt in `cat /proc/cmdline`
    1.69 +do
    1.70 +	case $opt in
    1.71 +		fastbootx|fbx)
    1.72 +			export FAST_BOOT_X="yes" ;;
    1.73 +		cdrom=*)
    1.74 +			export CDROM=${opt#cdrom=} ;;
    1.75 +		modprobe=*)
    1.76 +			export MODPROBE="yes" ;;
    1.77 +		config=*)
    1.78 +			export CONFIG=${opt#config=} ;;
    1.79 +		*)
    1.80 +			continue ;;
    1.81 +	esac
    1.82 +done
    1.83 +status
    1.84  
    1.85  # Clean up the system.
    1.86  if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then
    1.87 @@ -280,5 +284,19 @@
    1.88  echo $time > /var/log/boot-time
    1.89  echo "SliTaz boot time: ${time}s"
    1.90  [ "$FBSPLASH" == "yes" ] && echo "exit" > /etc/fbsplash/fifo
    1.91 +;;
    1.92  
    1.93 -fi # logged
    1.94 +*)
    1.95 +if [ ! -s /dev/shm/boot.log ]; then
    1.96 +	mount -t devpts devpts /dev/pts
    1.97 +	mount -t tmpfs tmpfs /dev/shm
    1.98 +fi
    1.99 +script -aqc '/etc/init.d/rcS readonly' /dev/shm/boot.log
   1.100 +mv -f /dev/shm/boot.log /boot.log
   1.101 +umount /dev/shm
   1.102 +script -aqc '/etc/init.d/rcS readwrite' /boot.log
   1.103 +mv -f /boot.log /var/log/boot.log
   1.104 +script -aqc '/etc/init.d/rcS logged' /var/log/boot.log
   1.105 +;;
   1.106 +
   1.107 +esac