From 02da9ad3183917edc7c7b8f81316b6960cfb4cee Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 3 Aug 2024 11:03:14 +0300 Subject: [PATCH] [eos-bash-shared] minor cleanups for eos-update and eos-kernel-nvidia-update-check --- eos-kernel-nvidia-update-check | 9 ++++++--- eos-update | 7 +++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/eos-kernel-nvidia-update-check b/eos-kernel-nvidia-update-check index 16ffeb0..73f789f 100755 --- a/eos-kernel-nvidia-update-check +++ b/eos-kernel-nvidia-update-check @@ -19,8 +19,10 @@ ExitFail() { exit 1; } UpdatesInclude() { echo "$updates" | grep "^$1$" >/dev/null ; } IsInstalled() { expac -Q %n "$1" >/dev/null ; } DriverCheck() { - if UpdatesInclude "$1" && IsInstalled "$2" && ! UpdatesInclude "$2" ; then - msgs+=("updates include $1 but not $2") + local -r linux="$1" + local -r nvidia="$2" + if UpdatesInclude "$linux" && IsInstalled "$nvidia" && ! UpdatesInclude "$nvidia" ; then + msgs+=("updates include $linux but not $nvidia") fi } @@ -43,6 +45,8 @@ Parameters() { } Main() { + expac %n nvidia nvidia-lts >/dev/null || exit 0 # nothing to do + local -r progname=${0##*/} local RED=$'\e[0;91m' local RESET=$'\e[0m' @@ -50,7 +54,6 @@ Main() { local updates="" # will contain all updates, separated by newline; see Parameters() local msgs=() - expac %n nvidia nvidia-lts >/dev/null || exit 0 # nothing to do echo ":: Nvidia check..." >&2 Parameters "$@" diff --git a/eos-update b/eos-update index 4a9d477..9451e1c 100755 --- a/eos-update +++ b/eos-update @@ -220,8 +220,8 @@ Options: for unsupported mirrors. This may be useful when one or more mirrors start failing unexpectedly. Note: only x86_64 hardware is supported. - --check-mirrors-eos Check files $eml for unsupported mirrors. - --check-mirrors-arch Check files $aml for unsupported mirrors. + --check-mirrors-eos Check file $eml for unsupported mirrors. + --check-mirrors-arch Check file $aml for unsupported mirrors. --nvidia Check also nvidia driver vs. kernel updates. Useful only with the Nvidia GPU. --clear-databases Clears package database files. Use this only if package database issues constantly make system update fail. @@ -294,7 +294,6 @@ Main() { local helper="pacman" local min_free_bytes=$((1000 * 1000 * 1000)) # default: 1 GB - local helper2=":" local lock=/var/lib/pacman/db.lck local rmopt=f @@ -330,7 +329,7 @@ Main() { sudo bash -c "rm -$rmopt $lock; [ -e $lock ] || { pacman -Sy && eos-update-extras ${subopts[*]} && pacman -Su && $sync ; }" else echo2green "Updating native and AUR apps..." - helper2="/usr/bin/sudo -u $LOGNAME $helper -Sua" + local helper2="/usr/bin/sudo -u $LOGNAME $helper -Sua" sudo bash -c "rm -$rmopt $lock; [ -e $lock ] || { pacman -Sy && eos-update-extras ${subopts[*]} && pacman -Su && $helper2 ; $sync ; }" fi }