slitaz-boot-scripts rev 308
/init: use tee instead of script
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Jun 02 13:49:20 2012 +0200 (2012-06-02) |
parents | ce60300bc0cf |
children | 6b2d11ed8718 |
files | etc/init.d/rcS init |
line diff
1.1 --- a/etc/init.d/rcS Sat Jun 02 01:45:08 2012 +0200 1.2 +++ b/etc/init.d/rcS Sat Jun 02 13:49:20 2012 +0200 1.3 @@ -213,7 +213,7 @@ 1.4 if [ ! -s /tmp/boot.log ]; then 1.5 mount -t tmpfs tmpfs /tmp 1.6 fi 1.7 - /etc/init.d/rcS readonly | tee /tmp/boot.log 1.8 + /etc/init.d/rcS readonly 2>&1 | tee -a /tmp/boot.log 1.9 # Lograde boot.log 1.10 last=.9 1.11 for i in .8 .7 .6 .5 .4 .3 .2 .1 .0 '' ; do 1.12 @@ -222,5 +222,5 @@ 1.13 done 1.14 mv -f /tmp/boot.log /var/log/boot.log 1.15 umount /tmp 1.16 - /etc/init.d/rcS readwrite | tee -a /var/log/boot.log ;; 1.17 + /etc/init.d/rcS readwrite 2>&1 | tee -a /var/log/boot.log ;; 1.18 esac
2.1 --- a/init Sat Jun 02 01:45:08 2012 +0200 2.2 +++ b/init Sat Jun 02 13:49:20 2012 +0200 2.3 @@ -2,7 +2,7 @@ 2.4 2.5 success() 2.6 { 2.7 - cat > /dev/shm/init 2.8 + cat > /tmp/init 2.9 [ -d /proc/sys ] && umount /proc 2.10 echo -e "\\033[70G[ \\033[1;32mOK\\033[0;39m ]" 2.11 exit 2.12 @@ -10,8 +10,7 @@ 2.13 2.14 launch_init() 2.15 { 2.16 - mount --move /dev/pts /mnt/dev/pts 2.17 - mount --move /dev/shm /mnt/dev/shm 2.18 + mount --move /tmp /mnt/tmp 2.19 success <<EOT 2.20 exec /sbin/switch_root mnt /sbin/init 2.21 EOT 2.22 @@ -86,10 +85,9 @@ 2.23 } 2.24 2.25 if [ "$1" != "logged" ]; then 2.26 - mount -t devpts devpts /dev/pts 2.27 - mount -t tmpfs tmpfs /dev/shm 2.28 - script -qc '/init logged' /dev/shm/boot.log 2.29 - . /dev/shm/init 2.30 + mount -t tmpfs tmpfs /tmp 2.31 + /init logged 2>&1 | tee /tmp/boot.log 2.32 + . /tmp/init 2.33 else 2.34 mount -t proc proc /proc 2.35 mount -t sysfs sysfs /sys 2.36 @@ -159,13 +157,13 @@ 2.37 subroot="/$(sed 's/.*subroot=\([^ ]*\).*/\1/' < /proc/cmdline)" && 2.38 echo -n "Chrooting to $subroot..." 2.39 mount --move /dev/pts /mnt$subroot/dev/pts 2.40 - shm=$subroot/dev/shm 2.41 - mount --move /dev/shm /mnt$shm 2.42 + tmp=$subroot/tmp 2.43 + mount --move /tmp /mnt$tmp 2.44 cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so /usr/sbin/chroot | sed \ 2.45 - 's|.*=> \(/lib/l[^ ]*\).*|\1|;/^\//!d') /usr/sbin/chroot /mnt$shm 2.46 + 's|.*=> \(/lib/l[^ ]*\).*|\1|;/^\//!d') /usr/sbin/chroot /mnt$tmp 2.47 success <<EOT 2.48 -export LD_LIBRARY_PATH=$shm:/lib 2.49 -exec /sbin/switch_root mnt $shm/$(cd /mnt$shm ; ls ld-*) $shm/chroot $subroot /sbin/init 2.50 +export LD_LIBRARY_PATH=$tmp:/lib 2.51 +exec /sbin/switch_root mnt $tmp/$(cd /mnt$tmp ; ls ld-*) $tmp/chroot $subroot /sbin/init 2.52 EOT 2.53 fi 2.54 echo -n "Switching / to tmpfs" 2.55 @@ -174,7 +172,7 @@ 2.56 free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }') 2.57 umount /proc 2.58 [ -n "$size" ] || size="-o size=90%" 2.59 -echo "exec /sbin/init" > /dev/shm/init 2.60 +echo "exec /sbin/init" > /tmp/init 2.61 if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then 2.62 echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]" 2.63 exit