/etc/dhcp/dhclient-exit-hooks.d/hostname is in debian-edu-config 1.818+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/bin/sh
#
# Purpose: Used by dhclient-script to set the hostname of the system
# to match the DNS information for the host as provided by DHCP.
#
# This script is based on code found on the web:
# http://www.debian-administration.org/articles/447 and
# http://nxhelp.com/blog/2013/01/24/automatically-set-hostname-from-dhcp/
#
PATH=/sbin:$PATH
export PATH
# Should not update hostname on Main-Server, Roaming-Workstation and
# Standalone. Those get their fixed hostname set during installation
# (or manually after installation) and should not change dynamically
# if moved between networks.
if [ -r /etc/debian-edu/config ] ; then
. /etc/debian-edu/config
fi
if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone' ; then
exit 0
else
if echo "$PROFILE" | egrep -q 'Workstation|Thin-Client-Server|Minimal' ; then
:
fi
fi
log() {
logger -t dhclient-exit-hooks.d/hostname "$1"
}
sethostname() {
hostname="$1"
namesource="$2"
echo $hostname > /etc/hostname
hostname $hostname
log "changing hostname to $hostname based on $namesource"
}
case "$reason" in
BOUND|RENEW|REBIND|REBOOT)
namesource="DHCP IP address $new_ip_address"
/usr/sbin/update-hostname-from-ip -I $new_ip_address
;;
esac
|