I see the problem:
cur_hostname="$(hostname)" if [ -z "${cur_name}" ] || [ "${cur_hostname}" = "(none)" ] || [ "${cur_hostname}" = "localhost" ]; then errormsg "Hostname not set correctly; aborting." fi
You're setting up a variable "cur_hostname" but then checking whether "cur_name" is empty instead of cur_hostname. Of course it's empty, it wasn't set!