diff --git a/Makefile.in b/Makefile.in index 9b52b6471..96119fa8e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,7 +79,7 @@ ifeq ($(DESTDIR),) echo "Not updating home directory location for user \"${RUNUSR}\" (not root)" ; \ fi ; \ fi ; \ - if test `sw_vers -productVersion | /usr/bin/awk -F . '{print $$2}'` -eq 4 -a `id -u` -eq 0; then \ + 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}\"" ; \ diff --git a/portmgr/dmg/postflight.in b/portmgr/dmg/postflight.in index 7d2a49979..7232a979d 100755 --- a/portmgr/dmg/postflight.in +++ b/portmgr/dmg/postflight.in @@ -43,6 +43,7 @@ SBINPATH=${PREFIX}/sbin CONFIGPATH=${PREFIX}/etc/macports MANPAGES=${PREFIX}/share/man DSCL=/usr/bin/dscl +OS_MAJOR=$(uname -r | cut -d . -f 1) RUNUSR=macports TCLSH="@TCLSH@" TCL_PACKAGE_PATH="@TCL_PACKAGE_PATH@" @@ -182,7 +183,7 @@ function create_run_user { ${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 + if [[ "${OS_MAJOR}" -eq 8 ]]; 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}\"" @@ -279,7 +280,7 @@ if /usr/bin/su "${USER}" -l -c "/usr/bin/printenv MANPATH" > /dev/null; then fi # Adding a DISPLAY variable only if we're running on Tiger or less and if it doesn't already exist: -if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || /usr/bin/su "${USER}" -l -c "/usr/bin/printenv DISPLAY" > /dev/null > /dev/null; then +if [[ "${OS_MAJOR}" -ge 9 ]] || /usr/bin/su "${USER}" -l -c "/usr/bin/printenv DISPLAY" > /dev/null; then echo "Your shell already has the right DISPLAY environment variable for use with MacPorts!" else write_setting DISPLAY ":0"