Move osrelease check

This keeps it from being executed if the OS is not one of the supported
ones. It also wraps the function in a try/except to account for possible
non-float strings.