Convert to a POSIX compatible bash script.

Note that I tried to run it as /bin/sh from the agent worker and that caused
all kind of problems related to module setup not loaded, etc.
I'm sure that could all be worked around, but I dont see why we should.