From 830c608b6ce85d02756d1a7162508ac07001886c Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Thu, 17 Oct 2019 01:10:40 +0300 Subject: linux kernel version check fix --- sys.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'sys.sh') diff --git a/sys.sh b/sys.sh index 7c8973e..deb588d 100755 --- a/sys.sh +++ b/sys.sh @@ -1,6 +1,22 @@ #!/bin/bash -INSTALLED=$(cat /usr/lib/modules/extramodules-ARCH/version) +FONT="xos4 Terminus" + +function cuteol { + EOL=0 + + while read line; do + if test $EOL -eq 1; then + echo + fi + + echo -n "$line" + + EOL=1 + done +} + +INSTALLED=$(file /boot/vmlinuz-linux | grep -o "[0-9a-z.-]\+-ARCH") CURRENT=$(uname -r) KERNEL=$(echo $CURRENT | cut -d- -f1) @@ -18,13 +34,16 @@ if grep -q "^linux " <<<$UPDATES; then fi if test "$CURRENT" != "$INSTALLED"; then + echo $CURRENT $INSTALLED STATUS="$STATUS(-)" fi echo "sys: ${KERNEL}${STATUS}, upd: ${NUPDATES}" +echo -n "" if test -z "$UPDATES"; then - echo "no updates" + echo -n "no updates" else - echo "$UPDATES" + echo "$UPDATES" | column -t -o " " | sed 's,^\(linux\) ,\1 ,' | cuteol fi +echo "" -- cgit v1.2.3-70-g09d2