wok-6.x annotate busybox/stuff/init @ rev 2397
busybox/inetd: improve start script
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Mar 10 09:17:01 2009 +0000 (2009-03-10) |
parents | f0cb83ba12fd |
children | ed4e00c9b798 |
rev | line source |
---|---|
pascal@1703 | 1 #!/bin/sh |
pascal@1703 | 2 |
pascal@2397 | 3 echo -n "Switching / to tmpfs..." |
pascal@1704 | 4 mount -t proc proc /proc |
pascal@1704 | 5 size="$(grep rootfssize= < /proc/cmdline | \ |
pascal@1704 | 6 sed 's/.*rootfssize=\([0-9]*[kmg%]\).*/-o size=\1/')" |
pascal@1772 | 7 free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }') |
pascal@1704 | 8 umount /proc |
pascal@1775 | 9 [ -n "$size" ] || size="-o size=90%" |
pascal@1772 | 10 if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then |
pascal@1772 | 11 echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]" |
pascal@1772 | 12 exec /sbin/init |
pascal@1772 | 13 fi |
pascal@1704 | 14 for i in $(ls -a /); do |
pascal@1704 | 15 case "$i" in |
pascal@1705 | 16 .|..) ;; |
pascal@1704 | 17 mnt) mkdir /mnt/mnt;; |
pascal@1704 | 18 *) if ! cp -a /$i /mnt 2> /dev/null; then |
pascal@1704 | 19 echo -e "\\033[70G[ \\033[1;31mFailed\\033[0;39m ]" |
pascal@1704 | 20 umount /mnt |
pascal@1704 | 21 exec /sbin/init |
pascal@1704 | 22 fi;; |
pascal@1704 | 23 esac |
pascal@1704 | 24 done |
pascal@1704 | 25 echo -e "\\033[70G[ \\033[1;33mOK\\033[0;39m ]" |
pascal@1704 | 26 exec /sbin/switch_root mnt /sbin/init |