freebsd-dev/usr.sbin/bsdinstall
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
..
distextract Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
distfetch Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
partedit Fix scripted installs on EFI systems after default mounting of the ESP. 2021-03-23 09:29:54 -04:00
scripts Fix scripted installs on EFI systems after default mounting of the ESP. 2021-03-23 09:29:54 -04:00
bsdinstall bsdinstall: Use TMPDIR if set 2020-01-15 00:45:05 +00:00
bsdinstall.8 Bump documentation date after recent updates to bsdinstall.8. 2021-03-22 19:41:49 -04:00
Makefile Merge from head 2015-10-01 09:36:43 +00:00
Makefile.depend META_MODE: Remove DEP_MACHINE from Makefile.depend files. 2015-09-25 19:44:01 +00:00
Makefile.inc