#!/bin/sh # This script can be installed in /etc/dhcp/dhclient.d/ to set the client's # hostname based either on the hostname that the DHCP server supplied or the # hostname in whatever ptr record exists for the assigned IP address. if [ -z "$new_host_name" -a -n "$new_ip_address" ]; then new_host_name="$(resolve -s "$new_ip_address" 2>/dev/null)" fi if [ -n "$new_host_name" ]; then hostname "$new_host_name" fi