Index: usr.sbin/freebsd-update/freebsd-update.sh =================================================================== --- usr.sbin/freebsd-update/freebsd-update.sh +++ usr.sbin/freebsd-update/freebsd-update.sh @@ -1215,6 +1215,15 @@ touch tINDEX.present } +# Fetch compare upstream tag (tag.new) to tag on disk +fetch_compare_new_tag_to_current_tag () { + if [ -f tag.new -a -f tag ] && cmp -s tag.new tag; then + return 0 + else + return 1 + fi +} + # Check that we have a public key with an appropriate hash, or # fetch the key if it doesn't exist. Returns 1 if the key has # not yet been fetched. @@ -2200,6 +2209,14 @@ done fetch_tagsanity || return 1 + # If there are no updates upstream there is no need for further + # processing (except forced fetch). + if [ $FORCEFETCH -eq 0 ] && fetch_compare_new_tag_to_current_tag; then + echo "No updates are available to fetch." + rm -f tag.new + return 0 + fi + # Fetch the latest INDEX-NEW and INDEX-OLD files. fetch_metadata INDEX-NEW INDEX-OLD || return 1 @@ -3395,7 +3412,7 @@ TMPFILE=`mktemp /tmp/freebsd-update.XXXXXX` || exit 1 finalize_components_config ${COMPONENTS} >> ${TMPFILE} if ! fetch_run >> ${TMPFILE} || - ! grep -q "No updates needed" ${TMPFILE} || + ! grep -q -E "(^No updates are available to fetch\.$|No updates needed)" ${TMPFILE} || [ ${VERBOSELEVEL} = "debug" ]; then mail -s "`hostname` security updates" ${MAILTO} < ${TMPFILE} fi