slitaz-boot-scripts rev 310
/etc/init.d/rcS, /init: use /run
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Jun 02 14:31:16 2012 +0200 (2012-06-02) |
parents | 6b2d11ed8718 |
children | c2eb90cb74f2 |
files | etc/init.d/rcS init |
line diff
1.1 --- a/etc/init.d/rcS Sat Jun 02 14:12:23 2012 +0200 1.2 +++ b/etc/init.d/rcS Sat Jun 02 14:31:16 2012 +0200 1.3 @@ -24,11 +24,6 @@ 1.4 echo -n "Mounting proc filesystem on /proc" 1.5 mount proc && status 1.6 1.7 -# Mount /run as tmpfs runtime data are not written to disk 1.8 -echo -n "Mounting tmpfs filesystem on: /run" 1.9 -mount -t tmpfs tmpfs /run 1.10 -status 1.11 - 1.12 # Trigger Udev and handle hotplug events 1.13 if [ "$UDEV" == "yes" ]; then 1.14 echo -n "Mounting devtmpfs filesystem on: /dev" 1.15 @@ -210,17 +205,17 @@ 1.16 1.17 *) 1.18 # --> readonly --> readwrite 1.19 - if [ ! -s /tmp/boot.log ]; then 1.20 - mount -t tmpfs tmpfs /tmp 1.21 + if [ ! -s /run/boot.log ]; then 1.22 + # Mount /run as tmpfs runtime data are not written to disk 1.23 + mount -t tmpfs tmpfs /run 1.24 fi 1.25 - /etc/init.d/rcS readonly 2>&1 | tee -a /tmp/boot.log 1.26 + /etc/init.d/rcS readonly 2>&1 | tee -a /run/boot.log 1.27 # Logrotate boot.log 1.28 last=.9 1.29 for i in .8 .7 .6 .5 .4 .3 .2 .1 .0 '' ; do 1.30 mv -f /var/log/boot.log${i} /var/log/boot.log${last} 2>/dev/null 1.31 last=$i 1.32 done 1.33 - mv -f /tmp/boot.log /var/log/boot.log 1.34 - umount /tmp 1.35 + mv -f /run/boot.log /var/log/boot.log 1.36 /etc/init.d/rcS readwrite 2>&1 | tee -a /var/log/boot.log ;; 1.37 esac
2.1 --- a/init Sat Jun 02 14:12:23 2012 +0200 2.2 +++ b/init Sat Jun 02 14:31:16 2012 +0200 2.3 @@ -2,7 +2,7 @@ 2.4 2.5 success() 2.6 { 2.7 - cat > /tmp/init 2.8 + cat > /run/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,7 +10,7 @@ 2.13 2.14 launch_init() 2.15 { 2.16 - mount --move /tmp /mnt/tmp 2.17 + mount --move /run /mnt/run 2.18 success <<EOT 2.19 exec /sbin/switch_root mnt /sbin/init 2.20 EOT 2.21 @@ -85,9 +85,9 @@ 2.22 } 2.23 2.24 if [ "$1" != "logged" ]; then 2.25 - mount -t tmpfs tmpfs /tmp 2.26 - /init logged 2>&1 | tee /tmp/boot.log 2.27 - . /tmp/init 2.28 + mount -t tmpfs tmpfs /run 2.29 + /init logged 2>&1 | tee /run/boot.log 2.30 + . /run/init 2.31 else 2.32 mount -t proc proc /proc 2.33 mount -t sysfs sysfs /sys 2.34 @@ -157,13 +157,13 @@ 2.35 subroot="/$(sed 's/.*subroot=\([^ ]*\).*/\1/' < /proc/cmdline)" && 2.36 echo -n "Chrooting to $subroot..." 2.37 mount --move /dev/pts /mnt$subroot/dev/pts 2.38 - tmp=$subroot/tmp 2.39 - mount --move /tmp /mnt$tmp 2.40 + run=$subroot/run 2.41 + mount --move /run /mnt$run 2.42 cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so /usr/sbin/chroot | sed \ 2.43 - 's|.*=> \(/lib/l[^ ]*\).*|\1|;/^\//!d') /usr/sbin/chroot /mnt$tmp 2.44 + 's|.*=> \(/lib/l[^ ]*\).*|\1|;/^\//!d') /usr/sbin/chroot /mnt$run 2.45 success <<EOT 2.46 -export LD_LIBRARY_PATH=$tmp:/lib 2.47 -exec /sbin/switch_root mnt $tmp/$(cd /mnt$tmp ; ls ld-*) $tmp/chroot $subroot /sbin/init 2.48 +export LD_LIBRARY_PATH=$run:/lib 2.49 +exec /sbin/switch_root mnt $run/$(cd /mnt$run ; ls ld-*) $run/chroot $subroot /sbin/init 2.50 EOT 2.51 fi 2.52 echo -n "Switching / to tmpfs" 2.53 @@ -172,7 +172,7 @@ 2.54 free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }') 2.55 umount /proc 2.56 [ -n "$size" ] || size="-o size=90%" 2.57 -echo "exec /sbin/init" > /tmp/init 2.58 +echo "exec /sbin/init" > /run/init 2.59 if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then 2.60 echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]" 2.61 exit