add cheapass arp
[openwrt.git] / target / default / target_skeleton / bin / firstboot
1 #!/bin/sh
2 # $Id$
3
4
5 [ -f "/tmp/.firstboot" ] && {
6 echo "firstboot is already running"
7 return
8 }
9 touch /tmp/.firstboot
10
11 jdev=$(mount | awk '/jffs2/ {print $3}')
12
13 if [ -z "$jdev" ]; then
14 echo -n "Creating jffs2 partition... "
15 mtd erase OpenWrt >&-
16 mount -t jffs2 /dev/mtdblock/4 /jffs
17 echo "done"
18 cd /jffs
19 else
20 echo "firstboot has already been run"
21 echo "jffs2 partition is mounted, only resetting files"
22 cd $jdev
23 fi
24
25 exec 2>/dev/null
26
27 mount /dev/mtdblock/2 /rom -o ro
28
29 echo -n "creating directories... "
30 {
31 cd /rom
32 find . -type d
33 cd -
34 } | xargs mkdir
35 echo "done"
36
37 echo -n "setting up symlinks... "
38 for file in $(cd /rom; find * -type f; find * -type l;)
39 do {
40 ln -sf /rom/$file $file
41 } done
42 echo "done"
43
44 touch /tmp/resolv.conf
45 ln -s /tmp/resolv.conf /etc/resolv.conf
46
47 umount /rom
48 mount none /jffs/proc -t proc
49 pivot_root /jffs /jffs/rom
50 mount none /dev -t devfs
51 mount none /tmp -t ramfs
52 umount /rom/proc
53 umount /rom/tmp
54 umount /rom/dev
This page took 0.041825 seconds and 5 git commands to generate.