Changes between Version 79 and Version 80 of Migration


Ignore:
Timestamp:
Dec 15, 2014, 3:37:11 AM (9 years ago)
Author:
dave@…
Comment:

Use a single sudo, so only one password is required.

Legend:

Unmodified
Added
Removed
Modified
  • Migration

    v79 v80  
    2424    # If there is an argument, then don't preserve 'requested' flags.
    2525    function reinstallPorts() {
    26       dontPreserveRequestedFlags=$1
     26      local -r dontPreserveRequestedFlags=$1
     27      set -e
     28      # This will fail if xcode-select needs to be run.
     29      clang --version
    2730      # Save the list of installed ports.
    2831      port -qv installed > myports.txt
     
    3134        port echo requested | cut -d ' ' -f 1 > requested.txt
    3235      fi
    33       # Uninstall all installed ports.
    34       sudo port -f uninstall installed
    35       # Clean any partially-completed builds.
    36       sudo port clean all
    3736      # Download the restore_ports script.
    3837      curl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
    3938      chmod +x restore_ports.tcl
    40       # Change this if your installation is somewhere else.
    41       # (There should be a way to get the port command to report this.)
    42       MACPORTS_HOME=/opt/local
    43       # Execute the restore_ports script.
    44       sudo ./restore_ports.tcl -p $MACPORTS_HOME myports.txt
    45       if [[ ! $dontPreserveRequestedFlags ]] ; then
    46         sudo port unsetrequested installed
    47         < requested.txt xargs sudo port setrequested
    48       fi
     39      sudo bash << EOF
     40        # Start with the latest data.
     41        port selfupdate
     42        # Uninstall all installed ports.
     43        port -f uninstall installed
     44        # Clean any partially-completed builds.
     45        port clean all
     46        # Change this if your installation is somewhere else.
     47        # (There should be a way to get the port command to report this.)
     48        MACPORTS_HOME=/opt/local
     49        # Execute the restore_ports script.
     50        ./restore_ports.tcl -p $MACPORTS_HOME myports.txt
     51        if [[ ! $dontPreserveRequestedFlags ]] ; then
     52          port unsetrequested installed
     53          < requested.txt xargs port setrequested
     54        fi
     55      EOF
    4956    }
    5057    }}}