fix version info for packages that either lack PKG_VERSION or PKG_RELEASE
[openwrt.git] / package / base-files / default / sbin / mount_root
1 #!/bin/sh
2 is_dirty() {
3 grep Broadcom /proc/cpuinfo >&- || return 1
4 OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))"
5 return $(hexdump -v /dev/mtdblock/1 -s $OFFSET -n 1 -e '"%d"')
6 }
7
8 size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo)
9 mount none /tmp -t tmpfs -o size=$size
10
11 if [ "$1" != "failsafe" ]; then
12 mtd unlock linux
13 mount | grep jffs2 >&-
14 if [ $? = 0 ] ; then
15 if [ $(cat /proc/mtd | wc -l) = 6 ]; then
16 mtd erase OpenWrt
17 jffs2root --move
18 else
19 mount -o remount,rw /dev/root /
20 fi
21 else
22 . /bin/firstboot
23 is_dirty
24 [ $? != 0 ] && {
25 echo "switching to jffs2"
26 mount /dev/mtdblock/4 /jffs -t jffs2
27 pivot /jffs /rom
28 } || {
29 echo "jffs2 unusable; using ramdisk"
30 ramoverlay
31 }
32 fi
33 fi
34
35 mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777
36 mkdir -p /dev/pts
37 mount none /dev/pts -t devpts
38 mount -t sysfs none /sys 2>&-
This page took 0.04287 seconds and 5 git commands to generate.