opnsense-src/usr.sbin/bsdinstall/scripts
Nathan Whitehorn c2f16c595e Fix scripted installs on EFI systems after default mounting of the ESP.
Because the ESP mount point (/boot/efi) is in mtree, tar will attempt to
extract a directory at that point post-mount when the system is installed.
Normally, this is fine, since tar can happily set whatever properties it
wants. For FAT32 file systems, however, like the ESP, tar will attempt to
set mtime on the root directory, which FAT does not support, and tar will
interpret this as a fatal error, breaking the install (see
https://github.com/libarchive/libarchive/issues/1516). This issue would
also break scripted installs on bare-metal POWER8, POWER9, and PS3
systems, as well as some ARM systems.

This patch solves the problem in two ways:
- If stdout is a TTY, use the distextract stage instead of tar, as in
  interactive installs. distextract solves this problem internally and
  provides a nicer UI to boot, but requires a TTY.
- If stdout is not a TTY, use tar but, as a stopgap for 13.0, exclude
  boot/efi from tarball extraction and then add it by hand. This is a
  hack, and better solutions (as in the libarchive ticket above) will
  obsolete it, but it solves the most common case, leaving only
  unattended TTY-less installs on a few tier-2 platforms broken.

In addition, fix a bug with fstab generation uncovered once the tar issue
is fixed that umount(8) can depend on the ordering of lines in fstab in a
way that mount(8) does not. The partition editor now writes out fstab in
mount order, making sure umount (run at the end of scripted, but not
interactive, installs) succeeds.

PR:		254395
Reviewed by:	gjb, imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29380
2021-03-23 09:29:54 -04:00
..
adduser
auto bsdinstall: riscv-specific tweaks 2021-01-27 19:29:42 -04:00
bootconfig Restore /boot/efi to mtree. 2021-03-05 21:01:11 -05:00
checksum bsdinstall: improve checksum mismatch error for snapshots 2017-07-19 18:25:52 +00:00
config Revert r361257: bsdinstall: do a certctl rehash upon installation [...] 2020-09-17 20:35:45 +00:00
docsinstall Add missing Korean doc package entry, remove non-existent Serbian doc 2020-08-24 14:00:12 +00:00
entropy Explicitly set permissions on entropy files 2015-12-28 17:27:20 +00:00
hardening bsdinstall: add knob to set ASLR sysctls 2021-02-20 11:55:00 -05:00
hostname Whitespace alignment in bsdinstall hostname 2018-10-26 01:57:32 +00:00
jail
keymap Remove unused MAPDESCFILE. 2018-08-11 14:45:33 +00:00
Makefile Add installer support for PS3 and PowerNV systems, also laying the 2018-01-02 05:27:24 +00:00
Makefile.depend
mirrorselect bsdconfig, bsdinstall: Prune dead mirrors 2020-09-26 16:27:09 +00:00
mount bsdinstall: Use TMPDIR if set 2020-01-15 00:45:05 +00:00
netconfig Adapt to new wireless scheme where base wlan interfaces do not show up in 2015-12-06 00:20:45 +00:00
netconfig_ipv4 bsdinstall: only kill the dhclient for the interface we are restarting 2020-07-11 17:20:17 +00:00
netconfig_ipv6 bsdinstall: remove EOL whitespace 2017-07-18 23:35:19 +00:00
rootpass bsdinstall: inform users that typing will not be visible 2018-01-01 22:10:21 +00:00
script Fix scripted installs on EFI systems after default mounting of the ESP. 2021-03-23 09:29:54 -04:00
services bsdinstall: Add ntpdate option 2017-11-22 15:27:47 +00:00
time Make the new 'set date and time' dialog default to skip 2016-07-14 00:41:19 +00:00
umount bsdinstall: don't fail if fstab is empty 2020-07-11 17:06:48 +00:00
wlanconfig Fix indentation in bsdinstall-created wpa_supplicant.conf 2020-05-20 21:39:19 +00:00
zfsboot Mount the EFI system partition (ESP) on newly-installed systems. 2021-02-23 16:24:21 -05:00