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