#!/bin/sh

#
# --  agsatellite-config configures account information for Audiogalaxy
#     
set -e 

RCDIR=${HOME}/.agsatellite
ACCOUNT=account.txt
SHARE=shares.txt

if [ ! -d ${RCDIR} ]; then
  mkdir ${RCDIR}
	chmod 700 ${RCDIR}
else
  echo -n "agsatellite is already configured, continue? [y/N]"
	read ans
	case "$ans" in 
    [Nn]*) exit 0 ;;
	esac
fi

echo "Please create your account on http://www.audiogalaxy.com/ first."
echo -n "Which email address or account name do you used on signup? "
read ans
echo -n "Which password you used on signup for '${ans}'? "
read passans

echo $ans >${RCDIR}/${ACCOUNT}
echo $passans >> ${RCDIR}/${ACCOUNT}

echo "Please enter your upload and download directory."
echo -n "Enter full path to directory: "
read directory
echo $directory > ${RCDIR}/${SHARE}

chmod 700 ${RCDIR}/${ACCOUNT}
chmod 700 ${RCDIR}/${SHARE}
echo "Finished Audiogalaxy Satellite configuration"
exit 0

