From 5e4cd105685b268db1c68ee85e5668c19b70b8bf Mon Sep 17 00:00:00 2001 From: Artyom Anokhov Date: Mon, 21 Sep 2020 17:35:49 +0300 Subject: [PATCH] install_NEO_OCL_driver: Added checking of installed packages before trying to remove them. Added quotes for echo. (#2351) --- .../install_dependencies/install_NEO_OCL_driver.sh | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/scripts/install_dependencies/install_NEO_OCL_driver.sh b/scripts/install_dependencies/install_NEO_OCL_driver.sh index bc35f8e..242e60f 100755 --- a/scripts/install_dependencies/install_NEO_OCL_driver.sh +++ b/scripts/install_dependencies/install_NEO_OCL_driver.sh @@ -158,13 +158,13 @@ _uninstall_user_mode_centos() echo "rpm -qa | grep $package" found_package=$(rpm -qa | grep $package) if [[ $? -eq 0 ]]; then - echo Found installed user-mode driver, performing uninstall... + echo "Found installed user-mode driver, performing uninstall..." cmd="rpm -e --nodeps ${found_package}" echo $cmd eval $cmd if [[ $? -ne 0 ]]; then - echo ERROR: failed to uninstall existing user-mode driver. >&2 - echo Please try again manually and run the script again. >&2 + echo "ERROR: failed to uninstall existing user-mode driver." >&2 + echo "Please try again manually and run the script again." >&2 exit $EXIT_FAILURE fi fi @@ -182,11 +182,17 @@ _uninstall_user_mode_ubuntu() "intel-igc-opencl") for package in "${PACKAGES[@]}"; do - apt remove -y $package - if [[ $? -ne 0 ]]; then - echo ERROR: failed to uninstall existing user-mode driver. >&2 - echo Please try again manually and run the script again. >&2 - exit $EXIT_FAILURE + found_package=$(dpkg-query -W -f='${binary:Package}\n' ${package}) + if [[ $? -eq 0 ]]; then + echo "Found installed user-mode driver, performing uninstall..." + cmd="apt-get autoremove -y $package" + echo $cmd + eval $cmd + if [[ $? -ne 0 ]]; then + echo "ERROR: failed to uninstall existing user-mode driver." >&2 + echo "Please try again manually and run the script again." >&2 + exit $EXIT_FAILURE + fi fi done } @@ -391,7 +397,8 @@ check_current_driver() } install() -{ +{ + uninstall_user_mode install_prerequisites download_packages -- 2.7.4