#!/bin/sh # # This script places the new systems hostname into a couple of files within # the new image. # # Steve # -- # $Id: 50-setup-hostname,v 1.6 2006-02-20 00:45:16 steve Exp $ prefix=$1 echo ${hostname} > ${prefix}/etc/hostname echo ${hostname} > ${prefix}/etc/mailname # # Fixup the /etc/hosts file upon the new image for # machines with static IPs # if [[ -z "${dhcp}" ]]; then # Non-IPv6 stuff. grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts # New entry. echo "${ip} ${hostname}" >> ${prefix}/etc/hosts echo " " >> ${prefix}/etc/hosts # IPv6 stuff. grep '\(::\|IPv6\)' /etc/hosts >> ${prefix}/etc/hosts fi # # Allow the host system to know the IP address of our new guest. # if [[ -z "${dhcp}" ]]; then echo "${ip} ${hostname}" >> /etc/hosts fi