Skip to content

Commit

Permalink
Update RUNUSR home dir if it's any undesired value
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Sep 19, 2023
1 parent 6cf70db commit 128e8ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
29 changes: 16 additions & 13 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,23 @@ ifeq ($(DESTDIR),)
echo "Not creating user \"${RUNUSR}\" (not root)" ; \
fi ; \
fi ; \
if test "$$(${DSCL} -q . -read "/Users/${RUNUSR}" NFSHomeDirectory)" = "NFSHomeDirectory: /var/empty" ; then \
if test `id -u` -eq 0; then \
echo "Updating home directory location for user \"${RUNUSR}\"" ; \
${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${localstatedir}/macports/home" ; \
else \
echo "Not updating home directory location for user \"${RUNUSR}\" (not root)" ; \
RUNUSR_UID=$$(${DSCL} -q . -read "/Users/${RUNUSR}" UniqueID | /usr/bin/awk '{print $$2}'); \
if test "$$RUNUSR_UID" -gt 500; then \
if test "$$(${DSCL} -q . -read "/Users/${RUNUSR}" NFSHomeDirectory)" != "NFSHomeDirectory: ${localstatedir}/macports/home" ; then \
if test `id -u` -eq 0; then \
echo "Updating home directory location for user \"${RUNUSR}\"" ; \
${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${localstatedir}/macports/home" ; \
else \
echo "Not updating home directory location for user \"${RUNUSR}\" (not root)" ; \
fi ; \
fi ; \
fi ; \
if test "@OS_MAJOR@" -eq 8 -a `id -u` -eq 0; then \
GID=`${DSCL} -q . -read "/Groups/${RUNUSR}" PrimaryGroupID | /usr/bin/awk '{print $$2}'` ; \
if test "`${DSCL} -q . -read "/Users/${RUNUSR}" PrimaryGroupID 2>/dev/null | /usr/bin/awk '{print $$2}'`" != "$$GID"; then \
echo "Fixing PrimaryGroupID for user \"${RUNUSR}\"" ; \
${DSCL} -q . -create "/Users/${RUNUSR}" PrimaryGroupID $$GID ; \
${DSCL} -q . -create "/Users/${RUNUSR}" RealName MacPorts ; \
if test "@OS_MAJOR@" -eq 8 -a `id -u` -eq 0; then \
GID=`${DSCL} -q . -read "/Groups/${RUNUSR}" PrimaryGroupID | /usr/bin/awk '{print $$2}'` ; \
if test "`${DSCL} -q . -read "/Users/${RUNUSR}" PrimaryGroupID 2>/dev/null | /usr/bin/awk '{print $$2}'`" != "$$GID"; then \
echo "Fixing PrimaryGroupID for user \"${RUNUSR}\"" ; \
${DSCL} -q . -create "/Users/${RUNUSR}" PrimaryGroupID $$GID ; \
${DSCL} -q . -create "/Users/${RUNUSR}" RealName MacPorts ; \
fi ; \
fi ; \
fi ; \
else \
Expand Down
2 changes: 1 addition & 1 deletion portmgr/dmg/postflight.in
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function create_run_user {
${DSCL} -q . -create "/Users/${RUNUSR}" RealName MacPorts
fi
fi
if [[ "$(${DSCL} -q . -read "/Users/${RUNUSR}" NFSHomeDirectory)" = "NFSHomeDirectory: /var/empty" ]]; then
if [[ "$(${DSCL} -q . -read "/Users/${RUNUSR}" NFSHomeDirectory)" != "NFSHomeDirectory: ${PREFIX}/var/macports/home" ]]; then
echo "Updating home directory location for user \"${RUNUSR}\""
${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${PREFIX}/var/macports/home"
fi
Expand Down

0 comments on commit 128e8ce

Please sign in to comment.