]> arthur.barton.de Git - homebrew-alex.git/blobdiff - cmd/brew-run
brew-run: Fix test for outdated packages
[homebrew-alex.git] / cmd / brew-run
index 7b9ccd61039280619cbd4d69f49ab9a01e077966..12df604fea0a5f114395f051ae0de5498b021452 100755 (executable)
@@ -18,8 +18,8 @@ unset dir ax_common ax_common_sourced
 ax_msg - "Updating Homebrew installation ..."
 brew update || ax_abort "Update failed!"
 
-outdated=$( brew outdated --quiet | wc -l | tr -d '\t ' )
-if [ $outdated -gt 0 ]; then
+outdated=$( brew outdated --verbose | grep -F -cv "pinned at" )
+if [ "$outdated" -gt 0 ]; then
        echo
        ax_msg - "$outdated formula outdated:"
        brew outdated --verbose || ax_abort "Failed to list outdated packages!"
@@ -27,6 +27,12 @@ if [ $outdated -gt 0 ]; then
 
        brew upgrade --cleanup || ax_abort "Upgrade failed!"
        echo
+
+       ax_msg - "Cleaning up ..."
+       brew cleanup --prune=2 || ax_abort "\"brew cleanup\" failed!"
+       brew prune || ax_abort "\"brew prune\" failed!"
+       echo
 else
        ax_msg 0 "Nothing outdated."
+       echo
 fi