Added secondary kill to announceEmail
[clearscm.git] / bin / update-system
index 52c1260..79d3d1c 100755 (executable)
@@ -11,11 +11,21 @@ uptodate=$(grep -v "^Listing" $tmpfile | wc -l)
 
 if [ $uptodate -ne 0 ]; then
   cat $tmpfile >> $logfile && rm $tmpfile
-  
-  apt-get upgrade    -y >> /dev/null 2>&1
-  apt-get autoremove -y >> /dev/null 2>&1
 
-  echo "$(date): Updated $HOSTNAME" >> $logfile
+  apt-get upgrade -y >> $tmpfile
+
+  held_back=$(grep "kept back" $tmpfile | wc -l)
+
+  if [ $held_back -ne 0 ]; then
+    echo "$(date): $HOSTNAME not updated - packages held back" >> $logfile
+
+    cat $tmpfile >> $logfile && rm $tmpfile
+  else
+    rm $tmpfile
+    echo "$(date): Updated $HOSTNAME" >> $logfile
+  fi
+
+  apt-get autoremove -y >> /dev/null 2>&1
 else
   rm $tmpfile