Updates to the upgrade scripts

These are actually updates I made late last year, but the diffs show that changed sections haven't changed significantly enough to break anything.

The big fix here is that it doesn't make assumptions about absolute location of source trees, and instead respects the paths passed via command line arguments.