Parted is all very well, but I found that needing to know the exact position of the partition was a bit of a pain.
Whilst scanning my feeds, I saw a reference to sfdisk (scriptable fdisk). As all I need to do is change the partition to vfat, then make a new filesystem, I might be able to do the following: