Convert bash scripts to rake

This is a step towards making it easier to compile on all platforms. There are a still few commands that need to be converted and I have yet to find a good solution for a few of them.