From 246364454fc13e80e33142764e276b395f308712 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Thu, 27 Jul 2023 05:10:49 +0100 Subject: [PATCH] etcupdate: Use new buildetc and installetc targets when available These new targets avoid the need to invoke internal build system targets or set internal variables when building, and also have the added benefit of working with BUILD_WITH_STRICT_TMPPATH. Old source trees lacking such targets will not work with BUILD_WITH_STRICT_TMPPATH; they could be made to work by copying the steps, but it's not worth doing so, as they never have worked in the past. The primary goal of this is to support changing the default of BUILD_WITH_STRICT_TMPPATH to enabled. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D41206 --- usr.sbin/etcupdate/etcupdate.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh index ae75a6e36f03..4735fa6c75eb 100755 --- a/usr.sbin/etcupdate/etcupdate.sh +++ b/usr.sbin/etcupdate/etcupdate.sh @@ -219,11 +219,19 @@ build_tree() cd $SRCDIR || exit 1; if ! [ -n "$nobuild" ]; then export MAKEOBJDIRPREFIX=$destdir/usr/obj; - $make _obj SUBDIR_OVERRIDE=etc || exit 1 - $make everything SUBDIR_OVERRIDE=etc || exit 1 + if [ -n "$($make -V.ALLTARGETS:Mbuildetc)" ]; then + $make buildetc || exit 1 + else + $make _obj SUBDIR_OVERRIDE=etc || exit 1 + $make everything SUBDIR_OVERRIDE=etc || exit 1 + fi + fi + if [ -n "$($make -V.ALLTARGETS:Minstalletc)" ]; then + $make DESTDIR=$destdir installetc || exit 1 + else + $make DESTDIR=$destdir distrib-dirs || exit 1 + $make DESTDIR=$destdir distribution || exit 1 fi - $make DESTDIR=$destdir distrib-dirs || exit 1 - $make DESTDIR=$destdir distribution || exit 1 ) || return 1 fi chflags -R noschg $1 || return 1