Skip to content

Commit

Permalink
build: Enable unprivileged builds and installs.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chettrick committed Feb 17, 2024
1 parent 982681f commit 8f5d623
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion share/mk/sys.mk
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ SIZE= ${GCCPREFIX}-size
AS= ${CC} -x assembler-with-cpp -c

LEX= flex
INSTALL= install
INSTALL= ${TOOLBINDIR}/binstall -U

TAGSFILE= tags

Expand Down
2 changes: 1 addition & 1 deletion tools/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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" ; \
Expand Down

0 comments on commit 8f5d623

Please sign in to comment.