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
This commit is contained in:
Jessica Clarke 2023-07-27 05:10:49 +01:00
parent d81da4c983
commit 246364454f

View File

@ -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