This isn't specific to OpenSUSE, so I'm open to being told to look
elsewhere.
My goal: if the DHCP server does not provide a hostname, I want to
synthesize one from the IPv4 address I'm getting.
Using the classic ISC DHCP client (dhclient), this is easy; you
create an exit-hook script, and that script has access to all of
the details of the lease, so I can selectively override the processing
of the lease; e.g.:
case "$reason" in
BOUND|RENEW|REBIND|REBOOT)
if [ -z "$new_host_name" ]; then
new_host_name=${new_ip_address//./-}
hostnamectl set-hostname $new_host_name
fi
;;
esac
Easy-peasy. (Yes, an enter-hook might be a better place, but you
get the gist.)
However, OpenSUSE uses wicked to manage DHCP configuration. I know
it has a scripting mechanism, but I can't quickly find a way to
accomplish the above in wicked.
Any pointers? Or suggestions to other forums where this question
is more appropriate?
--
Brian Reichert