Skip to content

Commit

Permalink
Write to /proc/sys/kernel/hostname if the hostname command is not ava…
Browse files Browse the repository at this point in the history
…ilable
  • Loading branch information
mlschroe committed May 6, 2020
1 parent b253d65 commit 1cf6450
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build-vm
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,11 @@ vm_setup_network() {
fi
fi
if test -n "$VM_HOSTNAME" ; then
hostname "$VM_HOSTNAME"
if test -e /bin/hostname -o -e /usr/bin/hostname -o -e /sbin/hostname -o -e /usr/sbin/hostname ; then
hostname "$VM_HOSTNAME"
elif test -e /proc/sys/kernel/hostname ; then
echo "$VM_HOSTNAME" > /proc/sys/kernel/hostname
fi
fi
if test -n "$VM_TELNET"; then
echo WARNING: telnet option used, setting up telnet server ${VM_TELNET_DEVICE}
Expand Down

0 comments on commit 1cf6450

Please sign in to comment.