wok-current rev 1772
busybox: check memory size before tmpfs switch
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Nov 27 16:12:32 2008 +0000 (2008-11-27) |
parents | 5379cbc00d16 |
children | 98a51003b20d |
files | busybox/stuff/init |
line diff
1.1 --- a/busybox/stuff/init Thu Nov 27 15:46:45 2008 +0000 1.2 +++ b/busybox/stuff/init Thu Nov 27 16:12:32 2008 +0000 1.3 @@ -4,8 +4,12 @@ 1.4 mount -t proc proc /proc 1.5 size="$(grep rootfssize= < /proc/cmdline | \ 1.6 sed 's/.*rootfssize=\([0-9]*[kmg%]\).*/-o size=\1/')" 1.7 +free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }') 1.8 umount /proc 1.9 -mount -t tmpfs $size tmpfs /mnt 1.10 +if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then 1.11 + echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]" 1.12 + exec /sbin/init 1.13 +fi 1.14 for i in $(ls -a /); do 1.15 case "$i" in 1.16 .|..) ;;