|
root / services / hammerhead / identity / start.sh
start.sh Bash 26 lines 841 B
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/zsh
# identity — configure hostname, domain, hostid
#
# Reads /etc/nodename, /etc/defaultdomain, /etc/hostid. All optional —
# missing files fall back to system default. Does NOT generate missing
# hostid — that's a separate first-boot setup concern out of scope here.

set -e
set -u

if [[ -r /etc/nodename ]]; then
    /bin/hostname "$(cat /etc/nodename)"
fi

# domainname is NIS-era and isn't shipped on Hammerhead by default.
# /etc/defaultdomain is read by getdomainname(3C) directly when needed,
# so just leave the file in place; nothing to invoke here.
if [[ -r /etc/defaultdomain ]]; then
    : # /etc/defaultdomain present; getdomainname(3C) reads it directly
fi

# hostid is already loaded by the kernel from /etc/hostid; nothing to do
# unless we later want to generate it on first boot. Flag for follow-up.

exit 0