DEV_BASEDIR=~/development

BINOC_BASENAME=binoc-central
MC_BASENAME=moonchild-central
PM_BASENAME=palemoon
BK_BASENAME=basilisk
OBJ_BASENAME=.obj

PM_RELDIR=$MC_BASENAME/$PM_BASENAME-repo
BK_RELDIR=$MC_BASENAME/$BK_BASENAME-repo


if [ "$1" == "supersetup" ]; then
  mkdir -p $DEV_BASEDIR/$OBJ_BASENAME $DEV_BASEDIR/$MC_BASENAME
  cd $DEV_BASEDIR

  git clone https://github.com/binaryoutcast/binoc-central $BINOC_BASENAME
  git clone https://github.com/MoonchildProductions/Pale-Moon $DEV_BASEDIR/$PM_RELDIR
  git clone https://github.com/MoonchildProductions/Basilisk $DEV_BASEDIR/$BK_RELDIR

  cd $DEV_BASEDIR/$BINOC_BASENAME
  git submodule init && git submodule update
  curl http://repository.binaryoutcast.com/.resources/infra/mozconfig.txt >.mozconfig
  mkdir -p $PM_BASENAME $BK_BASENAME
elif [ "$1" == "mount-mcp" ]; then
  sudo mount --verbose --bind $DEV_BASEDIR/$PM_RELDIR/$PM_BASENAME $DEV_BASEDIR/$BINOC_BASENAME/$PM_BASENAME
  sudo mount --verbose --bind $DEV_BASEDIR/$BK_RELDIR/$BK_BASENAME $DEV_BASEDIR/$BINOC_BASENAME/$BK_BASENAME
elif [ "$1" == "unmount-mcp" ]; then
  sudo umount --verbose $DEV_BASEDIR/$BINOC_BASENAME/$PM_BASENAME
  sudo umount --verbose $DEV_BASEDIR/$BINOC_BASENAME/$BK_BASENAME
elif [ "$1" == "junction-mcp" ]; then
  echo "Not yet implemented."
elif [ "$1" == "update-mcp" ]; then
  echo "$PM_BASENAME-repo:"
  cd $DEV_BASEDIR/$PM_RELDIR
  git pull
  echo "$BK_BASENAME-repo:"
  cd $DEV_BASEDIR/$BK_RELDIR
  git pull
else
  echo "Possible choices are supersetup, mount-mcp, and unmount-mcp"
fi
