aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/etcupdate
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@FreeBSD.org>2023-07-27 04:10:48 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2023-07-27 04:10:48 +0000
commit03e62670c33c5d68ea69c842c24fe86765e2639e (patch)
treeb1afcaeddbc015cdd93124c9dec8f3728fa648d9 /usr.sbin/etcupdate
parent8fc3059b00c570fc7475ce84e5f8f8e13195df44 (diff)
downloadsrc-03e62670c33c5d68ea69c842c24fe86765e2639e.tar.gz
src-03e62670c33c5d68ea69c842c24fe86765e2639e.zip
etcupdate: Consolidate nobuild cases and make more robust
The distrib-dirs and distribution steps are shared between the two, the only difference is whether MAKEOBJDIRPREFIX is in the environment for the latter. Having in the environment for the former is currently not needed but does no harm and will be needed in future, so we can just export it up-front in the subshell. When we do distrib-dirs relative to _obj and everything also doesn't matter, so move it next to distribution where it makes more sense. Finally, to avoid complicated && chains, use "|| exit 1" everywhere to make the subshell fail, and add an extra one on to the cd $SRCDIR to handle that failing (otherwise we'd go on and try to build the current directory after cd prints its error, which is unhelpful). These changes will make it easier to bundle these steps up into new top-level targets to allow the build system to manage the steps rather than etcupdate, which will also handle BUILD_WITH_STRICT_TMPPATH, which currently does not work with etcupdate. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D41204
Diffstat (limited to 'usr.sbin/etcupdate')
-rwxr-xr-xusr.sbin/etcupdate/etcupdate.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index d15d1498200f..ae75a6e36f03 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -214,15 +214,17 @@ build_tree()
mkdir -p $1/etc || return 1
cp -p $SRCDIR/$file $1/etc/$name || return 1
done
- elif ! [ -n "$nobuild" ]; then
- (cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs &&
- MAKEOBJDIRPREFIX=$destdir/usr/obj $make _obj SUBDIR_OVERRIDE=etc &&
- MAKEOBJDIRPREFIX=$destdir/usr/obj $make everything SUBDIR_OVERRIDE=etc &&
- MAKEOBJDIRPREFIX=$destdir/usr/obj $make DESTDIR=$destdir distribution) || \
- return 1
else
- (cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs &&
- $make DESTDIR=$destdir distribution) || return 1
+ (
+ 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
+ fi
+ $make DESTDIR=$destdir distrib-dirs || exit 1
+ $make DESTDIR=$destdir distribution || exit 1
+ ) || return 1
fi
chflags -R noschg $1 || return 1
rm -rf $1/usr/obj || return 1