allow firstboot to be rerun
[openwrt.git] / root / bin / firstboot
1 #!/bin/sh
2 # $Id$
3
4 exec 2>/dev/null
5
6 umount /jffs
7 if [ -z "$(mount | grep jffs2)" ]; then
8 mtd erase OpenWrt
9 mount -t jffs2 /dev/mtdblock/4 /jffs
10 mount /dev/mtdblock/2 /rom -o ro
11 cd /jffs
12 else
13 echo "firstboot has already been run"
14 echo "fixing symlinks instead"
15 cd /
16 fi
17
18 {
19 cd /rom
20 find . -type d
21 cd -
22 } | xargs mkdir
23
24 for file in $(cd /rom; find * -type f; find * -type l;)
25 do {
26 ln -sf /rom/$file $file
27 } done
28
29 touch /tmp/resolv.conf
30 ln -s /tmp/resolv.conf /etc/resolv.conf
31
32 umount /rom
33 mount none /jffs/proc -t proc
34 pivot_root /jffs /jffs/rom
35 mount none /dev -t devfs
36 mount none /tmp -t ramfs
37 umount /rom/proc
38 umount /rom/tmp
39 umount /rom/dev
This page took 0.049839 seconds and 5 git commands to generate.