wok view busybox/stuff/init @ rev 1705

busybox: keep /init for tazusb write during tmpfs root switching
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Nov 14 09:24:33 2008 +0000 (2008-11-14)
parents 8c3c67c64f26
children 497da1516e30
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 .|..) ;;
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