From cd992816c8fa468654a74193aab83cd43aaaceeb Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Thu, 7 Dec 2023 20:51:55 +1100 Subject: [PATCH] Work around mtree quirk Turns out mtree -U won't complain but also won't actually create any directories if not all of uname, gname, and mode are specified, even when it can't enforce the ownership. But it's happy if you give it any gname. --- configure | 11 ++++++++--- configure.ac | 11 ++++++++--- doc/base.mtree.in | 2 +- doc/prefix.mtree.in | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 51faa2712..6a3b21e65 100755 --- a/configure +++ b/configure @@ -703,7 +703,7 @@ UNIVERSAL_ARCHS startupitem_install MPFRAMEWORKSDIR MPAPPLICATIONSDIR -MTREE_UGNAME +MTREE_GNAME DSTMODE RUNUSR DSTGRP @@ -7014,10 +7014,15 @@ printf "%s\n" "$DSTMODE" >&6; } fi -# Don't set uname or gname in .mtree files unless root +# Don't set real uname or gname in .mtree files unless root # https://trac.macports.org/ticket/49501 if test "$DSTUSR" = "root" ; then - MTREE_UGNAME="uname=root gname=$DSTGRP" + MTREE_GNAME="$DSTGRP" +else + # This has to be set to something or mtree won't create any directories. + # It doesn't matter what it's set to for non-root though, as it can't + # change the ownership anyway. + MTREE_GNAME="admin" fi diff --git a/configure.ac b/configure.ac index ad12f7240..02144a8ea 100644 --- a/configure.ac +++ b/configure.ac @@ -227,12 +227,17 @@ MP_CHECK_RUNUSER MP_DIRECTORY_MODE MP_SHARED_DIRECTORY -# Don't set uname or gname in .mtree files unless root +# Don't set real uname or gname in .mtree files unless root # https://trac.macports.org/ticket/49501 if test "$DSTUSR" = "root" ; then - MTREE_UGNAME="uname=root gname=$DSTGRP" + MTREE_GNAME="$DSTGRP" +else + # This has to be set to something or mtree won't create any directories. + # It doesn't matter what it's set to for non-root though, as it can't + # change the ownership anyway. + MTREE_GNAME="admin" fi -AC_SUBST(MTREE_UGNAME) +AC_SUBST(MTREE_GNAME) # Check for default directories MP_PATH_APPLICATIONS diff --git a/doc/base.mtree.in b/doc/base.mtree.in index 08b9ee2f5..4ea754452 100644 --- a/doc/base.mtree.in +++ b/doc/base.mtree.in @@ -1,7 +1,7 @@ # MacPorts filesystem hierarchy, for internal use only. Changes to this file will not stick across installations. # -/set type=dir @MTREE_UGNAME@ mode=@DSTMODE@ +/set type=dir uname=root gname=@MTREE_GNAME@ mode=@DSTMODE@ . man type=link link=share/man .. diff --git a/doc/prefix.mtree.in b/doc/prefix.mtree.in index 56aa7fe13..c30d0bbaf 100644 --- a/doc/prefix.mtree.in +++ b/doc/prefix.mtree.in @@ -1,6 +1,6 @@ # MacPorts filesystem hierarchy, for internal use only. Changes to this file will not stick across installations. -/set type=dir @MTREE_UGNAME@ mode=@DSTMODE@ +/set type=dir uname=root gname=@MTREE_GNAME@ mode=@DSTMODE@ . bin ..