Skip to content

Commit 33c8d8d

Browse files
committed
Change how hostnames work:
- only use shortform for /etc/nodename (no domain appended) - only add hostname to the 127.0.0.1 entry in /etc/inet/hosts - do not add any entries to /etc/inet/hosts for public/private IPs
1 parent a5a1365 commit 33c8d8d

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

zoneinit/includes/02-config.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ else
6363
fi
6464
6565
: ${ZONENAME:=$(zonename)}
66-
: ${HOSTNAME:=${ZONENAME}.local}
67-
: ${DOMAINNAME:=${HOSTNAME##*.}}
66+
: ${HOSTNAME:=${ZONENAME}}
67+
: ${DOMAINNAME:=local}
6868
6969
[ ${RAM_IN_BYTES} ] || RAM_IN_BYTES=$( kstat -p -c zone_memory_cap -s physcap | awk '{print $2}' )
7070
[ ${RAM_IN_BYTES} -gt 0 2>/dev/null ] || RAM_IN_BYTES=134217728

zoneinit/includes/12-network.sh

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
log "setting hostname, IPs and resolvers"
22

3-
echo "${HOSTNAME}.${DOMAINNAME}" > /etc/nodename
4-
/bin/hostname ${HOSTNAME}.${DOMAINNAME}
3+
echo "${HOSTNAME}" > /etc/nodename
4+
/bin/hostname ${HOSTNAME}
55

66
(
7-
echo "domain ${DOMAINNAME}"
8-
/bin/sed -E -e '/nameserver|domain/d' /etc/resolv.conf 2>/dev/null
7+
/bin/sed '/nameserver/d' /etc/resolv.conf 2>/dev/null
98
for HOST in ${RESOLVERS[@]}; do
109
echo "nameserver ${HOST}"
1110
done
1211
) > /etc/resolv.conf.tmp
1312
mv /etc/resolv.conf{.tmp,}
1413

15-
for IP in ${PUBLIC_IPS[@]}; do
16-
echo "${IP}"$'\t'"${HOSTNAME}" >> /etc/inet/hosts
17-
done
18-
for IP in ${PRIVATE_IPS[@]}; do
19-
echo "${IP}"$'\t'"${ZONENAME}"$'\t'"loghost" >> /etc/inet/hosts
20-
done
14+
sed '/^127\.0\.0\.1/s/$/ '${HOSTNAME}'/' /etc/inet/hosts > /etc/inet/hosts.tmp
15+
mv /etc/inet/hosts{.tmp,}
2116

2217
log "checking if we can reach the Internets"
2318

0 commit comments

Comments
 (0)