Skip to content

Commit

Permalink
build: Default METALOG ownership to root/wheel
Browse files Browse the repository at this point in the history
Release calls etcupdate.sh, which calls certctl. When building as an
unprivileged user, this resulted in the certs with uid of the building
user.

PR: 283214

Signed-off-by: Pat Maddox <[email protected]>
  • Loading branch information
patmaddox committed Dec 14, 2024
1 parent ac493db commit 9051057
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Makefile.inc1
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,7 @@ DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,tests,,}
.endif

MTREE_MAGIC?= mtree 2.0
MTREE_OWNER= uname=root gname=wheel
.if ${MK_REPRODUCIBLE_BUILD} == "yes"
MTREE_TIME= time=${SOURCE_DATE_EPOCH}.000000000
SED_REPLACE_TIME= -e "s/ time=[[:digit:].]*/ ${MTREE_TIME}/"
Expand Down Expand Up @@ -1471,7 +1472,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
.if defined(NO_ROOT)
-mkdir -p ${METALOG:H}
echo "#${MTREE_MAGIC}" > ${METALOG}
echo "/set ${MTREE_TIME}" >> ${METALOG}
echo "/set ${MTREE_TIME} ${MTREE_OWNER}" >> ${METALOG}
.endif
.if make(distributeworld)
.for dist in ${EXTRA_DISTRIBUTIONS}
Expand Down Expand Up @@ -1553,7 +1554,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
@# the relevant mtree line.
cd ${DESTDIR}/${DISTDIR}; \
find ./${dist}${path} | ${METALOG_SORT_CMD} -u ${METALOG} - | \
awk 'BEGIN { print "#${MTREE_MAGIC}"; print "/set ${MTREE_TIME}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \
awk 'BEGIN { print "#${MTREE_MAGIC}"; print "/set ${MTREE_TIME} ${MTREE_OWNER}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \
${DESTDIR}/${DISTDIR}/${dist}${suffix}
.endfor
.endfor
Expand Down Expand Up @@ -1918,7 +1919,7 @@ distributekernel distributekernel.debug: .PHONY
${.TARGET:S/distributekernel/install/}
.if defined(NO_ROOT)
echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.meta
echo "/set ${MTREE_TIME}" >> ${DESTDIR}/${DISTDIR}/kernel.meta
echo "/set ${MTREE_TIME} ${MTREE_OWNER}" >> ${DESTDIR}/${DISTDIR}/kernel.meta
sed -e 's|^./kernel|.|' ${SED_REPLACE_TIME} ${DESTDIR}/${DISTDIR}/kernel.premeta | \
${METALOG_SORT_CMD} >> ${DESTDIR}/${DISTDIR}/kernel.meta
.endif
Expand All @@ -1935,7 +1936,7 @@ distributekernel distributekernel.debug: .PHONY
${.TARGET:S/distributekernel/install/}
.if defined(NO_ROOT)
echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
echo "/set ${MTREE_TIME}" >> ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
echo "/set ${MTREE_TIME} ${MTREE_OWNER}" >> ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
sed -e "s|^./kernel.${_kernel}|.|" ${SED_REPLACE_TIME} \
${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta | \
${METALOG_SORT_CMD} >> ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
Expand Down

0 comments on commit 9051057

Please sign in to comment.