From bb7fd0301a74837ce24818f1d7654791d876ace6 Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Sat, 2 Jan 2021 03:47:31 +0200 Subject: [PATCH] fix #353 --- patch-fbc.sh | 9 ++++----- patch.sh | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/patch-fbc.sh b/patch-fbc.sh index 5ca2173..acf88d8 100755 --- a/patch-fbc.sh +++ b/patch-fbc.sh @@ -173,16 +173,15 @@ patch_common () { echo "Using manually entered nvidia driver version: $driver_version" else cmd="$NVIDIA_SMI --query-gpu=driver_version --format=csv,noheader,nounits" - driver_versions_list=$($cmd) - ret_code=$? - driver_version=$(echo "$driver_versions_list" | head -n 1) - if [[ $ret_code -ne 0 ]] ; then + driver_versions_list=$($cmd) || ( + ret_code=$? echo "Can not detect nvidia driver version." echo "CMD: \"$cmd\"" echo "Result: \"$driver_versions_list\"" echo "nvidia-smi retcode: $ret_code" exit 1 - fi + ) + driver_version=$(echo "$driver_versions_list" | head -n 1) echo "Detected nvidia driver version: $driver_version" fi diff --git a/patch.sh b/patch.sh index 362785d..02777b8 100755 --- a/patch.sh +++ b/patch.sh @@ -246,16 +246,15 @@ patch_common () { echo "Using manually entered nvidia driver version: $driver_version" else cmd="$NVIDIA_SMI --query-gpu=driver_version --format=csv,noheader,nounits" - driver_versions_list=$($cmd) - ret_code=$? - driver_version=$(echo "$driver_versions_list" | head -n 1) - if [[ $ret_code -ne 0 ]] ; then + driver_versions_list=$($cmd) || ( + ret_code=$? echo "Can not detect nvidia driver version." echo "CMD: \"$cmd\"" echo "Result: \"$driver_versions_list\"" echo "nvidia-smi retcode: $ret_code" exit 1 - fi + ) + driver_version=$(echo "$driver_versions_list" | head -n 1) echo "Detected nvidia driver version: $driver_version" fi