<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/f7759f494fa63a7a0e99d16330efb1a2ac8c0f61">https://github.com/macports/macports-base/commit/f7759f494fa63a7a0e99d16330efb1a2ac8c0f61</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit f7759f494fa63a7a0e99d16330efb1a2ac8c0f61
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Sun May 25 14:46:25 2025 +1000
<span style='display:block; white-space:pre;color:#404040;'> postflight: check RUNUSR attributes
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> As done in the Makefile in ad2f4ab. Theoretically this problem
</span><span style='display:block; white-space:pre;color:#404040;'> shouldn't happen here, as RUNUSR is always 'macports', but there have
</span><span style='display:block; white-space:pre;color:#404040;'> been occasional reports of strange things happening to the macports
</span><span style='display:block; white-space:pre;color:#404040;'> user or other accounts getting renamed to 'macports' (with Migration
</span><span style='display:block; white-space:pre;color:#404040;'> Assistant being one of the likely culprits), so it's probably best not
</span><span style='display:block; white-space:pre;color:#404040;'> to mess with the user if it doesn't look right.
</span>---
portmgr/dmg/postflight.in | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/portmgr/dmg/postflight.in b/portmgr/dmg/postflight.in
</span><span style='display:block; white-space:pre;color:#808080;'>index f97a5f2a6..e9f9ea7c1 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/portmgr/dmg/postflight.in
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/portmgr/dmg/postflight.in
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -206,9 +206,25 @@ function create_run_user {
</span> ${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${PREFIX}/var/macports/home"
${DSCL} -q . -create "/Users/${RUNUSR}" UserShell /usr/bin/false
fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if [[ "$(${DSCL} -q . -read "/Users/${RUNUSR}" NFSHomeDirectory)" != "NFSHomeDirectory: ${PREFIX}/var/macports/home" ]]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- echo "Updating home directory location for user \"${RUNUSR}\""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${PREFIX}/var/macports/home"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RUNUSR_UID=$(${DSCL} -q . -read "/Users/${RUNUSR}" UniqueID | /usr/bin/awk '{print $2}')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RUNUSR_NAME=$(${DSCL} -q . -read "/Users/${RUNUSR}" RealName | /usr/bin/awk '{print $2}')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RUNUSR_SHELL=$(${DSCL} -q . -read "/Users/${RUNUSR}" UserShell | /usr/bin/awk '{print $2}')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if test "$RUNUSR_UID" -gt 500 -a "$RUNUSR_SHELL" = "/usr/bin/false" -a "$RUNUSR_NAME" = "MacPorts"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [[ "$(${DSCL} -q . -read "/Users/${RUNUSR}" NFSHomeDirectory)" != "NFSHomeDirectory: ${PREFIX}/var/macports/home" ]]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Updating home directory location for user \"${RUNUSR}\""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${PREFIX}/var/macports/home"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Warning: '${RUNUSR}' user has unexpected atrributes:"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if test "$RUNUSR_UID" -le 500; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "UniqueID: $RUNUSR_UID (expected > 500)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if test "$RUNUSR_NAME" != "MacPorts"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "RealName: $RUNUSR_NAME (expected 'MacPorts')"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if test "$RUNUSR_SHELL" != "/usr/bin/false"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "UserShell: $RUNUSR_SHELL (expected '/usr/bin/false')"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span> fi
}
</pre><pre style='margin:0'>
</pre>