On 17.02.2023 18:16, Brian Reichert wrote:
This isn't specific to OpenSUSE, so I'm open to being told to look elsewhere.
Well, wicked is most certainly specific to openSUSE.
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.
Even if it is possible with wicked, there is no documentation and wicked is deprecated and not even installed in current Tumbleweed. At which point you may look at NetworkManager and dispatcher script.
Any pointers? Or suggestions to other forums where this question is more appropriate?