1
0
mirror of synced 2026-05-01 06:08:37 +00:00
Files
xen-tools.xen-tools/etc/hook.d/50-setup-hostname
steve 5229238db6 2005-12-26 18:33:01 by steve
Setup an entry in /etc/hosts for the new image for non-dhcp hosts.
2005-12-26 18:33:01 +00:00

33 lines
667 B
Bash
Executable File

#!/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.4 2005-12-26 18:33:01 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