#!/bin/bash

# Intended to run on a Mac and download the current version of the
# install.sh script and then source it, to avoid having to do that from
# the browser and dealing with cache issues and such.

top='/Volumes/TEMPORARY SAVE FOLDER/'
if [ -e "$top" ]; then
    echo "exists: $top"
    cd "$top"
    if [ -d "Users" ]; then
        echo "Users subdir exists"
        cd Users
        top=`pwd`
        if [ -d "$USER" ]; then
            echo "My $USER subdir exists"
            cd "$USER"
            top=`pwd`
        fi
    fi
else
    echo "missing: $top"
    top=$HOME/test1
    mkdir "$top"
    echo "using $top"
fi

cd "$top"
pwd
if [ ! -d 307 ]; then 
    mkdir 307
fi
cd 307
pwd

# Finally, install all my stuff.  We'll keep this simple, with just a curl
# download of a big tarfile.  Maybe later, we'll allow updates using
# rsync.

echo "install pytw stuff"
curl -O http://cs.wellesley.edu/~cs307/pytw.tgz

# if we don't remove the old stuff, old files stay around.
rm -rf pytw
tar xzf pytw.tgz

