wok view busybox/stuff/init @ rev 2636

Up: slitaz-base-files (change release string) + slitaz-doc for 2.0
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 16 19:59:30 2009 +0200 (2009-04-16)
parents f0cb83ba12fd
children ed4e00c9b798
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 free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }')
8 umount /proc
9 [ -n "$size" ] || size="-o size=90%"
10 if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then
11 echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]"
12 exec /sbin/init
13 fi
14 for i in $(ls -a /); do
15 case "$i" in
16 .|..) ;;
17 mnt) mkdir /mnt/mnt;;
18 *) if ! cp -a /$i /mnt 2> /dev/null; then
19 echo -e "\\033[70G[ \\033[1;31mFailed\\033[0;39m ]"
20 umount /mnt
21 exec /sbin/init
22 fi;;
23 esac
24 done
25 echo -e "\\033[70G[ \\033[1;33mOK\\033[0;39m ]"
26 exec /sbin/switch_root mnt /sbin/init