diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-06-22 18:59:18 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-06-22 18:59:41 +0000 |
| commit | 53a3d4760eb90c89bf04636c957511882d7f347d (patch) | |
| tree | 9063454dae948daaeaa5be1a7678a36e47f41677 | |
| parent | e4c4c6eeb2a29f7549d28e6ce51fc36125c08e68 (diff) | |
etcupdate: Warn if the tree hasn't been built
Warn the user before trying `make installetc` if etcupdate was invoked
without -b (or with -B) and it appears that `make buildetc` hasn't
already been run (which usually happens as part of `make buildworld`).
MFC after: 1 week
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D57504
| -rwxr-xr-x | usr.sbin/etcupdate/etcupdate.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh index 404ad434da00..4743e81a1562 100755 --- a/usr.sbin/etcupdate/etcupdate.sh +++ b/usr.sbin/etcupdate/etcupdate.sh @@ -200,6 +200,7 @@ build_tree() log "Building tree at $1 with $make" + exec 4>&2 exec >&3 2>&1 mkdir -p $1/usr/obj @@ -216,7 +217,16 @@ build_tree() else ( cd $SRCDIR || exit 1 - if ! [ -n "$nobuild" ]; then + if [ -n "$nobuild" ]; then + # Check for prior build + objdir=$($make -V .OBJDIR) + if ! [ -f "${objdir}/${BUILD_SENTINEL}" ]; then + cat <<EOF >&4 +Build sentinel not found in object directory, did you forget to make +buildworld or pass -b to etcupdate? +EOF + fi + else export MAKEOBJDIRPREFIX=$destdir/usr/obj if [ -n "$($make -V.ALLTARGETS:Mbuildetc)" ]; then $make buildetc || exit 1 @@ -1900,6 +1910,9 @@ EDITOR=${EDITOR:-/usr/bin/vi} # Files that need to be updated before installworld. PREWORLD_FILES="etc/master.passwd etc/group" +# A file we know the build produces in the object directory. +BUILD_SENTINEL=etc/termcap/termcap.small + # Handle command-specific argument processing such as complaining # about unsupported options. Since the configuration file is always # included, do not complain about extra command line arguments that |
