--- /dev/null
+#!/bin/bash
+#
+# This script gets ports from an overlay that need to be updated
+#
+# Note: Before execute this script you should be run 'ports -u' to be sure
+# you're up to date
+
+checkOverlayUpdates() {
+ overlay=$1
+ repo=${overlay/-arm*/}
+
+ if [ "$overlay" == "$repo" ]; then
+ echo "Error, $overlay is not a valid overlay"
+ exit 1
+ fi
+
+ # check for existing repo
+ case $repo in
+ core|opt|xorg|contrib) ;;
+ *) echo "Error, $repo is not a valid repo"; exit 1;;
+ esac
+
+ # obtain paths
+ overlay_path=$(grep 'destination' /etc/ports/$overlay.{rsync,httpup} 2>/dev/null | cut -d'=' -f2)
+ repo_path=$(grep 'destination' /etc/ports/$repo.{rsync,httpup} 2>/dev/null | cut -d'=' -f2)
+
+ # foreach overlayed port check for updates available
+ find $overlay_path -type f -name 'Pkgfile' -exec dirname {} \; | while read o_port; do
+ port=$repo_path/$(basename $o_port)
+ # get versions for both (port and o_port)
+ . $port/Pkgfile
+ port_version=$version-$release
+ . $o_port/Pkgfile
+ o_port_version=$version-$release
+ if [ "$port_version" != "$o_port_version" ]; then
+ printf "%-20s %10s %10s\n" $(basename $port) $o_port_version $port_version >> $TMP_FILE
+ fi
+ done
+
+ if [ "$(wc -l $TMP_FILE)" != "0" ]; then
+ printf "%-20s %10s %10s\n" "PORT" $overlay $repo
+ cat $TMP_FILE && : > $TMP_FILE
+ echo
+ fi
+}
+
+if [ $# -lt 1 ]; then
+ echo "Usage: $(basename $0) [repo_overlay]"
+ exit 1
+fi
+
+TMP_FILE=$(mktemp)
+
+for TARGET in $@; do
+ checkOverlayUpdates $TARGET
+done
+
+rm -f $TMP_FILE
+
+# End of file