todo comment
[distro-setup] / filesystem / usr / local / bin / myupgrade
index e5401dc836675ab54f9aafb31490ca5cf08ed7e7..7be700124f79cf8c50c741803d4d0ce0571ad315 100755 (executable)
@@ -38,16 +38,13 @@ myreboot() {
 }
 
 
-if [[ $HOSTNAME != "$MAIL_HOST" ]]; then
-  ksta=$(needrestart -b | sed -n 's/NEEDRESTART-KSTA: *//p');
-  case $ksta in
-    1) : ;;
-    [023]) myreboot ;;
-    *) err error: unknown kernel status ;;
-  esac
-fi
+# TODO: executed from cron, this doesnt sent an email when we reboot,
+# because rebooting from the script stops the ability to send email.
+# We should figure some workaround.
 
-# needsrestarts automatic restarts failed.
 if ! out=$(/sbin/needrestart -p 2>&1); then
   e "$out"
+  if [[ $HOSTNAME != "$MAIL_HOST" ]]; then
+    myreboot
+  fi
 fi