[MacPorts] Migration modified

MacPorts noreply at macports.org
Sun Dec 14 19:37:13 PST 2014


Page "Migration" was changed by dave at yost.com
Diff URL: <https://trac.macports.org/wiki/Migration?action=diff&version=80>
Revision 80
Comment: Use a single sudo, so only one password is required.
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: Migration
=========================================================================
--- Migration (version: 79)
+++ Migration (version: 80)
@@ -23,29 +23,36 @@
     {{{
     # If there is an argument, then don't preserve 'requested' flags.
     function reinstallPorts() {
-      dontPreserveRequestedFlags=$1
+      local -r dontPreserveRequestedFlags=$1
+      set -e
+      # This will fail if xcode-select needs to be run.
+      clang --version
       # Save the list of installed ports.
       port -qv installed > myports.txt
       # Preserve the requested flags (optional).
       if [[ ! $dontPreserveRequestedFlags ]] ; then
         port echo requested | cut -d ' ' -f 1 > requested.txt
       fi
-      # Uninstall all installed ports.
-      sudo port -f uninstall installed
-      # Clean any partially-completed builds.
-      sudo port clean all
       # Download the restore_ports script.
       curl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
       chmod +x restore_ports.tcl
-      # Change this if your installation is somewhere else.
-      # (There should be a way to get the port command to report this.)
-      MACPORTS_HOME=/opt/local
-      # Execute the restore_ports script.
-      sudo ./restore_ports.tcl -p $MACPORTS_HOME myports.txt
-      if [[ ! $dontPreserveRequestedFlags ]] ; then
-        sudo port unsetrequested installed
-        < requested.txt xargs sudo port setrequested
-      fi
+      sudo bash << EOF
+        # Start with the latest data.
+        port selfupdate
+        # Uninstall all installed ports.
+        port -f uninstall installed
+        # Clean any partially-completed builds.
+        port clean all
+        # Change this if your installation is somewhere else.
+        # (There should be a way to get the port command to report this.)
+        MACPORTS_HOME=/opt/local
+        # Execute the restore_ports script.
+        ./restore_ports.tcl -p $MACPORTS_HOME myports.txt
+        if [[ ! $dontPreserveRequestedFlags ]] ; then
+          port unsetrequested installed
+          < requested.txt xargs port setrequested
+        fi
+      EOF
     }
     }}}
 
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/Migration>
MacPorts <https://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'Migration' page.
If it was not you, please report to .


More information about the macports-changes mailing list