Scripting bsdinstall

Gleb Popov arrowd at freebsd.org
Sun Dec 22 17:47:57 UTC 2019


On Sun, Dec 15, 2019 at 4:51 PM Matthew Seaman <matthew at freebsd.org> wrote:

> 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.
>

Great, exactly what I needed, thanks.

I ended up with following script:


DISTRIBUTIONS="base.txz kernel.txz lib32.txz"
export DISTRIBUTIONS

bsdinstall checksum
bsdinstall hostname
bsdinstall scriptedpart ada0 gpt { 512K freebsd-boot , 2G freebsd-ufs / ,
4G freebsd-swap , 8G freebsd-ufs /var , 4G freebsd-ufs /tmp , auto
freebsd-ufs /usr }
bsdinstall mount
bsdinstall distextract
bsdinstall config
bsdinstall entropy

#!/bin/sh

sysrc ifconfig_DEFAULT=DHCP


While I feel a bit wrong using `bsdinstall` command in the preamble part,
but it works pretty nice. However, the script part doesn't seem work. The
last window I see in the installer is "No root partition is found. The root
partition must have a mountpoint of /". After I hit OK, the script ends and
no "sysrc" command is run.

What am I doing wrong now?


More information about the freebsd-hackers mailing list