# HG changeset patch # User Pascal Bellard # Date 1227802352 0 # Node ID 497da1516e301a7c2441891eef15d563126f0acc # Parent 5379cbc00d162faf1056474947f8383ed4c7fd20 busybox: check memory size before tmpfs switch diff -r 5379cbc00d16 -r 497da1516e30 busybox/stuff/init --- a/busybox/stuff/init Thu Nov 27 15:46:45 2008 +0000 +++ b/busybox/stuff/init Thu Nov 27 16:12:32 2008 +0000 @@ -4,8 +4,12 @@ mount -t proc proc /proc size="$(grep rootfssize= < /proc/cmdline | \ sed 's/.*rootfssize=\([0-9]*[kmg%]\).*/-o size=\1/')" +free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }') umount /proc -mount -t tmpfs $size tmpfs /mnt +if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then + echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]" + exec /sbin/init +fi for i in $(ls -a /); do case "$i" in .|..) ;;