core: Fix startup script distributed detection

$NODENAME was not defined on a place where it should be. This fixes a
bug where zotonic refused to start when there was any other Erlang
process running with the '-name- parameter.
(cherry picked from commit 522175ad07cf5ffcea8d30b41d368fa9c9568331)