inital commit of 20040316
[openwrt.git] / root / bin / firstboot
1 #!/bin/sh
2
3 exec 2>/dev/null
4
5 umount /jffs 
6 mtd erase OpenWrt
7 mount -t jffs2 /dev/mtdblock/4 /jffs
8 mount /dev/mtdblock/2 /rom -o ro
9 cd /jffs
10 {
11         cd /rom
12         find . -type d
13 } | xargs mkdir
14
15 for file in $(cd /rom; find *  -type f; find *  -type l;)
16 do {
17         ln -sf  /rom/$file $file
18 } done
19
20 touch /tmp/resolv.conf
21 ln -s /tmp/resolv.conf /etc/resolv.conf
22
23 umount /rom
24 mount none /jffs/proc -t proc
25 pivot_root /jffs /jffs/rom
26 mount none /dev  -t devfs
27 mount none /tmp  -t ramfs
28 umount /rom/proc
29 umount /rom/tmp
30 umount /rom/dev