prevent script from being run multiple times
[openwrt.git] / root / bin / firstboot
1 #!/bin/sh
2
3 exec 2>/dev/null
4
5 umount /jffs
6 mount | grep jffs2 && {
7 echo "firstboot has already been run"
8 echo "to run firstboot again you must boot failsafe"
9 exit
10 }
11
12 mtd erase OpenWrt
13 mount -t jffs2 /dev/mtdblock/4 /jffs
14 mount /dev/mtdblock/2 /rom -o ro
15 cd /jffs
16 {
17 cd /rom
18 find . -type d
19 } | xargs mkdir
20
21 for file in $(cd /rom; find * -type f; find * -type l;)
22 do {
23 ln -sf /rom/$file $file
24 } done
25
26 touch /tmp/resolv.conf
27 ln -s /tmp/resolv.conf /etc/resolv.conf
28
29 umount /rom
30 mount none /jffs/proc -t proc
31 pivot_root /jffs /jffs/rom
32 mount none /dev -t devfs
33 mount none /tmp -t ramfs
34 umount /rom/proc
35 umount /rom/tmp
36 umount /rom/dev
This page took 0.053727 seconds and 5 git commands to generate.