etcupdate: Fix -N support for build command
Whilstfebca0e643added -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:febca0e643("etcupdate: Add a -N flag to perform a NO_ROOT build") Differential Revision: https://reviews.freebsd.org/D36845
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user