#!/bin/bash

echo "-- $0 --"

. /etc/profile

if [ "${SYSTEMD}" = "0" ] ; then
  # hostname update
  echo "127.0.0.1 ${HOSTNAME}.${DOMAIN} ${HOSTNAME} localhost" > /etc/hosts
  sed -i -e "s/hostname.*/hostname=\"${HOSTNAME}\"/" /etc/conf.d/hostname
  hostname ${HOSTNAME}
  hostname -f
else
  echo "127.0.0.1 ${HOSTNAME}.${DOMAIN} ${HOSTNAME} localhost" > /etc/hosts
  echo "${HOSTNAME}" >/etc/hostname 
  # LiveCD doesn't have systemd running
  hostname ${HOSTNAME}
  hostname -f
fi
