mirror of
https://abf.rosa.ru/djam/auto-krokodil.git
synced 2025-02-23 18:42:58 +00:00
Do not suggest to install a proprietary driver if there is another GPU supported only by Nouveau (e.g. an old one)
This commit is contained in:
parent
8758add5fc
commit
26d46613ec
1 changed files with 6 additions and 19 deletions
25
kroko-cli.sh
25
kroko-cli.sh
|
@ -8,6 +8,7 @@ set -o pipefail
|
|||
# 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108 [GeForce GT 440] [10de:0de0] (rev a1)
|
||||
|
||||
# constants
|
||||
readonly EXIT_GENERICERROR=1
|
||||
readonly EXIT_ENODRIVER=10
|
||||
readonly EXIT_ENOGPU=20
|
||||
readonly EXIT_ENOCOMMONDRIVER=30
|
||||
|
@ -218,7 +219,7 @@ _cli_get_gpus(){
|
|||
arch="$(rpm -E "%_arch")"
|
||||
if [ -z "$arch" ]; then
|
||||
_echo_err "Error getting architecture of the host machine"
|
||||
return 1
|
||||
return $EXIT_GENERICERROR
|
||||
fi
|
||||
local big_file
|
||||
big_file="$(_mktemp)"
|
||||
|
@ -230,7 +231,6 @@ _cli_get_gpus(){
|
|||
_echo_err "No NVIDIA GPUs found"
|
||||
return $EXIT_ENOGPU
|
||||
fi
|
||||
local r=""
|
||||
while read -r line
|
||||
do
|
||||
local device_id
|
||||
|
@ -243,35 +243,22 @@ _cli_get_gpus(){
|
|||
human_name="$(_line2name "$line")"
|
||||
if [ -z "$human_name" ]; then
|
||||
_echo_err "Error converting to human readable name"
|
||||
return 1
|
||||
return $EXIT_GENERICERROR
|
||||
fi
|
||||
local available_drivers
|
||||
available_drivers="$(_get_available_drivers "$device_id" "$KROKO_TMPDIR")"
|
||||
if [ -z "$available_drivers" ]; then
|
||||
_echo_err "No drivers found for device $device_id"
|
||||
continue
|
||||
return $EXIT_ENODRIVER
|
||||
fi
|
||||
local best_driver
|
||||
best_driver="$(_get_best_driver "$device_id" "$KROKO_TMPDIR")"
|
||||
if [ -z "$best_driver" ]; then
|
||||
_echo_err "Error getting the best driver"
|
||||
continue
|
||||
fi
|
||||
local e
|
||||
e="${line};${device_id};${human_name};${available_drivers};${best_driver}"
|
||||
if [ -z "$r" ]
|
||||
then
|
||||
r="$e"
|
||||
else
|
||||
# https://stackoverflow.com/a/9139891
|
||||
r="$r"$'\n'"$e"
|
||||
return $EXIT_GENERICERROR
|
||||
fi
|
||||
echo "${line};${device_id};${human_name};${available_drivers};${best_driver}"
|
||||
done <<< "$o"
|
||||
# if nothing found for any of the GPUs
|
||||
if [ -z "$r" ]; then
|
||||
return $EXIT_ENODRIVER
|
||||
fi
|
||||
echo "$r"
|
||||
}
|
||||
|
||||
# If there are multiple GPUs, select a driver which will fit all of them
|
||||
|
|
Loading…
Add table
Reference in a new issue