Re: Dynamic hostname in rc.conf (for bhyve VMs)

From: John Kennedy <warlock_at_phouka.net>
Date: Sat, 17 Sep 2022 19:22:20 UTC
On Sat, Sep 10, 2022 at 10:52:01AM +0200, Guido Falsi wrote:
> Since rc.conf is just a shell script I'd like to be able to set hostname 
> dynamically.

  AFAIK, not a shell-script (although variables are set in that syntax).

  I wasn't trying to do exactly what you are, but one thing I did was set the
MAC address as one of the bhyve options:

	...
	-s 5,virtio-net,tap2,mac=00:01:02:03:04:05
	...

  (Changed the MAC address in the example, but pick a safe one for your setup)

  Should be able to provide your own rc.d configuration file that does
something like do a switch on MAC and call the hostname script directly.