wok view 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 |
line source
1 #!/bin/sh
3 echo -n "switching / to tmpfs..."
4 mount -t proc proc /proc
5 size="$(grep rootfssize= < /proc/cmdline | \
6 sed 's/.*rootfssize=\([0-9]*[kmg%]\).*/-o size=\1/')"
7 umount /proc
8 mount -t tmpfs $size tmpfs /mnt
9 for i in $(ls -a /); do
10 case "$i" in
11 .|..|init);;
12 mnt) mkdir /mnt/mnt;;
13 *) if ! cp -a /$i /mnt 2> /dev/null; then
14 echo -e "\\033[70G[ \\033[1;31mFailed\\033[0;39m ]"
15 umount /mnt
16 exec /sbin/init
17 fi;;
18 esac
19 done
20 echo -e "\\033[70G[ \\033[1;33mOK\\033[0;39m ]"
21 exec /sbin/switch_root mnt /sbin/init