#!/sbin/sh
#
# setnames	This script sets the systems name.
#
# Version:	@(#) /sbin/init.d/setnames 1.50 1994-01-18
#
# Author:	Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

  # See how we were called.
  case "$1" in
    bcheckrc)
	# Set the hostname.
	if [ -f /etc/HOSTNAME ]
	then
		# Find out if there's a full hostname here.
		full=`cat /etc/HOSTNAME`
		if [ "${full#*.}" != "" ]
		then
			# Yes, set both host and domainname
			# from it (new style).
  			hostname ${full%%.*}
  			domainname ${full#*.}
		else
			# No, so stuff whole FQDN into
			# hostname (old style).
  			hostname -f "$full"
		fi
		else
		hostname linux
		domainname nodomain.org
	fi
	echo "Bcheckrc: The name of this system is `hostname`"
        ;;
    *)
        # Oops someone made a typo.
        echo "Usage: /sbin/init.d/setnames {bcheckrc}"
        exit 1
  esac

exit 0
