#!/bin/sh

name=$1
deploy=$2
addrend=$3
admin_username=$4
cd $HOME/web_scripts/$addrend

echo
echo You will be able to control your copy of $name by logging in to
echo $name using username \"$admin_username\".  This account will have a
echo password of your choice.  You should not use your Athena account password.

done="0"
while [ "$done" = "0" ]
do
  echo "Please decide upon an admin password, type it, and press [enter]."
  echo "This password may only contain a-z, A-Z, and 0-9."
  printf "As you type your password, the cursor will not move: "
  read admin_pass1
  echo
  echo
  echo "Now please type the same password again and press [enter]."
  printf "As you type your password, the cursor will not move: "
  read admin_pass2
  echo

  if [ "$admin_pass1" = "$admin_pass2" ]; then
    done="1"
  else
    echo
    echo == Sorry, those passwords do not match.  Please try again. ==
  fi
done

echo
echo OK.  Continuing with the install...
cat <<EOF > $HOME/web_scripts/$addrend/.admin
$admin_pass1
EOF
