+touch /tmp/.firstboot
+
+jdev=$(mount | awk '/jffs2/ {print $3}')
+
+if [ -z "$jdev" ]; then
+ mtd erase OpenWrt
+ mount -t jffs2 /dev/mtdblock/4 /jffs
+ cd /jffs
+else
+ echo "firstboot has already been run"
+ echo "fixing symlinks instead"
+ cd $jdev
+fi