[MacPorts] #41039: Installing MacPorts on Mavericks Renames "staff" Group To "macports"

MacPorts noreply at macports.org
Wed Nov 27 12:59:12 PST 2013


#41039: Installing MacPorts on Mavericks Renames "staff" Group To "macports"
-----------------------------+--------------------------------
  Reporter:  roberthuston@…  |      Owner:  macports-tickets@…
      Type:  defect          |     Status:  new
  Priority:  Normal          |  Milestone:
 Component:  base            |    Version:  2.2.1
Resolution:                  |   Keywords:
      Port:                  |
-----------------------------+--------------------------------

Comment (by adrian@…):

 I just ran into this issue too - quite shocking to see all your files
 owned by group macports, but doesn't seem to cause great problems.

 I fixed this by deleting the macports user and group using
 /System/Library/CoreServices/Directory Utility.app and then running a
 small script produced from the macports pkg installer's postinstall
 script.

 Save this as create-macports-user-group.sh and then run with "sudo
 ./create-macports-user-group.sh"
 {{{
 #!/bin/bash

 # Abstraction variables:
 DSCL=/usr/bin/dscl
 RUNUSR=macports


 # create the user to use for privilege dropping
 DSEDITGROUP=/usr/sbin/dseditgroup

 if ! ${DSCL} -q . -read /Groups/${RUNUSR} > /dev/null 2>&1 ; then
     echo "Creating group \"${RUNUSR}\""
     ${DSEDITGROUP} -q -o create ${RUNUSR}
 fi
 if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then
     echo "Creating user \"${RUNUSR}\""
     NEXTUID=501
     while [[ -n "`${DSCL} -q /Search -search /Users UniqueID $NEXTUID`"
 ]]; do
         let "NEXTUID=NEXTUID+1"
     done
     ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $NEXTUID

     # These are implicitly added on Mac OSX Lion.  AuthenticationAuthority
     # causes the user to be visible in the Users & Groups Preference Pane,
     # and the others are just noise, so delete them.
     # https://trac.macports.org/ticket/30168
     ${DSCL} -q . -delete /Users/${RUNUSR} AuthenticationAuthority
     ${DSCL} -q . -delete /Users/${RUNUSR} PasswordPolicyOptions
     ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:KerberosKeys
     ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:ShadowHashData

     ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts
     ${DSCL} -q . -create /Users/${RUNUSR} Password \*
     ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $(${DSCL} -q .
 -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $2}')
     ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory
 ${PREFIX}/var/macports/home
     ${DSCL} -q . -create /Users/${RUNUSR} UserShell /usr/bin/false
 fi
 if [[ $(sw_vers -productVersion | /usr/bin/awk -F . '{print $2}') -eq 4
 ]]; then
     GID=$(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID |
 /usr/bin/awk '{print $2}')
     if [[ "$(${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
 if [[ "$(${DSCL} -q . -read /Users/${RUNUSR} NFSHomeDirectory)" =
 "NFSHomeDirectory: /var/empty" ]]; then
     echo "Updating home directory location for user \"${RUNUSR}\""
     ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory
 ${PREFIX}/var/macports/home
 fi

 }}}

 After that the macports user and groups PrimaryGroupID was 502, instead of
 20.

-- 
Ticket URL: <https://trac.macports.org/ticket/41039#comment:8>
MacPorts <http://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list