diff options
author | emaste <emaste@FreeBSD.org> | 2017-07-16 19:20:15 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2017-07-16 19:20:15 +0000 |
commit | 80becec91b3e1256e7d3425cfe6b09e2f4b08305 (patch) | |
tree | 06d087adae1ead230c989f65258d8f64b8a07e08 /Makefile.inc1 | |
parent | 091cf7ec482d2b8f1b4e2838916b8d356909e70f (diff) | |
download | FreeBSD-src-80becec91b3e1256e7d3425cfe6b09e2f4b08305.zip FreeBSD-src-80becec91b3e1256e7d3425cfe6b09e2f4b08305.tar.gz |
MFC r319219: add a sanity check before installworld on the running system
FreeBSD does not guarantee kernel forward compatibility (that is,
running a newer userland on an older kernel). The documented upgrade
procedure specifies that installkernel should be performed, followed by
a reboot and then installworld. As a sanity check when installing onto
the running system (DESTDIR is / or unset), attempt to run "sh echo OK"
using rescue from the objdir. If rescue fails (e.g., because the system
has not been rebooted and the "old" kernel lacks a system call required
by the to-be-installed world), abort the installation.
This was added to avoid ino64 foot-shooting in HEAD, but is generally
useful for any upgrade case adding new syscalls.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'Makefile.inc1')
-rw-r--r-- | Makefile.inc1 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index b777ced..cb53fc3 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -915,6 +915,22 @@ __installcheck_UGID: .PHONY fi .endfor .endif +# +# If installing over the running system (DESTDIR is / or unset) and the install +# includes rescue, try running rescue from the objdir as a sanity check. If +# rescue is not functional (e.g., because it depends on a system call not +# supported by the currently running kernel), abort the installation. +# +.if !make(distributeworld) && ${MK_RESCUE} != "no" && \ + (empty(DESTDIR) || ${DESTDIR} == "/") && empty(BYPASS_INSTALLCHECK_SH) +_installcheck_world: __installcheck_sh_check +__installcheck_sh_check: .PHONY + @if [ "`${OBJTREE}${.CURDIR}/rescue/rescue/rescue sh -c 'echo OK'`" != \ + OK ]; then \ + echo "rescue/sh check failed, installation aborted" >&2; \ + false; \ + fi +.endif # # Required install tools to be saved in a scratch dir for safety. |