Skip to content

Commit

Permalink
[eos-bash-shared] minor cleanups for eos-update and eos-kernel-nvidia…
Browse files Browse the repository at this point in the history
…-update-check
  • Loading branch information
manuel-192 committed Aug 3, 2024
1 parent 39f2f12 commit 02da9ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 6 additions & 3 deletions eos-kernel-nvidia-update-check
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -43,14 +45,15 @@ 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'
local verbose=no
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 "$@"
Expand Down
7 changes: 3 additions & 4 deletions eos-update
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 02da9ad

Please sign in to comment.