wok-6.x annotate busybox/stuff/init @ rev 1704
busybox: add rootfssize parameter for tmpfs root switching
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Nov 14 08:49:36 2008 +0000 (2008-11-14) |
parents | 6db4741ea7a4 |
children | daea944c82bd |
rev | line source |
---|---|
pascal@1703 | 1 #!/bin/sh |
pascal@1703 | 2 |
pascal@1704 | 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@1704 | 7 umount /proc |
pascal@1704 | 8 mount -t tmpfs $size tmpfs /mnt |
pascal@1704 | 9 for i in $(ls -a /); do |
pascal@1704 | 10 case "$i" in |
pascal@1704 | 11 .|..|init);; |
pascal@1704 | 12 mnt) mkdir /mnt/mnt;; |
pascal@1704 | 13 *) if ! cp -a /$i /mnt 2> /dev/null; then |
pascal@1704 | 14 echo -e "\\033[70G[ \\033[1;31mFailed\\033[0;39m ]" |
pascal@1704 | 15 umount /mnt |
pascal@1704 | 16 exec /sbin/init |
pascal@1704 | 17 fi;; |
pascal@1704 | 18 esac |
pascal@1704 | 19 done |
pascal@1704 | 20 echo -e "\\033[70G[ \\033[1;33mOK\\033[0;39m ]" |
pascal@1704 | 21 exec /sbin/switch_root mnt /sbin/init |