#!/bin/sh
# DD-WRT V22 postinit script by Sebastian Gottschall (BrainSlayer). (some parts are taken from OpenWRT)

# mount jffs2


mtd unlock mtd4
mount -t jffs2 /dev/mtdblock/4 /jffs

jdev=$(mount | awk '/jffs2/ {print $3}')
if [ -z "$jdev" ]; then
	echo -n "Creating jffs2 partition... "
	mtd erase ddwrt >&- 
	mount -t jffs2 /dev/mtdblock/4 /jffs
	echo "done"
else
	echo "jffs2 partition is mounted"
fi