<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[118017] trunk/base</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/118017">118017</a></dd>
<dt>Author</dt> <dd>jmr@macports.org</dd>
<dt>Date</dt> <dd>2014-03-19 06:47:16 -0700 (Wed, 19 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>set TCLSH in postflight from autoconf</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbaseconfigure">trunk/base/configure</a></li>
<li><a href="#trunkbaseconfigureac">trunk/base/configure.ac</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkbaseportmgrdmgpostflightin">trunk/base/portmgr/dmg/postflight.in</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkbaseportmgrdmgpostflight">trunk/base/portmgr/dmg/postflight</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunkbaseportmgrdmg">trunk/base/portmgr/dmg/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbaseconfigure"></a>
<div class="modfile"><h4>Modified: trunk/base/configure (118016 => 118017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/configure        2014-03-19 13:17:39 UTC (rev 118016)
+++ trunk/base/configure        2014-03-19 13:47:16 UTC (rev 118017)
</span><span class="lines">@@ -10591,7 +10591,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> # Output
</span><del>-ac_config_files=&quot;$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile setupenv.bash src/Makefile src/cflib1.0/Makefile src/cregistry/Makefile src/darwintracelib1.0/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_fastload.tcl src/macports1.0/macports_test_autoconf.tcl src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile vendor/Makefile&quot;
</del><ins>+ac_config_files=&quot;$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile portmgr/dmg/postflight setupenv.bash src/Makefile src/cflib1.0/Makefile src/cregistry/Makefile src/darwintracelib1.0/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_fastload.tcl src/macports1.0/macports_test_autoconf.tcl src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile vendor/Makefile&quot;
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> ac_config_files=&quot;$ac_config_files src/pkg_mkindex.sh&quot;
</span><span class="lines">@@ -11299,6 +11299,7 @@
</span><span class="cx">     &quot;doc/prefix.mtree&quot;) CONFIG_FILES=&quot;$CONFIG_FILES doc/prefix.mtree&quot; ;;
</span><span class="cx">     &quot;doc/pubkeys.conf&quot;) CONFIG_FILES=&quot;$CONFIG_FILES doc/pubkeys.conf&quot; ;;
</span><span class="cx">     &quot;portmgr/freebsd/Makefile&quot;) CONFIG_FILES=&quot;$CONFIG_FILES portmgr/freebsd/Makefile&quot; ;;
</span><ins>+    &quot;portmgr/dmg/postflight&quot;) CONFIG_FILES=&quot;$CONFIG_FILES portmgr/dmg/postflight&quot; ;;
</ins><span class="cx">     &quot;setupenv.bash&quot;) CONFIG_FILES=&quot;$CONFIG_FILES setupenv.bash&quot; ;;
</span><span class="cx">     &quot;src/Makefile&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/Makefile&quot; ;;
</span><span class="cx">     &quot;src/cflib1.0/Makefile&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/cflib1.0/Makefile&quot; ;;
</span></span></pre></div>
<a id="trunkbaseconfigureac"></a>
<div class="modfile"><h4>Modified: trunk/base/configure.ac (118016 => 118017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/configure.ac        2014-03-19 13:17:39 UTC (rev 118016)
+++ trunk/base/configure.ac        2014-03-19 13:47:16 UTC (rev 118017)
</span><span class="lines">@@ -404,6 +404,7 @@
</span><span class="cx">         doc/prefix.mtree
</span><span class="cx">         doc/pubkeys.conf
</span><span class="cx">         portmgr/freebsd/Makefile
</span><ins>+        portmgr/dmg/postflight
</ins><span class="cx">         setupenv.bash
</span><span class="cx">         src/Makefile
</span><span class="cx">         src/cflib1.0/Makefile
</span></span></pre></div>
<a id="trunkbaseportmgrdmg"></a>
<div class="propset"><h4>Property changes: trunk/base/portmgr/dmg</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnignore"></a>
<div class="addfile"><h4>Added: svn:ignore</h4></div>
<a id="trunkbaseportmgrdmgpostflight"></a>
<div class="delfile"><h4>Deleted: trunk/base/portmgr/dmg/postflight (118016 => 118017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/portmgr/dmg/postflight        2014-03-19 13:17:39 UTC (rev 118016)
+++ trunk/base/portmgr/dmg/postflight        2014-03-19 13:47:16 UTC (rev 118017)
</span><span class="lines">@@ -1,281 +0,0 @@
</span><del>-#!/bin/bash
-# -*- coding: utf-8; mode: shell-script-mode; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=sh:et:sw=4:ts=4:sts=4
-#
-# Copyright (c) 2008-2012 The MacPorts Project
-# Copyright (c) 2002-2007 Juan Manuel Palacios &lt;jmpp@macports.org&gt;, The MacPorts Project.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. Neither the name of The MacPorts Project nor the
-#    names of its contributors may be used to endorse or promote products
-#    derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# postflight
-# $Id$
-
-
-#set -x
-
-# Script identification ('cause more often than not the svn Id is not expanded):
-VERSION=2.1.0
-
-# Abstraction variables:
-PREFIX=__PREFIX__
-BINPATH=${PREFIX}/bin
-SBINPATH=${PREFIX}/sbin
-CONFIGPATH=${PREFIX}/etc/macports
-MANPAGES=${PREFIX}/share/man
-MACPORTS_TCL_DIR=${PREFIX}/share/macports/Tcl
-REG1DIR=${MACPORTS_TCL_DIR}/registry1.0
-DSCL=/usr/bin/dscl
-RUNUSR=macports
-TCLSH=/usr/bin/tclsh
-TCL_PACKAGE_DIR=/Library/Tcl
-TIMESTAMP=$(date +&quot;%Y-%m-%d_at_%H:%M:%S&quot;)
-BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
-OUR_STRING=&quot;MacPorts Installer addition on ${TIMESTAMP}&quot;
-
-# Create config files from defaults if not present
-function setup_configs {
-    for f in archive_sites.conf macports.conf pubkeys.conf sources.conf variants.conf ; do
-        if [[ ! -f ${CONFIGPATH}/${f} ]]; then
-            echo &quot;Copying ${f}.default to ${f}&quot;
-            /bin/cp ${CONFIGPATH}/${f}.default ${CONFIGPATH}/${f}
-            /bin/chmod 644 ${CONFIGPATH}/${f}
-        fi
-    done
-}
-
-# Command to update the MacPorts installation through &quot;selfupdate&quot;:
-function update_macports {
-    SCRIPT_DIR=$(dirname $0)
-    # Add [default] tag to the central MacPorts repository, if it isn't already
-    echo &quot;Adding [default] tag to sources.conf if needed...&quot;
-    ${TCLSH} ${SCRIPT_DIR}/upgrade_sources_conf_default.tcl ${PREFIX}
-    # Convert image directories (and direct mode installs) to image archives
-    echo &quot;Updating port image format...&quot;
-    ${TCLSH} ${SCRIPT_DIR}/images_to_archives.tcl ${MACPORTS_TCL_DIR}
-    ${TCLSH} ${SCRIPT_DIR}/dedup_portfiles.tcl ${MACPORTS_TCL_DIR}
-
-    echo &quot;Synchronizing the MacPorts installation with the project's rsync server...&quot;
-    if ! ${BINPATH}/port -v selfupdate; then 
-        echo &quot;An attempt to synchronize your recent MacPorts installation with the project's rsync server failed!&quot;
-        echo &quot;Please run 'sudo port -d selfupdate' manually to find out the cause of the error.&quot;
-    else
-        echo &quot;Successful!&quot;
-    fi
-}
-
-# Through this command we write an environment variable to an appropriate shell configuration file,
-# 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 &quot;${HOME}/.${CONF_FILE}&quot; ]] &amp;&amp; ! grep &quot;${OUR_STRING}&quot; &quot;${HOME}/.${CONF_FILE}&quot; &gt; /dev/null; then
-        echo &quot;Backing up your ${HOME}/.${CONF_FILE} shell confguration file as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX} before adapting it for MacPorts.&quot;
-        /bin/cp -fp &quot;${HOME}/.${CONF_FILE}&quot; &quot;${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}&quot; || {
-            echo &quot;An attempt to backup your original configuration file failed! Please set your MacPorts compatible environment manually.&quot;
-            update_macports
-            exit 1
-        }
-        echo -e &quot;\n##\n# Your previous ${HOME}/.${CONF_FILE} file was backed up as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}\n##&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
-    fi
-    echo -e &quot;\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with MacPorts.&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
-    echo &quot;${ENV_COMMAND} ${1}${ASSIGN}${2}&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
-    echo -e &quot;# Finished adapting your ${1} environment variable for use with MacPorts.\n&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
-    chown ${USER} &quot;${HOME}/.${CONF_FILE}&quot; || echo &quot;Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!&quot;
-    echo &quot;An appropriate ${1} variable has been added to your shell environment by the MacPorts installer.&quot;
-}
-
-function cleanup_man () {
-    # Remove old non-compressed man pages
-    echo -e &quot;\nRemoving old man pages...&quot;
-    MAN1=&quot;port.1&quot;
-    MAN5=&quot;macports.conf.5&quot;
-    MAN7=&quot;portfile.7 portstyle.7 porthier.7 portgroup.7&quot;
-    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 &quot;Done.\n&quot;
-}
-
-# Delete the old registry1.0 directory
-function delete_reg1 {
-    if [[ -d ${REG1DIR} ]]; then
-        rm -vrf ${REG1DIR}
-    fi
-}
-
-# link macports1.0 into tcl package dir if possible
-function link_tcl_package {
-    # delete old directory if present
-    if [[ ! -L &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; ]]; then
-        if [[ ! -e &quot;${TCL_PACKAGE_DIR}&quot; ]]; then
-            /usr/bin/install -d &quot;${TCL_PACKAGE_DIR}&quot; || true
-        fi
-        if [[ -d &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; ]]; then
-            rm -vrf &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; || true
-        fi
-        if [[ ! -e &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; &amp;&amp; -d &quot;${TCL_PACKAGE_DIR}&quot; ]]; then
-            ln -vs &quot;${MACPORTS_TCL_DIR}/macports1.0&quot; &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; || true
-        fi
-        fi
-}
-
-# create the user to use for privilege dropping
-function create_run_user {
-    DSEDITGROUP=/usr/sbin/dseditgroup
-    if ! ${DSCL} -q . -read /Groups/${RUNUSR} &gt; /dev/null 2&gt;&amp;1 ; then
-        echo &quot;Creating group \&quot;${RUNUSR}\&quot;&quot;
-        ${DSEDITGROUP} -q -o create ${RUNUSR}
-    fi
-    if ! ${DSCL} -q . -list /Users/${RUNUSR} &gt; /dev/null 2&gt;&amp;1 ; then
-        echo &quot;Creating user \&quot;${RUNUSR}\&quot;&quot;
-        NEXTUID=501
-        while [[ -n &quot;`${DSCL} -q /Search -search /Users UniqueID $NEXTUID`&quot; ]]; do
-            let &quot;NEXTUID=NEXTUID+1&quot;
-        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 &amp; 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 [[ &quot;$(${DSCL} -q . -read /Users/${RUNUSR} PrimaryGroupID 2&gt;/dev/null | /usr/bin/awk '{print $2}')&quot; != &quot;$GID&quot; ]]; then
-            echo &quot;Fixing PrimaryGroupID for user \&quot;${RUNUSR}\&quot;&quot;
-            ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $GID
-            ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts
-        fi
-    fi
-    if [[ &quot;$(${DSCL} -q . -read /Users/${RUNUSR} NFSHomeDirectory)&quot; = &quot;NFSHomeDirectory: /var/empty&quot; ]]; then
-        echo &quot;Updating home directory location for user \&quot;${RUNUSR}\&quot;&quot;
-        ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory ${PREFIX}/var/macports/home
-    fi
-}
-
-echo &quot;The MacPorts Project, postflight script version ${VERSION}: checking the shell environment for user \&quot;${USER}\&quot;.&quot;
-
-# create macports user
-create_run_user
-# Set up config files
-setup_configs
-# link macports1.0 pkg
-link_tcl_package
-
-# Remove old stuff
-cleanup_man
-delete_reg1
-
-# 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}') || {
-    echo &quot;An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually.&quot;
-    update_macports
-    exit 1
-}
-case &quot;${USHELL}&quot; in
-    tcsh)
-        echo &quot;Detected the tcsh shell.&quot;
-        LOGIN_FLAG=&quot;&quot;
-        ENV_COMMAND=&quot;setenv&quot;
-        ASSIGN=&quot; &quot;
-        if [[ -f &quot;${HOME}/.tcshrc&quot; ]]; then
-            CONF_FILE=tcshrc
-        elif [[ -f &quot;${HOME}/.cshrc&quot; ]]; then
-            CONF_FILE=cshrc
-        else
-            CONF_FILE=tcshrc
-        fi
-        ;;
-    bash)
-        echo &quot;Detected the bash shell.&quot;
-        LOGIN_FLAG=&quot;-l&quot;
-        ENV_COMMAND=&quot;export&quot;
-        ASSIGN=&quot;=&quot;
-        if [[ -f &quot;${HOME}/.bash_profile&quot; ]]; then
-            CONF_FILE=bash_profile
-        elif [[ -f &quot;${HOME}/.bash_login&quot; ]]; then
-            CONF_FILE=bash_login
-        else
-            CONF_FILE=profile
-        fi
-        ;;
-    *)
-        echo &quot;Unknown shell ($USHELL)! Please set your MacPorts compatible environment manually.&quot;
-        update_macports
-        exit 0
-        ;;
-esac
-
-
-# Adding our setting to the PATH variable if not already there:
-if ${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/printenv PATH&quot; | grep ${PREFIX} &gt; /dev/null; then
-    echo &quot;Your shell already has the right PATH environment variable for use with MacPorts!&quot;
-else
-    write_setting PATH &quot;${BINPATH}:${SBINPATH}:\$PATH&quot;
-fi
-
-# We gather the path into a variable of our own for faster operation:
-ORIGINAL_MANPATH=&quot;$(${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/printenv MANPATH&quot;)&quot;
-# Adding our setting to the MANPATH variable only if it exists:
-if ! ${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/env | grep MANPATH&quot; &gt; /dev/null || \
-# and following that, if it's not empty:
-  [[ -z &quot;${ORIGINAL_MANPATH}&quot; ]] || \
-# or if it doesn't already contain our path:
-  echo &quot;${ORIGINAL_MANPATH}&quot; | grep ${MANPAGES} &gt; /dev/null || \
-# or if there's no empty component somewhere in the middle of it:
-  echo &quot;${ORIGINAL_MANPATH}&quot; | grep :: &gt; /dev/null || \
-# or at the start of it:
-  [[ -z &quot;$(echo &quot;${ORIGINAL_MANPATH}&quot; | awk -F : '{print $1}')&quot; ]] || \
-# or at the end of it:
-  [[ -z &quot;$(echo &quot;${ORIGINAL_MANPATH}&quot; | awk -F : '{print $NF}')&quot; ]]; then
-    echo &quot;Your shell already has the right MANPATH environment variable for use with MacPorts!&quot;
-else
-    write_setting MANPATH &quot;${MANPAGES}:\$MANPATH&quot;
-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}') &gt;= 5)) || ${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/env | grep DISPLAY&quot; &gt; /dev/null; then
-    echo &quot;Your shell already has the right DISPLAY environment variable for use with MacPorts!&quot;
-else
-    write_setting DISPLAY &quot;:0&quot;
-fi
-
-
-# Postflight script is done with its job, update MacPorts and exit gracefully!
-update_macports
-echo &quot;You have successfully installed the MacPorts system. Launch a terminal and try it out!&quot;
-echo &quot;Read the port(1) manual page and http://guide.macports.org/ for help.&quot;
-echo &quot;See http://www.macports.org/contact.php if you need to get in touch with The MacPorts Project.&quot;
-exit 0
</del></span></pre></div>
<a id="trunkbaseportmgrdmgpostflightinfromrev118016trunkbaseportmgrdmgpostflight"></a>
<div class="copfile"><h4>Copied: trunk/base/portmgr/dmg/postflight.in (from rev 118016, trunk/base/portmgr/dmg/postflight) (0 => 118017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/portmgr/dmg/postflight.in                                (rev 0)
+++ trunk/base/portmgr/dmg/postflight.in        2014-03-19 13:47:16 UTC (rev 118017)
</span><span class="lines">@@ -0,0 +1,281 @@
</span><ins>+#!/bin/bash
+# -*- coding: utf-8; mode: shell-script-mode; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=sh:et:sw=4:ts=4:sts=4
+#
+# Copyright (c) 2008-2012 The MacPorts Project
+# Copyright (c) 2002-2007 Juan Manuel Palacios &lt;jmpp@macports.org&gt;, The MacPorts Project.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of The MacPorts Project nor the
+#    names of its contributors may be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# postflight
+# $Id$
+
+
+#set -x
+
+# Script identification ('cause more often than not the svn Id is not expanded):
+VERSION=2.3.0
+
+# Abstraction variables:
+PREFIX=__PREFIX__
+BINPATH=${PREFIX}/bin
+SBINPATH=${PREFIX}/sbin
+CONFIGPATH=${PREFIX}/etc/macports
+MANPAGES=${PREFIX}/share/man
+MACPORTS_TCL_DIR=${PREFIX}/share/macports/Tcl
+REG1DIR=${MACPORTS_TCL_DIR}/registry1.0
+DSCL=/usr/bin/dscl
+RUNUSR=macports
+TCLSH=@TCLSH@
+TCL_PACKAGE_DIR=/Library/Tcl
+TIMESTAMP=$(date +&quot;%Y-%m-%d_at_%H:%M:%S&quot;)
+BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
+OUR_STRING=&quot;MacPorts Installer addition on ${TIMESTAMP}&quot;
+
+# Create config files from defaults if not present
+function setup_configs {
+    for f in archive_sites.conf macports.conf pubkeys.conf sources.conf variants.conf ; do
+        if [[ ! -f ${CONFIGPATH}/${f} ]]; then
+            echo &quot;Copying ${f}.default to ${f}&quot;
+            /bin/cp ${CONFIGPATH}/${f}.default ${CONFIGPATH}/${f}
+            /bin/chmod 644 ${CONFIGPATH}/${f}
+        fi
+    done
+}
+
+# Command to update the MacPorts installation through &quot;selfupdate&quot;:
+function update_macports {
+    SCRIPT_DIR=$(dirname $0)
+    # Add [default] tag to the central MacPorts repository, if it isn't already
+    echo &quot;Adding [default] tag to sources.conf if needed...&quot;
+    ${TCLSH} ${SCRIPT_DIR}/upgrade_sources_conf_default.tcl ${PREFIX}
+    # Convert image directories (and direct mode installs) to image archives
+    echo &quot;Updating port image format...&quot;
+    ${TCLSH} ${SCRIPT_DIR}/images_to_archives.tcl ${MACPORTS_TCL_DIR}
+    ${TCLSH} ${SCRIPT_DIR}/dedup_portfiles.tcl ${MACPORTS_TCL_DIR}
+
+    echo &quot;Synchronizing the MacPorts installation with the project's rsync server...&quot;
+    if ! ${BINPATH}/port -v selfupdate; then 
+        echo &quot;An attempt to synchronize your recent MacPorts installation with the project's rsync server failed!&quot;
+        echo &quot;Please run 'sudo port -d selfupdate' manually to find out the cause of the error.&quot;
+    else
+        echo &quot;Successful!&quot;
+    fi
+}
+
+# Through this command we write an environment variable to an appropriate shell configuration file,
+# 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 &quot;${HOME}/.${CONF_FILE}&quot; ]] &amp;&amp; ! grep &quot;${OUR_STRING}&quot; &quot;${HOME}/.${CONF_FILE}&quot; &gt; /dev/null; then
+        echo &quot;Backing up your ${HOME}/.${CONF_FILE} shell confguration file as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX} before adapting it for MacPorts.&quot;
+        /bin/cp -fp &quot;${HOME}/.${CONF_FILE}&quot; &quot;${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}&quot; || {
+            echo &quot;An attempt to backup your original configuration file failed! Please set your MacPorts compatible environment manually.&quot;
+            update_macports
+            exit 1
+        }
+        echo -e &quot;\n##\n# Your previous ${HOME}/.${CONF_FILE} file was backed up as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}\n##&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
+    fi
+    echo -e &quot;\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with MacPorts.&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
+    echo &quot;${ENV_COMMAND} ${1}${ASSIGN}${2}&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
+    echo -e &quot;# Finished adapting your ${1} environment variable for use with MacPorts.\n&quot; &gt;&gt; &quot;${HOME}/.${CONF_FILE}&quot;
+    chown ${USER} &quot;${HOME}/.${CONF_FILE}&quot; || echo &quot;Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!&quot;
+    echo &quot;An appropriate ${1} variable has been added to your shell environment by the MacPorts installer.&quot;
+}
+
+function cleanup_man () {
+    # Remove old non-compressed man pages
+    echo -e &quot;\nRemoving old man pages...&quot;
+    MAN1=&quot;port.1&quot;
+    MAN5=&quot;macports.conf.5&quot;
+    MAN7=&quot;portfile.7 portstyle.7 porthier.7 portgroup.7&quot;
+    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 &quot;Done.\n&quot;
+}
+
+# Delete the old registry1.0 directory
+function delete_reg1 {
+    if [[ -d ${REG1DIR} ]]; then
+        rm -vrf ${REG1DIR}
+    fi
+}
+
+# link macports1.0 into tcl package dir if possible
+function link_tcl_package {
+    # delete old directory if present
+    if [[ ! -L &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; ]]; then
+        if [[ ! -e &quot;${TCL_PACKAGE_DIR}&quot; ]]; then
+            /usr/bin/install -d &quot;${TCL_PACKAGE_DIR}&quot; || true
+        fi
+        if [[ -d &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; ]]; then
+            rm -vrf &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; || true
+        fi
+        if [[ ! -e &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; &amp;&amp; -d &quot;${TCL_PACKAGE_DIR}&quot; ]]; then
+            ln -vs &quot;${MACPORTS_TCL_DIR}/macports1.0&quot; &quot;${TCL_PACKAGE_DIR}/macports1.0&quot; || true
+        fi
+        fi
+}
+
+# create the user to use for privilege dropping
+function create_run_user {
+    DSEDITGROUP=/usr/sbin/dseditgroup
+    if ! ${DSCL} -q . -read /Groups/${RUNUSR} &gt; /dev/null 2&gt;&amp;1 ; then
+        echo &quot;Creating group \&quot;${RUNUSR}\&quot;&quot;
+        ${DSEDITGROUP} -q -o create ${RUNUSR}
+    fi
+    if ! ${DSCL} -q . -list /Users/${RUNUSR} &gt; /dev/null 2&gt;&amp;1 ; then
+        echo &quot;Creating user \&quot;${RUNUSR}\&quot;&quot;
+        NEXTUID=501
+        while [[ -n &quot;`${DSCL} -q /Search -search /Users UniqueID $NEXTUID`&quot; ]]; do
+            let &quot;NEXTUID=NEXTUID+1&quot;
+        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 &amp; 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 [[ &quot;$(${DSCL} -q . -read /Users/${RUNUSR} PrimaryGroupID 2&gt;/dev/null | /usr/bin/awk '{print $2}')&quot; != &quot;$GID&quot; ]]; then
+            echo &quot;Fixing PrimaryGroupID for user \&quot;${RUNUSR}\&quot;&quot;
+            ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $GID
+            ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts
+        fi
+    fi
+    if [[ &quot;$(${DSCL} -q . -read /Users/${RUNUSR} NFSHomeDirectory)&quot; = &quot;NFSHomeDirectory: /var/empty&quot; ]]; then
+        echo &quot;Updating home directory location for user \&quot;${RUNUSR}\&quot;&quot;
+        ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory ${PREFIX}/var/macports/home
+    fi
+}
+
+echo &quot;The MacPorts Project, postflight script version ${VERSION}: checking the shell environment for user \&quot;${USER}\&quot;.&quot;
+
+# create macports user
+create_run_user
+# Set up config files
+setup_configs
+# link macports1.0 pkg
+link_tcl_package
+
+# Remove old stuff
+cleanup_man
+delete_reg1
+
+# 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}') || {
+    echo &quot;An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually.&quot;
+    update_macports
+    exit 1
+}
+case &quot;${USHELL}&quot; in
+    tcsh)
+        echo &quot;Detected the tcsh shell.&quot;
+        LOGIN_FLAG=&quot;&quot;
+        ENV_COMMAND=&quot;setenv&quot;
+        ASSIGN=&quot; &quot;
+        if [[ -f &quot;${HOME}/.tcshrc&quot; ]]; then
+            CONF_FILE=tcshrc
+        elif [[ -f &quot;${HOME}/.cshrc&quot; ]]; then
+            CONF_FILE=cshrc
+        else
+            CONF_FILE=tcshrc
+        fi
+        ;;
+    bash)
+        echo &quot;Detected the bash shell.&quot;
+        LOGIN_FLAG=&quot;-l&quot;
+        ENV_COMMAND=&quot;export&quot;
+        ASSIGN=&quot;=&quot;
+        if [[ -f &quot;${HOME}/.bash_profile&quot; ]]; then
+            CONF_FILE=bash_profile
+        elif [[ -f &quot;${HOME}/.bash_login&quot; ]]; then
+            CONF_FILE=bash_login
+        else
+            CONF_FILE=profile
+        fi
+        ;;
+    *)
+        echo &quot;Unknown shell ($USHELL)! Please set your MacPorts compatible environment manually.&quot;
+        update_macports
+        exit 0
+        ;;
+esac
+
+
+# Adding our setting to the PATH variable if not already there:
+if ${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/printenv PATH&quot; | grep ${PREFIX} &gt; /dev/null; then
+    echo &quot;Your shell already has the right PATH environment variable for use with MacPorts!&quot;
+else
+    write_setting PATH &quot;${BINPATH}:${SBINPATH}:\$PATH&quot;
+fi
+
+# We gather the path into a variable of our own for faster operation:
+ORIGINAL_MANPATH=&quot;$(${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/printenv MANPATH&quot;)&quot;
+# Adding our setting to the MANPATH variable only if it exists:
+if ! ${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/env | grep MANPATH&quot; &gt; /dev/null || \
+# and following that, if it's not empty:
+  [[ -z &quot;${ORIGINAL_MANPATH}&quot; ]] || \
+# or if it doesn't already contain our path:
+  echo &quot;${ORIGINAL_MANPATH}&quot; | grep ${MANPAGES} &gt; /dev/null || \
+# or if there's no empty component somewhere in the middle of it:
+  echo &quot;${ORIGINAL_MANPATH}&quot; | grep :: &gt; /dev/null || \
+# or at the start of it:
+  [[ -z &quot;$(echo &quot;${ORIGINAL_MANPATH}&quot; | awk -F : '{print $1}')&quot; ]] || \
+# or at the end of it:
+  [[ -z &quot;$(echo &quot;${ORIGINAL_MANPATH}&quot; | awk -F : '{print $NF}')&quot; ]]; then
+    echo &quot;Your shell already has the right MANPATH environment variable for use with MacPorts!&quot;
+else
+    write_setting MANPATH &quot;${MANPAGES}:\$MANPATH&quot;
+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}') &gt;= 5)) || ${SHELL} ${LOGIN_FLAG} -c &quot;/usr/bin/env | grep DISPLAY&quot; &gt; /dev/null; then
+    echo &quot;Your shell already has the right DISPLAY environment variable for use with MacPorts!&quot;
+else
+    write_setting DISPLAY &quot;:0&quot;
+fi
+
+
+# Postflight script is done with its job, update MacPorts and exit gracefully!
+update_macports
+echo &quot;You have successfully installed the MacPorts system. Launch a terminal and try it out!&quot;
+echo &quot;Read the port(1) manual page and http://guide.macports.org/ for help.&quot;
+echo &quot;See http://www.macports.org/contact.php if you need to get in touch with The MacPorts Project.&quot;
+exit 0
</ins></span></pre>
</div>
</div>

</body>
</html>