From 8f5d623785ef820d64df9c1ca21bd8a7dbca21cc Mon Sep 17 00:00:00 2001 From: Chris Hettrick Date: Sat, 17 Feb 2024 11:09:06 -0700 Subject: [PATCH] build: Enable unprivileged builds and installs. Set ${INSTALL} makefile variables to "${TOOLBINDIR}/binstall -U" where the "-U" option enables unprivileged mode in binstall(1). Files and executables installed into ${DESTDIR} will be installed with the privileges of the build user, so super-user privileges are no longer used or required. The use of sudo(8) has been removed from the distribution make target and the ${FSIMG} make target that uses fsutil(1). fsutil(1) still generates a file system image with the correct owners, groups, and file permissions, as per the manifest spec. --- Makefile | 4 ++-- share/mk/sys.mk | 2 +- tools/Makefile.inc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0ae76a1a..df4b5562 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ all: symlinks tools ${MAKE} -C $$dir ; done for dir in ${SUBDIR} ; do \ ${MAKE} -C $$dir DESTDIR=${DESTDIR} install ; done - sudo ${MAKE} -C etc DESTDIR=${DESTDIR} distribution + ${MAKE} -C etc DESTDIR=${DESTDIR} distribution $(MAKE) fs tools: @@ -67,7 +67,7 @@ ${FSIMG}: distrib/${MACHINE}/md.${MACHINE} distrib/base/mi.home rm -f $@ distrib/$(MACHINE)/_manifest cat distrib/base/mi distrib/$(MACHINE)/md.$(MACHINE) > distrib/$(MACHINE)/_manifest $(FSUTIL) --repartition=fs=$(FS_MBYTES)M:swap=$(SWAP_MBYTES)M:fs=$(U_MBYTES)M $@ - sudo $(FSUTIL) --new --partition=1 --manifest=distrib/$(MACHINE)/_manifest $@ ${DESTDIR} + ${FSUTIL} --new --partition=1 --manifest=distrib/${MACHINE}/_manifest $@ ${DESTDIR} # In case you need a separate /home partition, # uncomment the following line. $(FSUTIL) --new --partition=3 --manifest=distrib/base/mi.home $@ distrib/home diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 17d4fd4d..c57fb853 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -95,7 +95,7 @@ SIZE= ${GCCPREFIX}-size AS= ${CC} -x assembler-with-cpp -c LEX= flex -INSTALL= install +INSTALL= ${TOOLBINDIR}/binstall -U TAGSFILE= tags diff --git a/tools/Makefile.inc b/tools/Makefile.inc index 355c2497..4c1e624d 100644 --- a/tools/Makefile.inc +++ b/tools/Makefile.inc @@ -9,7 +9,7 @@ HOST_CC?= cc CC= ${HOST_CC} -INSTALL= install +INSTALL= ${TOOLBINDIR}/binstall -U YACC!= if [ x"${_HOST_OSNAME}" = x"Linux" ] ; then \ echo "byacc" ; \