Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
81c8a5d1
Commit
81c8a5d1
authored
Dec 16, 2013
by
Leigh B Stoller
Browse files
Watch for > 64 char hostname, and set to shortened name.
parent
f6c62f3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
clientside/tmcc/freebsd/sethostname.in
View file @
81c8a5d1
...
...
@@ -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
;
}
...
...
clientside/tmcc/linux/sethostname.dhclient.in
View file @
81c8a5d1
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-20
05
University of Utah and the Flux Group.
# Copyright (c) 2000-20
13
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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment