aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@FreeBSD.org>2022-10-03 16:16:19 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2022-10-03 16:16:19 +0000
commite571b0f8f8c1730330fb656d54f081beb993c962 (patch)
tree83a3d53b381716e2003c439fd8e9d8414fa7ae44
parenta09af1b7fd95d9479954c5b8e96a126cad468424 (diff)
downloadsrc-e571b0f8f8c1730330fb656d54f081beb993c962.tar.gz
src-e571b0f8f8c1730330fb656d54f081beb993c962.zip
etcupdate: Fix -N support for build command
Whilst febca0e64361 added -N for both build and extract, it only fully worked for extract; build would perform the actual tree build with -DNO_ROOT and construct the intended METALOG, but the subsequent tarball creation did not take this into account and just tarred up the the directory as-is rather than using the METALOG. This resulted in the permissions and ownership not being correct, as well as there being a stray METALOG file in the tarball's root. Reported by: avg Reviewed by: avg, jhb, imp Tested by: avg Fixes: febca0e64361 ("etcupdate: Add a -N flag to perform a NO_ROOT build") Differential Revision: https://reviews.freebsd.org/D36845
-rwxr-xr-xusr.sbin/etcupdate/etcupdate.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index 0190e5868f05..445b8e105c61 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -1321,7 +1321,7 @@ handle_added_file()
# Build a new tree and save it in a tarball.
build_cmd()
{
- local dir
+ local dir tartree
if [ $# -ne 1 ]; then
echo "Missing required tarball."
@@ -1342,7 +1342,12 @@ build_cmd()
remove_tree $dir
exit 1
fi
- if ! tar cfj $1 -C $dir . >&3 2>&1; then
+ if [ -n "$noroot" ]; then
+ tartree=@METALOG
+ else
+ tartree=.
+ fi
+ if ! tar cfj $1 -C $dir $tartree >&3 2>&1; then
echo "Failed to create tarball."
remove_tree $dir
exit 1