From fa5e7cc8608236be14afdb6e67bf5606f2721a3f Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Sat, 19 Nov 2022 00:46:45 +0900 Subject: [PATCH] Update 90-footer --- Linux_reinstall/updatemotd/90-footer | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Linux_reinstall/updatemotd/90-footer b/Linux_reinstall/updatemotd/90-footer index 4a69cc7..014f44a 100644 --- a/Linux_reinstall/updatemotd/90-footer +++ b/Linux_reinstall/updatemotd/90-footer @@ -6,11 +6,10 @@ UpdateLog="/var/log/packagesupdatefile.log" if [ -f "$UpdateLog" ]; then rm -rf $UpdateLog fi -apt-get update -apt list --upgradable | awk 'END{print NR}' | tee -a "$UpdateLog" > /dev/null 2>&1 +apt update | tee -a "$UpdateLog" > /dev/null 2>&1 UpdateRemind=`cat $UpdateLog | tail -n 1` -Result=$(echo $UpdateRemind) -if [ "$Result" -ge "1" ]; then - printf "$UpdateRemind packages can be upgraded. Run 'apt list --upgradable' to see them.\n" +Result=$(echo $UpdateRemind | grep "*packages can be upgraded*") +if [ "$Result" != "" ]; then + printf "$UpdateRemind" fi rm -rf $UpdateLog