#!/bin/bash

############################################################################
#
# Copyright (c) 2014 - A.S._id
#
############################################################################
MENU=tools/scripts/menu_config_n_clean
DIR_A=tools/android_img_repack_tools
DIR_B=tools/mkbootimg_tools
DIR_C=tools/sdat2img
DIR_D=tools/img2sdat
DIR_E=tools/dtc
DIR_F=tools/dtbtool

CONF_CHOICE() {
        if [ `uname | grep Linux` ]
	    then
	        tools/scripts/com_configure
		elif [ `uname | grep CYGWIN` ]
		then
	        tools/scripts/com_configure_cygwin
		fi
}
  echo -en "\E[32;1m"
  echo -e "============================================================"
  echo -e " Configure tools menu"
  echo -e "============================================================"
  echo -e 
  echo -e "  1 - Build android_img_repack_tools"
  echo -e "  2 - Remove android_img_repack_tools binaries"
  echo -e "  3 - Remove android_img_repack_tools sources"
  echo -e "  4 - Unmount img & remove tmp folders"
  echo -e "  5 - Remove project"
  echo -e "  6 - RETURN MAIN MENU"

  tput sgr0
  echo -e -n "\033[1m Enter option: \033[0m"
  read opt
  case $opt in

      1) clear; CONF_CHOICE; clear; $MENU;;
      2) clear; cd $DIR_A; make clean; cd ../..; echo "Finished"; echo "Press Enter to continue"; read enterKey; clear; $MENU;;
      3) clear; rm -rfv $DIR_A $DIR_B $DIR_C $DIR_D $DIR_E $DIR_F; echo "Finished"; echo "Press Enter to continue"; read enterKey; clear; $MENU;;
      4) clear; tools/scripts/com_unmount; clear; $MENU;;
      5) clear; tools/scripts/com_remove_project; clear; $MENU;;
      6) clear; ./main_menu;;

  esac

