#!/bin/sh

CheckProgress()
{
  if [ "$1" = "" ];
  then
    return 1
  fi

  PROGRESS_NUM=`mount | grep "$1" | grep -v "grep" | grep "(ro," | wc -l`
  if [ $PROGRESS_NUM -eq 1 ];
  then
    return 0
  else
    return 1
  fi
}

while [ 1 ] ; do
 CheckProgress "mmcblk0p1"
 Check_RET=$?
 if [ $Check_RET -eq 0 ]; then
   echo "[lyp] sdcard is ro,will remount sdcard !"
   `mount -o remount,rw /mnt/mmcblk0/`
 fi

 sleep 1
done
