4 mount | grep squashfs >&- || {
5 echo "You do not have a squashfs partition; aborting"
6 echo "(firstboot cannot be run on jffs2 based firmwares)"
10 [ -f "/tmp/.firstboot" ] && {
11 echo "firstboot is already running"
16 jdev=$(mount | awk '/jffs2/ {print $3}')
18 if [ -z "$jdev" ]; then
19 echo -n "Creating jffs2 partition... "
20 mtd erase OpenWrt >&- 2>&-
21 mount -t jffs2 /dev/mtdblock/4 /jffs
25 echo "firstboot has already been run"
26 echo "jffs2 partition is mounted, only resetting files"
32 mount /dev/mtdblock/2 /rom -o ro
34 echo -n "creating directories... "
42 echo -n "setting up symlinks... "
43 for file in $(cd /rom; find * -type f; find * -type l;)
46 "usr/lib/ipkg/info"|"etc/config") cp -f /rom/$file $file;;
47 *) ln -sf /rom/$file $file;;
52 touch /tmp/resolv.conf
53 ln -s /tmp/resolv.conf /etc/resolv.conf
56 mount none /jffs/proc -t proc
57 pivot_root /jffs /jffs/rom
58 mount none /dev -t devfs
59 mount none /tmp -t ramfs