#!/bin/sh
# Sets the host name from the first line of /etc/hostname that is not a comment.
[ -r /etc/hostname ] || exit 0
h=
while read -r line; do
	case $line in '' | \#*) continue ;; esac
	h=$line
	break
done </etc/hostname
[ -n "$h" ] || exit 0
[ "$(hostname)" = "$h" ] && exit 0
hostname "$h"
