From 04a5d4b56abc9b77fb9cfee774283880a3eeed12 Mon Sep 17 00:00:00 2001 From: Marcin Owsiany Date: Sun, 30 Nov 2008 14:57:32 +0000 Subject: [PATCH] Strip domain name when setting hostname. This lets one specify a FQDN in CT configuration, and have it properly written (as FQDN) to /etc/hosts, and (as the domainless part) to /etc/hostname. Without this change, either the system hostname was incorrect (containing the domain part), or the hostname was not properly fully qualified in /etc/hosts. It also corrects the minor mistake of using a hardcoded path within the function, and quotes the hostname being set. --- etc/dists/scripts/debian-set_hostname.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/dists/scripts/debian-set_hostname.sh b/etc/dists/scripts/debian-set_hostname.sh index 8120383..c399154 100755 --- a/etc/dists/scripts/debian-set_hostname.sh +++ b/etc/dists/scripts/debian-set_hostname.sh @@ -24,11 +24,11 @@ function set_hostname() local hostname=$2 [ -z "${hostname}" ] && return 0 - echo "${hostname}" > /etc/hostname - hostname ${hostname} + echo "${hostname}" > ${cfgfile} + hostname "${hostname}" } change_hostname /etc/hosts "${HOSTNM}" "${IP_ADDR}" -set_hostname /etc/hostname "${HOSTNM}" +set_hostname /etc/hostname "${HOSTNM%%.*}" exit 0 -- 1.5.6.3