Skip to content

Instantly share code, notes, and snippets.

@fracai
Created April 7, 2012 02:08
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save fracai/2324493 to your computer and use it in GitHub Desktop.
Save fracai/2324493 to your computer and use it in GitHub Desktop.
A script to update MacPorts, fetch outdated ports, compile them, remove the inactive duplicates, and then sign the archives.
#!/bin/sh
# update macports and list outdated software
HOST=$(hostname|sed "s/.local//")
/bin/echo "=== Update MacPorts" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port selfupdate --nosync 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== Update Portfiles" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port sync 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== List Outdated Ports" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port echo outdated 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== Clean Outdated Ports" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port clean outdated 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== Fetch Outdated Ports" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port -p fetch outdated 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== Upgrade Outdated Ports (port -p upgrade --enforce-variants outdated)" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port -p upgrade --enforce-variants outdated 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== List Inactive Duplicate Ports" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port echo actinact and inactive 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== Uninstall Inactive Duplicate Ports" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/opt/local/bin/port uninstall actinact and inactive 2>&1 | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== Sign Archives" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/usr/local/bin/portsign.sh | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo "=== Upgrade Done" | /opt/local/bin/gawk '{print strftime("%b %d %H:%M:%S"),"'${HOST}'",$0; fflush() }'
/bin/echo ""
/bin/echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment