[154181]
raimue at macports.org
raimue at macports.org
Sun Oct 23 18:30:56 CEST 2016
Revision: 154181
https://trac.macports.org/changeset/154181
Author: raimue at macports.org
Date: 2016-10-23 18:30:55 +0200 (Sun, 23 Oct 2016)
Log Message:
-----------
merge r154073 from trunk:
Installer postflight: Fix all shellcheck warnings
This may have been the cause for double entries in .bash_profile that some
users have seen. Thanks for Ian Hayhurst for the suggestion.
Revision Links:
--------------
https://trac.macports.org/changeset/154073
Modified Paths:
--------------
branches/release_2_3/base/portmgr/dmg/postflight.in
Property Changed:
----------------
branches/release_2_3/base/
Index: branches/release_2_3/base
===================================================================
--- branches/release_2_3/base 2016-10-23 16:18:55 UTC (rev 154180)
+++ branches/release_2_3/base 2016-10-23 16:30:55 UTC (rev 154181)
Property changes on: branches/release_2_3/base
___________________________________________________________________
Modified: svn:mergeinfo
## -5,6 +5,6 ##
/branches/gsoc13-tests:106692-111324
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
-/trunk/base:118038-118039,118056,118085,118161,118559,118562-118570,118598-118599,118602-118603,118606-118607,118640,118735,119034,119169,119171,119175,119204,119297,119571,119594-119595,119987,119992,120036,120038,120059-120060,120064,120067-120069,120074,120076,120127,120132,120142,120345,120382,120637,121311,121364,121451,121485,122827,123652,124145-124146,124150,124216,125578,125621,125859,126475,126866,126868,126895,126900,127797,128113,128274,128276,128422,132312,134501-134502,134511,135998-135999,136965,137850,138461,138530,138749,139270,140693,140724,141134,145037,145162,146644,147347,147456,148084,149299,149529,150305,152115,152442,152447,152676,153648,153865,153932
+/trunk/base:118038-118039,118056,118085,118161,118559,118562-118570,118598-118599,118602-118603,118606-118607,118640,118735,119034,119169,119171,119175,119204,119297,119571,119594-119595,119987,119992,120036,120038,120059-120060,120064,120067-120069,120074,120076,120127,120132,120142,120345,120382,120637,121311,121364,121451,121485,122827,123652,124145-124146,124150,124216,125578,125621,125859,126475,126866,126868,126895,126900,127797,128113,128274,128276,128422,132312,134501-134502,134511,135998-135999,136965,137850,138461,138530,138749,139270,140693,140724,141134,145037,145162,146644,147347,147456,148084,149299,149529,150305,152115,152442,152447,152676,153648,153865,153932,154073
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
\ No newline at end of property
Modified: branches/release_2_3/base/portmgr/dmg/postflight.in
===================================================================
--- branches/release_2_3/base/portmgr/dmg/postflight.in 2016-10-23 16:18:55 UTC (rev 154180)
+++ branches/release_2_3/base/portmgr/dmg/postflight.in 2016-10-23 16:30:55 UTC (rev 154181)
@@ -39,7 +39,7 @@
VERSION=2.3.1
# Abstraction variables:
-PREFIX=@prefix@
+PREFIX="@prefix@"
BINPATH=${PREFIX}/bin
SBINPATH=${PREFIX}/sbin
CONFIGPATH=${PREFIX}/etc/macports
@@ -46,8 +46,8 @@
MANPAGES=${PREFIX}/share/man
DSCL=/usr/bin/dscl
RUNUSR=macports
-TCLSH=@TCLSH@
-TCL_PACKAGE_PATH=@TCL_PACKAGE_PATH@
+TCLSH="@TCLSH@"
+TCL_PACKAGE_PATH="@TCL_PACKAGE_PATH@"
TIMESTAMP=$(date +"%Y-%m-%d_at_%H:%M:%S")
BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
OUR_STRING="MacPorts Installer addition on ${TIMESTAMP}"
@@ -60,8 +60,8 @@
for f in archive_sites.conf macports.conf pubkeys.conf sources.conf variants.conf ; do
if [[ ! -f ${CONFIGPATH}/${f} ]]; then
echo "Copying ${f}.default to ${f}"
- /bin/cp ${CONFIGPATH}/${f}.default ${CONFIGPATH}/${f}
- /bin/chmod 644 ${CONFIGPATH}/${f}
+ /bin/cp "${CONFIGPATH}/${f}.default" "${CONFIGPATH}/${f}"
+ /bin/chmod 644 "${CONFIGPATH}/${f}"
fi
done
}
@@ -68,17 +68,17 @@
# Command to update the MacPorts installation through "selfupdate":
function update_macports {
- SCRIPT_DIR=$(dirname $0)
+ SCRIPT_DIR=$(dirname "$0")
# Add [default] tag to the central MacPorts repository, if it isn't already
echo "Adding [default] tag to sources.conf if needed..."
- ${TCLSH} ${SCRIPT_DIR}/upgrade_sources_conf_default.tcl ${PREFIX}
+ "${TCLSH}" "${SCRIPT_DIR}/upgrade_sources_conf_default.tcl" "${PREFIX}"
# Convert image directories (and direct mode installs) to image archives
echo "Updating port image format..."
- ${TCLSH} ${SCRIPT_DIR}/images_to_archives.tcl
- ${TCLSH} ${SCRIPT_DIR}/dedup_portfiles.tcl
+ "${TCLSH}" "${SCRIPT_DIR}/images_to_archives.tcl"
+ "${TCLSH}" "${SCRIPT_DIR}/dedup_portfiles.tcl"
echo "Synchronizing the MacPorts installation with the project's rsync server..."
- if ! ${BINPATH}/port -v selfupdate; then
+ if ! "${BINPATH}/port" -v selfupdate; then
echo "An attempt to synchronize your recent MacPorts installation with the project's rsync server failed!"
echo "Please run 'sudo port -d selfupdate' manually to find out the cause of the error."
else
@@ -99,10 +99,12 @@
}
echo -e "\n##\n# Your previous ${HOME}/.${CONF_FILE} file was backed up as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}\n##" >> "${HOME}/.${CONF_FILE}"
fi
- echo -e "\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with MacPorts." >> "${HOME}/.${CONF_FILE}"
- echo "${ENV_COMMAND} ${1}${ASSIGN}${2}" >> "${HOME}/.${CONF_FILE}"
- echo -e "# Finished adapting your ${1} environment variable for use with MacPorts.\n" >> "${HOME}/.${CONF_FILE}"
- chown ${USER} "${HOME}/.${CONF_FILE}" || echo "Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!"
+ {
+ echo -e "\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with MacPorts."
+ echo "${ENV_COMMAND} ${1}${ASSIGN}${2}"
+ echo -e "# Finished adapting your ${1} environment variable for use with MacPorts.\n"
+ } >> "${HOME}/.${CONF_FILE}"
+ chown "${USER}" "${HOME}/.${CONF_FILE}" || echo "Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!"
echo "An appropriate ${1} variable has been added to your shell environment by the MacPorts installer."
}
@@ -112,9 +114,9 @@
MAN1="port.1"
MAN5="macports.conf.5"
MAN7="portfile.7 portstyle.7 porthier.7 portgroup.7"
- for m in ${MAN1}; do rm -vf ${MANPAGES}/man1/$m ; done
- for m in ${MAN5}; do rm -vf ${MANPAGES}/man5/$m ; done
- for m in ${MAN7}; do rm -vf ${MANPAGES}/man7/$m ; done
+ for m in ${MAN1}; do rm -vf "${MANPAGES}/man1/$m" ; done
+ for m in ${MAN5}; do rm -vf "${MANPAGES}/man5/$m" ; done
+ for m in ${MAN7}; do rm -vf "${MANPAGES}/man7/$m" ; done
echo -e "Done.\n"
}
@@ -141,44 +143,44 @@
# create the user to use for privilege dropping
function create_run_user {
DSEDITGROUP=/usr/sbin/dseditgroup
- if ! ${DSCL} -q . -read /Groups/${RUNUSR} > /dev/null 2>&1 ; then
+ if ! ${DSCL} -q . -read "/Groups/${RUNUSR}" > /dev/null 2>&1 ; then
echo "Creating group \"${RUNUSR}\""
- ${DSEDITGROUP} -q -o create ${RUNUSR}
+ ${DSEDITGROUP} -q -o create "${RUNUSR}"
fi
- if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then
+ 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
+ while [[ -n "$(${DSCL} -q /Search -search /Users UniqueID $NEXTUID)" ]]; do
let "NEXTUID=NEXTUID+1"
done
- ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $NEXTUID
+ ${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 . -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
+ ${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
+ 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
+ ${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
+ 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
+ ${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${PREFIX}/var/macports/home"
fi
}
@@ -196,7 +198,7 @@
# Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking.
# Exit nicely if the shell is any other than bash or tcsh, as that's considered non-standard.
-USHELL=$(${DSCL} . -read /Users/${USER} shell | awk -F'/' '{print $NF}') || {
+USHELL=$(${DSCL} . -read "/Users/${USER}" shell | awk -F'/' '{print $NF}') || {
echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually."
update_macports
exit 1
@@ -237,7 +239,7 @@
# Adding our setting to the PATH variable if not already there:
-if ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep ${PREFIX} > /dev/null; then
+if "${SHELL}" ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep "${PREFIX}" > /dev/null; then
echo "Your shell already has the right PATH environment variable for use with MacPorts!"
else
write_setting PATH "\"${BINPATH}:${SBINPATH}:\$PATH\""
@@ -244,13 +246,13 @@
fi
# We gather the path into a variable of our own for faster operation:
-ORIGINAL_MANPATH="$(${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv MANPATH")"
+ORIGINAL_MANPATH="$("${SHELL}" ${LOGIN_FLAG} -c "/usr/bin/printenv MANPATH")"
# Adding our setting to the MANPATH variable only if it exists:
-if ! ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \
+if ! "${SHELL}" ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \
# and following that, if it's not empty:
[[ -z "${ORIGINAL_MANPATH}" ]] || \
# or if it doesn't already contain our path:
- echo "${ORIGINAL_MANPATH}" | grep ${MANPAGES} > /dev/null || \
+ echo "${ORIGINAL_MANPATH}" | grep "${MANPAGES}" > /dev/null || \
# or if there's no empty component somewhere in the middle of it:
echo "${ORIGINAL_MANPATH}" | grep :: > /dev/null || \
# or at the start of it:
@@ -263,7 +265,7 @@
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)) || ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep DISPLAY" > /dev/null; then
+if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || "${SHELL}" ${LOGIN_FLAG} -c "/usr/bin/env | grep DISPLAY" > /dev/null; then
echo "Your shell already has the right DISPLAY environment variable for use with MacPorts!"
else
write_setting DISPLAY ":0"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-changes/attachments/20161023/6f638b06/attachment-0002.html>
More information about the macports-changes
mailing list