Commit 81c8a5d1 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Watch for > 64 char hostname, and set to shortened name.

parent f6c62f3f
......@@ -112,9 +112,20 @@ if (! $nickname) {
}
$nickname = lc($nickname);
print STDERR "Resetting hostname to ${nickname}${domain} ... ";
#
# Watch for setting to something > 64 chars; breaks almost everywhere.
# Use just the nickname, which will still resolve properly cause of the
# search clause in /etc/resolv.conf. It *CANNOT* be just the vname, since
# that would conflict with experimental interface names in /etc/hosts.
#
my $newhostname = "${nickname}${domain}";
if (!$USEPNAME && length($newhostname) > 64) {
$newhostname = $nickname;
}
print STDERR "Resetting hostname to $newhostname ... ";
if (system("hostname", "${nickname}${domain}")) {
if (system("hostname", $newhostname)) {
print STDERR "*** FAILED!\n";
exit 1;
}
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -97,11 +97,19 @@ else {
}
#
# Set hostname. This output is redirected to log file by caller.
# Watch for setting to something > 64 chars; breaks almost everywhere.
# Use just the nickname, which will still resolve properly cause of the
# search clause in /etc/resolv.conf. It *CANNOT* be just the vname, since
# that would conflict with experimental interface names in /etc/hosts.
#
print STDERR "Resetting hostname to ${nickname}${domain} ... ";
my $newhostname = "${nickname}${domain}";
if (!$USEPNAME && length($newhostname) > 64) {
$newhostname = $nickname;
}
print STDERR "Resetting hostname to $newhostname ... ";
system("/bin/hostname ${nickname}${domain}");
system("/bin/hostname $newhostname");
if ($?) {
print STDERR "*** FAILED!\n";
exit 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment