commit 204472918ccefb71a3919d7e8f4caa3abfc5e5b1
parent 50b426b3e941ee6579f7b206d5439cc1b3007221
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Wed, 23 May 2018 17:19:51 +0200
Some more work on updatemaster
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/bin/updatemaster b/bin/updatemaster
@@ -5,20 +5,21 @@ if ! command -v notify &> /dev/null; then
     if command -v terminal-notifier &> /dev/null; then
         notify() { terminal-notifier -title "$1" -message "$2" -activate com.googlecode.iterm2; }
     else
+        echo "terminal-notifier not found, defaulting to bell. Install terminal-notifier to get the most out of this script."
         notify() { echo '\a'; }
     fi
 fi
 
 ### HOMEBREW ###
+echo "-- Homebrew update/upgrade."
 if command -v brew &> /dev/null; then
-    echo "Beginning Homebrew update/upgrade."
     brew update;
     brew update > /dev/null;
     outdated="$(brew outdated)"
     outdated_c="$(brew cask outdated --greedy)"
 
     # Potentially upgrade programs
-    if [ ${#outdated} = 1 ]; then
+    if [ ${#outdated} = 0 ]; then
         echo "No programs to update." 
     else
         echo "\nTo update:\n"
@@ -36,7 +37,7 @@ if command -v brew &> /dev/null; then
     fi
 
     # Potentially upgrade casks
-    if [ ${#outdated_c} = 1 ]; then
+    if [ ${#outdated_c} = 0 ]; then
         echo "No casks to update." 
     else
         echo "\nCasks to update:\n"
@@ -61,10 +62,12 @@ if command -v brew &> /dev/null; then
     brew missing;
     notify "Brewed." "All packages have been upgraded.";
 else
+    echo "brew not found."
     echo "Cannot upgrade Homebrew packages. Please do so manually."
 fi
 
 ### Mac App Store (MAS) ###
+echo "-- MAS update/upgrade."
 if command -v mas &> /dev/null; then
     echo "MAS outdated:"
     mas outdated
@@ -75,23 +78,27 @@ if command -v mas &> /dev/null; then
     if [ "$CONF" != "y" ]; then
         echo "\nCancelled mas upgrade."
     else
-        echo "\nContinuing with brew upgrade."
+        echo "\nContinuing with mas upgrade."
         mas upgrade;
     fi 
     notify "MAS Updated." "All apps at newest version."
 else
+    echo "mas not found. Install mas to update App Store apps on the command line."
     echo "Cannot update Mac App Store apps. Please do so manually."
 fi
 
 ### NPM ###
+echo "-- NPM update/upgrade."
 if command -v npm &> /dev/null; then
     npm update -g
     notify "NPM Update Finished" "See Terminal for info."
 else
+    echo "npm not found."
     echo "Cannot update NPM packages. Please do so manually."
 fi
 
 ### PIP3 ###
+echo "-- PIP3 update/upgrade."
 if command -v pip3 list &> /dev/null; then
     pip3 list --outdated | cut -d ' ' -f1 | xargs -n1 pip3 install -U
     notify "Pip3 Update Finished" "See Terminal for info."
@@ -100,6 +107,7 @@ else
 fi
 
 ### PIP ###
+echo "-- PIP update/upgrade."
 if command -v pip list &> /dev/null; then
     pip freeze — local | grep -v ‘^\-e’ | cut -d = -f 1 | xargs pip install -U
     notify "Pip Update Finished" "See Terminal for info."