Revision: 79751 http://trac.macports.org/changeset/79751 Author: jmr@macports.org Date: 2011-06-24 14:01:07 -0700 (Fri, 24 Jun 2011) Log Message: ----------- merge r79750 from trunk: use double bracket tests in postflight since it asks for bash anyway, also ask for bash in InstallationCheck, and remove useless test for empty variables Revision Links: -------------- http://trac.macports.org/changeset/79750 Modified Paths: -------------- branches/release_2_0/base/portmgr/dmg/InstallationCheck branches/release_2_0/base/portmgr/dmg/postflight Property Changed: ---------------- branches/release_2_0/ branches/release_2_0/base/ branches/release_2_0/base/portmgr/fedora/macports.spec branches/release_2_0/base/src/pextlib1.0/sha2.c branches/release_2_0/base/src/pextlib1.0/sha2.h branches/release_2_0/base/src/pextlib1.0/sha256cmd.c branches/release_2_0/base/src/pextlib1.0/sha256cmd.h branches/release_2_0/base/src/registry2.0/receipt_sqlite.tcl Property changes on: branches/release_2_0 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 + /trunk:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 Property changes on: branches/release_2_0/base ___________________________________________________________________ Modified: svn:mergeinfo - /branches/gsoc08-privileges/base:37343-46937 /branches/gsoc09-logging/base:51231-60371 /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:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 /users/perry/base-bugs_and_notes:45682-46060 /users/perry/base-select:44044-44692 + /branches/gsoc08-privileges/base:37343-46937 /branches/gsoc09-logging/base:51231-60371 /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:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 /users/perry/base-bugs_and_notes:45682-46060 /users/perry/base-select:44044-44692 Modified: branches/release_2_0/base/portmgr/dmg/InstallationCheck =================================================================== --- branches/release_2_0/base/portmgr/dmg/InstallationCheck 2011-06-24 20:55:55 UTC (rev 79750) +++ branches/release_2_0/base/portmgr/dmg/InstallationCheck 2011-06-24 21:01:07 UTC (rev 79751) @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # $Id$ # Modified: branches/release_2_0/base/portmgr/dmg/postflight =================================================================== --- branches/release_2_0/base/portmgr/dmg/postflight 2011-06-24 20:55:55 UTC (rev 79750) +++ branches/release_2_0/base/portmgr/dmg/postflight 2011-06-24 21:01:07 UTC (rev 79751) @@ -57,7 +57,7 @@ # Create config files from defaults if not present function setup_configs { for f in macports.conf pubkeys.conf sources.conf variants.conf ; do - if [ ! -f ${CONFIGPATH}/${f} ]; then + if [[ ! -f ${CONFIGPATH}/${f} ]]; then echo "Copying ${f}.default to ${f}" /bin/cp ${CONFIGPATH}/${f}.default ${CONFIGPATH}/${f} /bin/chmod 644 ${CONFIGPATH}/${f} @@ -87,7 +87,7 @@ # backing up the original only if it exists and if it doesn't contain the ${OUR_STRING} identification string, # which hints that we've already tweaked it and therefore already backed it up. function write_setting () { - if [ -f ${HOME}/.${CONF_FILE} ] && ! grep "${OUR_STRING}" ${HOME}/.${CONF_FILE} > /dev/null; then + if [[ -f ${HOME}/.${CONF_FILE} ]] && ! grep "${OUR_STRING}" ${HOME}/.${CONF_FILE} > /dev/null; then echo "Backing up your ${HOME}/.${CONF_FILE} shell confguration file as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX} before adapting it for MacPorts." /bin/cp -fp ${HOME}/.${CONF_FILE} "${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}" || { echo "An attempt to backup your original configuration file failed! Please set your MacPorts compatible environment manually." @@ -117,7 +117,7 @@ # Delete the old registry1.0 directory function delete_reg1 { - if [ -d ${REG1DIR} ]; then + if [[ -d ${REG1DIR} ]]; then rm -vrf ${REG1DIR} fi } @@ -125,10 +125,10 @@ # link macports1.0 into tcl package dir if possible function link_tcl_package { # delete old directory if present - if ! test -L "${TCL_PACKAGE_DIR}/macports1.0" && test -d "${TCL_PACKAGE_DIR}/macports1.0"; then + if [[ ! -L "${TCL_PACKAGE_DIR}/macports1.0" ]] && [[ -d "${TCL_PACKAGE_DIR}/macports1.0" ]]; then rm -vrf "${TCL_PACKAGE_DIR}/macports1.0" || true fi - if ! test -e "${TCL_PACKAGE_DIR}/macports1.0" && test -w "${TCL_PACKAGE_DIR}"; then + if [[ ! -e "${TCL_PACKAGE_DIR}/macports1.0" ]] && [[ -w "${TCL_PACKAGE_DIR}" ]]; then ln -vs "${MACPORTS_TCL_DIR}/macports1.0" "${TCL_PACKAGE_DIR}/macports1.0" || true fi } @@ -136,23 +136,18 @@ # create the user to use for privilege dropping function create_run_user { DSEDITGROUP=/usr/sbin/dseditgroup - if test -n "${DSCL}" -a -n "${DSEDITGROUP}" ; then - if ! ${DSEDITGROUP} -q -o read ${RUNUSR} > /dev/null 2>&1 ; then - echo "Creating group \"${RUNUSR}\"" - ${DSEDITGROUP} -q -o create -n . ${RUNUSR} - fi - if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then - echo "Creating user \"${RUNUSR}\"" - ${DSCL} -q . -create /Users/${RUNUSR} Password * - ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $(($(${DSCL} . -list /Users UniqueID | /usr/bin/awk '{print $2}' | sort -ug | tail -1)+1)) - ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $2}') - ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory /dev/null - ${DSCL} -q . -create /Users/${RUNUSR} UserShell /usr/bin/false - fi - else - echo "Can't find ${DSCL} / ${DSEDITGROUP}, unable to create user \"${RUNUSR}\"" - exit 1 + if ! ${DSEDITGROUP} -q -o read ${RUNUSR} > /dev/null 2>&1 ; then + echo "Creating group \"${RUNUSR}\"" + ${DSEDITGROUP} -q -o create -n . ${RUNUSR} fi + if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then + echo "Creating user \"${RUNUSR}\"" + ${DSCL} -q . -create /Users/${RUNUSR} Password * + ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $(($(${DSCL} . -list /Users UniqueID | /usr/bin/awk '{print $2}' | sort -ug | tail -1)+1)) + ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $2}') + ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory /dev/null + ${DSCL} -q . -create /Users/${RUNUSR} UserShell /usr/bin/false + fi } echo "The MacPorts Project, postflight script version ${VERSION}: checking the shell environment for user \"${USER}\"." @@ -179,9 +174,9 @@ LOGIN_FLAG="" ENV_COMMAND="setenv" ASSIGN=" " - if [ -f ${HOME}/.tcshrc ]; then + if [[ -f ${HOME}/.tcshrc ]]; then CONF_FILE=tcshrc - elif [ -f ${HOME}/.cshrc ]; then + elif [[ -f ${HOME}/.cshrc ]]; then CONF_FILE=cshrc else CONF_FILE=tcshrc @@ -192,9 +187,9 @@ LOGIN_FLAG="-l" ENV_COMMAND="export" ASSIGN="=" - if [ -f ${HOME}/.bash_profile ]; then + if [[ -f ${HOME}/.bash_profile ]]; then CONF_FILE=bash_profile - elif [ -f ${HOME}/.bash_login ]; then + elif [[ -f ${HOME}/.bash_login ]]; then CONF_FILE=bash_login else CONF_FILE=profile @@ -220,15 +215,15 @@ # Adding our setting to the MANPATH variable only if it exists: if ! ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \ # and following that, if it's not empty: - [ -z "${ORIGINAL_MANPATH}" ] || \ + [[ -z "${ORIGINAL_MANPATH}" ]] || \ # or if it doesn't already contain our path: 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: - [ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $1}')" ] || \ + [[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $1}')" ]] || \ # or at the end of it: - [ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $NF}')" ]; then + [[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $NF}')" ]]; then echo "Your shell already has the right MANPATH environment variable for use with MacPorts!" else write_setting MANPATH "${MANPAGES}:\$MANPATH" Property changes on: branches/release_2_0/base/portmgr/fedora/macports.spec ___________________________________________________________________ Modified: svn:mergeinfo - /branches/gsoc08-privileges/base/portmgr/fedora/macports.spec:37343-46937 /branches/universal-sanity/base/portmgr/fedora/macports.spec:51872-52323 /branches/variant-descs-14482/base/portmgr/fedora/macports.spec:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/portmgr/fedora/macports.spec:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 /trunk/base/portmgr/fedora/macports.spec.in:30388-57826 /users/perry/base-bugs_and_notes/portmgr/fedora/macports.spec:45682-46060 /users/perry/base-select/portmgr/fedora/macports.spec:44044-44692 + /branches/gsoc08-privileges/base/portmgr/fedora/macports.spec:37343-46937 /branches/universal-sanity/base/portmgr/fedora/macports.spec:51872-52323 /branches/variant-descs-14482/base/portmgr/fedora/macports.spec:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/portmgr/fedora/macports.spec:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 /trunk/base/portmgr/fedora/macports.spec.in:30388-57826 /users/perry/base-bugs_and_notes/portmgr/fedora/macports.spec:45682-46060 /users/perry/base-select/portmgr/fedora/macports.spec:44044-44692 Property changes on: branches/release_2_0/base/src/pextlib1.0/sha2.c ___________________________________________________________________ Modified: svn:mergeinfo - /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.c:37343-46937 /branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha2.c:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 /users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060 /users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692 + /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.c:37343-46937 /branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha2.c:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 /users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060 /users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692 Property changes on: branches/release_2_0/base/src/pextlib1.0/sha2.h ___________________________________________________________________ Modified: svn:mergeinfo - /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.h:37343-46937 /branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha2.h:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 /users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060 /users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692 + /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.h:37343-46937 /branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha2.h:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 /users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060 /users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692 Property changes on: branches/release_2_0/base/src/pextlib1.0/sha256cmd.c ___________________________________________________________________ Modified: svn:mergeinfo - /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937 /branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371 /branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha256cmd.c:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 /users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060 /users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692 + /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937 /branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371 /branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha256cmd.c:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 /users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060 /users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692 Property changes on: branches/release_2_0/base/src/pextlib1.0/sha256cmd.h ___________________________________________________________________ Modified: svn:mergeinfo - /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937 /branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371 /branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha256cmd.h:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 /users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060 /users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692 + /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937 /branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371 /branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323 /branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/pextlib1.0/sha256cmd.h:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 /users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060 /users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692 Property changes on: branches/release_2_0/base/src/registry2.0/receipt_sqlite.tcl ___________________________________________________________________ Modified: svn:mergeinfo - /branches/gsoc08-privileges/base/src/registry1.0/receipt_sqlite.tcl:37343-46937 /branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371 /branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323 /branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/registry2.0/receipt_sqlite.tcl:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692 /users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060 /users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692 + /branches/gsoc08-privileges/base/src/registry1.0/receipt_sqlite.tcl:37343-46937 /branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371 /branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323 /branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659 /trunk/base/src/registry2.0/receipt_sqlite.tcl:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750 /users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060 /users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692