#!/bin/sh

. /etc/init.d/shell-utils.sh

# workaround for dhcp start
/sbin/ifconfig eth0 up

ln -s /etc/languages_utf8.txt /ram/data/languages_utf8.txt
ln -s /etc/timezone_list.conf /ram/data/timezone_list.conf

# setup local loopback
ifconfig lo 127.0.0.1 up
route add -net 127.0.0.0 netmask 255.0.0.0 lo

/usr/bin/read_opkey.sh

isNfsMount NFS_MOUNT
if [ "${NFS_MOUNT}" == "y" ]; then
    get_dev_for_name "raw" name
    ubiattach -p /dev/$name
fi

mount -t ubifs /dev/ubi0_2 /mnt/Userfs
if [ "$?" != "0" ] ; then
    /usr/local/share/app/bin/reset_userfs.sh
fi
if [ ! -d /mnt/Userfs/data ] ; then
    mkdir -p /mnt/Userfs/data
fi

# userspace firmware loader
echo "/sbin/hotplug" > /proc/sys/kernel/hotplug
