Fix and simplify checks for Tiger

Closes: https://github.com/macports/macports-base/pull/218
Closes: https://trac.macports.org/ticket/61649
This commit is contained in:
Joshua Root
2021-04-14 04:32:32 +10:00
parent a18eb94efc
commit 4ce1e96415
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -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}\"" ; \
+3 -2
View File
@@ -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"