############################################################################
#
# Copyright (c) 2012 - dsixda (dislam@rocketmail.com)
#
# Android Kitchen is 100% free.  This script file is intended for personal
# and/or educational use only.  It may not be duplicated for monetary
# benefit or any other purpose without the permission of the developer.
#
############################################################################

#
# This script has one optional parameter:
#
# $1 = ignore_msg
#


base_dir=`pwd`
cd WORKING_*

if [ ! -e META-INF/com/google/android/update-script ]
then
  echo "Warning: No update-script found"
  cd ..
  exit 0
fi

cd META-INF/com/google/android

if [ "`grep package_extract_file update-script`" != "" ] || \
    [ "`grep TMP: update-script`" != "" ] || \
    [ "`grep \"format yaffs2\" update-script`" != "" ] || \
    [ "`grep \"format ext\" update-script`" != "" ]
then

  if [ "$1" == "" ]
  then
    echo
    echo "NOTE: update-script must be converted to an updater-script before" 
    echo "      flashing."
  fi

  cd $base_dir
  exit 1

else

  cd $base_dir
  device_name=`scripts/get_device_name`
  scripts/check_galaxies
  galaxy=$?

  if [ -e tools/edify_defs/$device_name ] || [ "$galaxy" == "1" ] 
  then

    if [ "$1" == "" ]
    then
      echo
      echo "NOTE: This device ($device_name) requires an updater-script"
    fi

    exit 1
  fi

  exit 0
fi

