############################################################################
#
# Copyright (c) 2011 - 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 argument
#
# $1 = "kernel_only" or "name_given"
#

date_str=`date '+%m%d%y_%H%M%S'`
working_dir=WORKING_$date_str

if [ "$1" != "kernel_only" ] && [ "$1" != "name_given" ]
then

  echo 1>&2
  echo "The new working folder will be named $working_dir" 1>&2
  echo -n "Change the name (y/n)? (default: n): " 1>&2

  read change_it
  echo 1>&2

  if [ "$change_it" == "y" ]
  then

    name_is_set=no

    while [ $name_is_set == no ]
    do
      echo -n "Enter a new name (using this prefix): WORKING_" 1>&2
      read newname 
   
      newname=`echo $newname | sed -e 's/ /_/g'`
      working_dir="WORKING_$newname"

      if [ -d original_update/$working_dir ]
      then
        echo "Error: Same name already exists under original_update folder" 1>&2
        echo 1>&2
      else
        name_is_set=yes
      fi

    done
  fi
fi

echo $working_dir

