
echo
echo "Add bash /etc/profile to System"
echo "--------------------------------------"
echo
echo "This script will copy profile to /system/etc."
echo
echo "The addition of the bash shell to the system is prerequisit."
echo
echo "This /etc/profile will set up bash to use /sdcard/rmk as the HOME"
echo "directory and if it exists and $HOME/.bashrc exists it will be"
echo "sourced. The way to take advantage of this is to set the Terminal"
echo "Emulator app Command line to /system/bin/bash and to set the initial"
echo "command for the Terminal Emulater app to 'source /etc/proflie'."
echo

echo -n "Proceed (y/n)? (default: y): "
read proceed
echo

if [ "$proceed" == "n" ]
then
  exit 0
fi


if [ ! -d WORKING_* ]
then
  echo
  echo Working folder not found!
  exit 0
fi

orig_folder=`pwd`

profile=$orig_folder/scripts/plugins/profile

if [ ! -f $profile ]
then
  echo "$profile is missing!"
fi

echo
cd WORKING_*

for dir in system/etc
do
if [ ! -d $dir ]
then
  echo "$dir is missing!"
  cd ..
  exit 0
fi
done

cp -p  $profile system/etc

if [ "$?" == "0" ]
then
  echo
  echo "Finished"
fi

cd $orig_folder

