Scripting bsdinstall

Matthew Seaman matthew at FreeBSD.org
Sun Dec 15 12:51:43 UTC 2019


On 15/12/2019 09:52, Gleb Popov wrote:
> - How do I setup networking on target machine? Examples propose running
> sysrc ifconfig_em0=DHCP, but how do I know interface name?

For interfaces, you can just say:

  sysrc ifconfig_DEFAULT=DHCP

and it will match any interface name that doesn't have a more specific
ifconfig setting (so, not lo0).  Only works for IPv4 as far as I can
tell -- saying 'ifconfig_DEFAULT_ipv6="inet6 accept_rtadv"' doesn't have
the desired effect of enabling SLAAC everywhere.

> - Same question goes for target drive. In most cases it is ada0, but how do
> I dynamically find it out?

This one is trickier.  You can't feasibly write a generic zero-knowledge
install script: there are too many variables to deal with.  Basically
you're going to have to assume some knowledge about what disks are
present in your systems and how they are connected.

If you know you're always going to be attaching your drives to an
on-board SAS controller, then /dev/ada0 is the right choice.

If you need to handle systems with larger numbers of drives which may be
hanging off various different flavours of host bus adaptor or RAID
controller and you need to create (for example) some complicated ZPOOL
of multiple vdevs with hot spares and separate intent log or cache
devices; well, perhaps in that case aim for a basic single-disk install
(perhaps on a temporary device like a USB stick), get the minimal system
up and then script building your more complex storage solutions from
within that self-hosted and running system where you have the full power
of the shell and all the normal management tools available to you.

	Cheers,

	Matthew

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20191215/338af4d5/attachment.sig>


More information about the freebsd-hackers mailing list