From 108fa417f5bff49cacac30c53505d3dc99810674 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 10 Dec 2014 13:33:32 -0800 Subject: [PATCH] build - add installworld-force target and better checks * Add better checks to installworld. Print an error and exit if the base system is too old, directing users to run installworld-force. * Add installworld-force. This automates installing the world on a base system which is too old and thus has chicken-and-egg problems with binaries and libraries. This install target will install to a temporary directory, compile up a static cpdup, and then use it to just blast copy /bin, /sbin, /lib, /libexec, /usr/bin, /usr/sbin, /usr/lib, and /usr/libexec. It will then execute a normal make installworld and make upgrade. --- Makefile | 3 ++- Makefile.inc1 | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 47e311db68..0d6b9c09a6 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ # realquickworld - Skip above steps, plus depend # crossworld - Just do the bootstrap, build, and cross-build steps # installworld - Install everything built by "buildworld". +# installworld-force - Install everything built by "buildworld", special case for old systems # world - buildworld + installworld. # buildkernel - Rebuild the kernel and the kernel-modules from scratch # using build/bootstrap/cross tools from the last @@ -81,7 +82,7 @@ TGTS= all all-man buildkernel quickkernel nativekernel \ buildworld crossworld quickworld realquickworld checkdpadd clean \ cleandepend cleandir depend everything \ hierarchy install installcheck installkernel \ - reinstallkernel installmost installworld libraries lint maninstall \ + reinstallkernel installmost installworld installworld-force libraries lint maninstall \ manlint mk most obj objlink regress rerelease tags \ rescue backupworld restoreworld restoreworld-auto \ backup-clean backup-auto-clean \ diff --git a/Makefile.inc1 b/Makefile.inc1 index 3eba414ca5..976a5ada07 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -467,8 +467,11 @@ installcheck: @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) +.if !defined(OVERRIDE_CHECKS) .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/" @case `uname -r` in 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) echo "You must upgrade your kernel to at least 1.5.4 and reboot before you can safely installworld, due to libc/system call ABI changes" ; /usr/bin/false ; esac + @case `uname -r` in 1.*|2.*|3.0*|3.1*|3.2*|3.3*|3.4*|3.5*|3.6*) echo "Base is too old for a normal installworld, you need to use installworld-force" ; /usr/bin/false ; esac +.endif .endif # @@ -493,6 +496,34 @@ installworld: installcheck @echo "full reboot, consider updating the rescue image with" @echo "'make rescue'. Do not do it until rebooting." +installworld-force: + @echo "Doing a forced installworld. This will install to a temporary directory," + @echo "then copy the main binaries and libraries with a static cpdup to ${DESTDIR}/" + @echo "and finally willl issue a normal installworld. Starting in 5 seconds.". + @echo "^C to abort." + sleep 1 + rm -rf /usr/obj/temp > /dev/null 2>& 1 || chflags -R noschg /usr/obj/temp + rm -rf /usr/obj/temp + mkdir -p /usr/obj/temp/cpdup/bin + (cd ${.CURDIR}/bin/cpdup; make clean; make obj; make clean; make CFLAGS=-static all install DESTDIR=/usr/obj/temp/cpdup NOMAN=TRUE) + @echo "XXXXXXXXX Installing to temporary XXXXXXXXX" + @sleep 1 + (cd ${.CURDIR}; ${MAKE} installworld DESTDIR=/usr/obj/temp > /dev/null 2>&1) + @echo "XXXXXXXXX Blasting binaries and libraries XXXXXXXXX" + @sleep 1 + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/bin /bin + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/sbin /sbin + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/lib /lib + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/bin /usr/bin + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/sbin /usr/sbin + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/lib /usr/lib + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/libexec /libexec + /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/libexec /usr/libexec + @echo "XXXXXXXXX Doing final installworld XXXXXXXX" + sleep 5 + (cd ${.CURDIR}; ${MAKE} installworld OVERRIDE_CHECKS=TRUE) + (cd ${.CURDIR}; ${MAKE} upgrade OVERRIDE_CHECKS=TRUE) + # Create a rescue image. We no longer do this automatically for several # reasons, primarily that users have had serious issue with mismatched 'vn' # vs the kldload image that can crash the system. But also, the rescue image -- 2.41.0