#!/bin/sh

source /etc/utils/shell-utils.sh

# UserFS
get_flash_type type
if [ "$type" == "nand" ];then
    userfs_numb=`ubinfo /dev/ubi0 -N Userfs | grep "Volume ID:" | awk '{print $3}'`
    if [ "$userfs_numb" != "" ] ; then
        umount /mnt/Userfs
        ubiupdatevol /dev/ubi0_${userfs_numb} -t
        mount -t ubifs /dev/ubi0_$userfs_numb /mnt/Userfs
        mkdir -p /mnt/Userfs/data
    fi
else
    umount /mnt/Userfs > /dev/null 2> /dev/null
    mkfs.ext4 -F /dev/block/mmc0/by-name/Userfs > /dev/null 2> /dev/null
    mount -t ext4 /dev/block/mmc0/by-name/Userfs /mnt/Userfs
    mkdir /mnt/Userfs/data
fi


