Add FreeBSD compatibility

This fixes a couple of compilation errors that I have encountered on FreeBSD, minimizes a few Linux-esque dependencies, and generalizes some of the (Net)BSD handling so that the build works as a FreeBSD port.

* Change #!/bin/bash -> #!/bin/sh as none of the scripts seem to require bash-specific functionality.
* Similarly, gawk -> awk.
* Fix compile error in jobexecutor.c.
* The remainder of the changes are just compatibility changes for FreeBSD. (For the most part, FreeBSD can just use OSTYPE=netbsdelf, but not entirely.)