[26518] trunk/base/portmgr/dmg/preflight
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 27 07:09:46 PDT 2007
Revision: 26518
http://trac.macosforge.org/projects/macports/changeset/26518
Author: jmpp at macports.org
Date: 2007-06-27 07:09:45 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
The installer inside the dmg works on a default configured MacPorts intallation, and so should this script
(that means default paths, remove all variable abstractions except for $HOME).
Also prodive a license declaration and an initial explanation of the script's intent.
PS: Everything seems to be in place, but still haven't tested this script in real life, so more commits may still come.
Modified Paths:
--------------
trunk/base/portmgr/dmg/preflight
Modified: trunk/base/portmgr/dmg/preflight
===================================================================
--- trunk/base/portmgr/dmg/preflight 2007-06-27 08:33:45 UTC (rev 26517)
+++ trunk/base/portmgr/dmg/preflight 2007-06-27 14:09:45 UTC (rev 26518)
@@ -1,83 +1,122 @@
#!/bin/bash
+#
+# Copyright (c) 2007 Juan Manuel Palacios <jmpp at macports.org>, MacPorts Team.
+# 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 MacPorts Team 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 "AS IS"
+# 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.
+
+###
+# dp2mp-move upgrading facility for users installing MacPorts through the pkg installer in the dmg.
+# This script is meant to run as the preflight of the installer, to upgrade an existing MacPorts
+# installation to the MacPorts namespace in the same way the "upgrade" target in base/Makefile
+# does for users installing from source or selfupdate.
+# preflight
# $Id$
+###
-[ ! -d ${TCL_PACKAGE_DIR}/darwinports1.0 ] || rm -rf ${TCL_PACKAGE_DIR}/darwinports1.0
-[ ! -d ${datadir}/darwinports ] || rm -rf ${datadir}/darwinports
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+UPGRADECHECK=/opt/local/var/macports/.mprename
-[ ! -f ${sysconfdir}/ports/dp_version ] || rm -vf ${sysconfdir}/ports/dp_version
-[ ! -f ${prefix}/share/man/man5/ports.conf.5 ] || rm -vf ${prefix}/share/man/man5/ports.conf.5
+[ ! -d /Library/Tcl/darwinports1.0 ] || rm -rf /Library/Tcl/darwinports1.0
-[ ! -d ${sysconfdir}/ports ] || mv -v ${sysconfdir}/ports ${sysconfdir}/macports
+[ ! -d /opt/local/share/darwinports ] || rm -rf /opt/local/darwinports
-[ -d ${localstatedir}/macports ] || mkdir -vp ${localstatedir}/macports
+[ ! -f /opt/local/etc/ports/dp_version ] || rm -vf /opt/local/etc/ports/dp_version
+[ ! -f /opt/local/share/man/man5/ports.conf.5 ] || rm -vf /opt/local/share/man/man5/ports.conf.5
+
+[ ! -d /opt/local/etc/ports ] || mv -v /opt/local/etc/ports /opt/local/etc/macports
+
+[ -d /opt/local/var/macports ] || mkdir -vp /opt/local/var/macports
for dir in distfiles packages receipts software; do
- [ ! -d ${localstatedir}/db/dports/$${dir} ] || mv -v ${localstatedir}/db/dports/$${dir} ${localstatedir}/macports
+ [ ! -d /opt/local/var/db/dports/${dir} ] || mv -v /opt/local/var/db/dports/${dir} /opt/local/var/macports
done
-[ ! -d ${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ] || { mkdir -vp \
- ${localstatedir}/macports/sources/rsync.macports.org/release && mv -v \
- ${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ${localstatedir}/macports/sources/rsync.macports.org/release/ports ; }
+[ ! -d /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ] || { mkdir -vp \
+ /opt/local/var/macports/sources/rsync.macports.org/release && mv -v \
+ /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports /opt/local/var/macports/sources/rsync.macports.org/release/ports ; }
-for receipt in ${localstatedir}/macports/receipts/*/*/receipt.bz2 ; do
- [ ! \( -f $${receipt} -a ! -f $${receipt}.mpsaved \) ] || { cp -v $${receipt} $${receipt}.mpsaved && { \
- $(BZIP2) -q -dc $${receipt} | sed 's/db\/dports/macports/g' | $(BZIP2) -q -zf > $${receipt}.new ;
- } && mv -v $${receipt}.new $${receipt} ; \
+for receipt in /opt/local/var/macports/receipts/*/*/receipt.bz2 ; do
+ [ ! \( -f ${receipt} -a ! -f ${receipt}.mpsaved \) ] || { cp -v ${receipt} ${receipt}.mpsaved && { \
+ bzip2 -q -dc ${receipt} | sed 's/db\/dports/macports/g' | bzip2 -q -zf > ${receipt}.new ;
+ } && mv -v ${receipt}.new ${receipt} ; \
}; done
-[ ! \( -f ${sysconfdir}/macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || { \
- mv -v ${sysconfdir}/macports/ports.conf ${sysconfdir}/macports/macports.conf.mpsaved
- sed 's/etc\/ports/etc\/macports/g' ${sysconfdir}/macports/macports.conf.mpsaved > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed 's/db\/dports/macports/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed 's/darwinports/macports/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed 's/dpupdate1\/base/release\/base/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed '/^rsync_options/s/"\(.*\)"/\1/' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed 's/ --delete //' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed 's/ ports.conf(5)/ macports.conf(5)/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
- sed 's/[Dd]\(arwin\)\{0,1\}[Pp]\(orts\)\{0,1\}/MacPorts/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \
- mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf
+[ ! \( -f /opt/local/etc/macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || { \
+ mv -v /opt/local/etc/macports/ports.conf /opt/local/etc/macports/macports.conf.mpsaved
+ sed 's/etc\/ports/etc\/macports/g' /opt/local/etc/macports/macports.conf.mpsaved > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed 's/db\/dports/macports/g' /opt/local/etc/macports/macports.conf > /opt/local/etc//macports/macports.conf.tmp && \
+ mv -v /opt/local/etc//macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed 's/darwinports/macports/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed 's/dpupdate1\/base/release\/base/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed '/^rsync_options/s/"\(.*\)"/\1/' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed 's/ --delete //' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed 's/ ports.conf(5)/ macports.conf(5)/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
+ sed 's/[Dd]\(arwin\)\{0,1\}[Pp]\(orts\)\{0,1\}/MacPorts/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
+ mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
}
-[ ! \( -f ${sysconfdir}/macports/sources.conf -a ! -f ${UPGRADECHECK} \) ] || { \
- cp -v ${sysconfdir}/macports/sources.conf ${sysconfdir}/macports/sources.conf.mpsaved
- sed 's/darwinports/macports/g' ${sysconfdir}/macports/sources.conf > ${sysconfdir}/macports/sources.conf.tmp && \
- mv -v ${sysconfdir}/macports/sources.conf.tmp ${sysconfdir}/macports/sources.conf
- sed 's/dpupdate\/dports/release\/ports\//g' ${sysconfdir}/macports/sources.conf > ${sysconfdir}/macports/sources.conf.tmp && \
- mv -v ${sysconfdir}/macports/sources.conf.tmp ${sysconfdir}/macports/sources.conf
+[ ! \( -f /opt/local/etc/macports/sources.conf -a ! -f ${UPGRADECHECK} \) ] || { \
+ cp -v /opt/local/etc/macports/sources.conf /opt/local/etc/macports/sources.conf.mpsaved
+ sed 's/darwinports/macports/g' /opt/local/etc/macports/sources.conf > /opt/local/etc/macports/sources.conf.tmp && \
+ mv -v /opt/local/etc/macports/sources.conf.tmp /opt/local/etc/macports/sources.conf
+ sed 's/dpupdate\/dports/release\/ports\//g' /opt/local/etc/macports/sources.conf > /opt/local/etc/macports/sources.conf.tmp && \
+ mv -v /opt/local/etc/macports/sources.conf.tmp /opt/local/etc/macports/sources.conf
}
-[ ! \( -f $${HOME}/.macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || { \
- mv -v $${HOME}/.macports/ports.conf $${HOME}/.macports/macports.conf.mpsaved
- sed 's/etc\/ports/etc\/macports/g' $${HOME}/.macports/macports.conf.mpsaved > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed 's/db\/dports/macports/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed 's/darwinports/macports/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed 's/dpupdate1\/base/release\/base/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed '/^rsync_options/s/"\(.*\)"/\1/' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed 's/ --delete //' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed 's/ ports.conf(5)/ macports.conf(5)/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
- sed 's/[Dd]\(arwin\)\{0,1\}[Pp]\(orts\)\{0,1\}/MacPorts/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \
- mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf
+[ ! \( -f ${HOME}/.macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || { \
+ mv -v ${HOME}/.macports/ports.conf ${HOME}/.macports/macports.conf.mpsaved
+ sed 's/etc\/ports/etc\/macports/g' ${HOME}/.macports/macports.conf.mpsaved > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed 's/db\/dports/macports/g' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed 's/darwinports/macports/g' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed 's/dpupdate1\/base/release\/base/g' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed '/^rsync_options/s/"\(.*\)"/\1/' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed 's/ --delete //' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed 's/ ports.conf(5)/ macports.conf(5)/g' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
+ sed 's/[Dd]\(arwin\)\{0,1\}[Pp]\(orts\)\{0,1\}/MacPorts/g' ${HOME}/.macports/macports.conf > ${HOME}/.macports/macports.conf.tmp && \
+ mv -v ${HOME}/.macports/macports.conf.tmp ${HOME}/.macports/macports.conf
}
@[ -f ${UPGRADECHECK} ] || { echo ""; echo "MacPorts installation successfully upgraded from the old DarwinPorts namespace!"; echo "" \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070627/d5fafab8/attachment.html
More information about the macports-changes
mailing list