Scripting bsdinstall
Gleb Popov
arrowd at freebsd.org
Wed Dec 25 09:32:21 UTC 2019
On Sun, Dec 22, 2019 at 9:47 PM Gleb Popov <arrowd at freebsd.org> wrote:
>
>
> 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?
>
I had to do all these "bsdinstall" invocations in the preamble because I
wanted to set up partitions in my way. It turned out that the value of
PARTITIONS variable is directly passed to "bsdinstall scriptedpart", so my
installerscript got reduced to
DISTRIBUTIONS="base.txz kernel.txz lib32.txz"
PARTITIONS="ada0 gpt { 512K freebsd-boot , 2G freebsd-ufs / , 4G
freebsd-swap , 8G freebsd-ufs /var , 4G freebsd-ufs /tmp , auto freebsd-ufs
/usr }"
#!/bin/sh
sysrc ifconfig_DEFAULT=DHCP
It now works, and even the second part gets properly executed.
However, no boot loader gets installed. Skimming through "bsdinstall
bootconfig" source reveals that it only supports installing boot files for
UEFI loader. What should I do in case of BIOS?
More information about the freebsd-hackers
mailing list