move busybox init scripts from base-files into the busybox package and make them...
[openwrt/openwrt.git] / package / base-files / au1000 / sbin / mount_root
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 mount none /proc -t proc
5 size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo)
6 mount none /tmp -t tmpfs -o size=$size
7
8 if [ "$1" != "failsafe" ]; then
9 mtd unlock filesystem
10 mount | grep jffs2 >&-
11 if [ $? = 0 ] ; then
12 if [ $(cat /proc/mtd | wc -l) = 6 ]; then
13 mtd erase filesystem
14 jffs2root --move
15 else
16 mount -o remount,rw /dev/root /
17 fi
18 else
19 . /bin/firstboot
20 fi
21 fi
22
23 mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777
24 mkdir -p /dev/pts
25 mount none /dev/pts -t devpts
26 mount -t sysfs none /sys 2>&-