updates from whiterussian
[openwrt.git] / package / base-files / default / sbin / mount_root
1 #!/bin/sh
2 if [ "$1" != "failsafe" ]; then 
3         mount | grep jffs2 >&-
4         if [ $? = 0 ] ; then
5                 if [ $(cat /proc/mtd | wc -l) = 6 ]; then
6                         echo 5 > /proc/sys/diag
7                         mtd unlock linux
8                         mtd erase OpenWrt
9                         jffs2root --move
10                 else
11                         mtd unlock rootfs
12                         mount -o remount,rw /dev/root /
13                 fi
14         else
15                 if [ -z "$(nvram get no_root_swap)" ]; then
16                         mtd unlock OpenWrt
17                         mount -t jffs2 /dev/mtdblock/4 /jffs
18                         pivot_root /jffs /jffs/rom
19                         mount none /proc -t proc
20                         mount none /dev -t devfs
21                         umount /rom/proc rom/dev >&-
22                 fi
23         fi
24 fi
25 mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50%
26 mkdir -p /dev/pts
27 mount none /dev/pts -t devpts