install_NEO_OCL_driver: Added checking of installed packages before trying to remove them. Added quotes for echo. (#2351)

This commit is contained in:
Artyom Anokhov 2020-09-21 17:35:49 +03:00 committed by GitHub
parent 9af49a7f95
commit 5e4cd10568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,12 +182,18 @@ _uninstall_user_mode_ubuntu()
"intel-igc-opencl")
for package in "${PACKAGES[@]}"; do
apt remove -y $package
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
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
}
@ -392,6 +398,7 @@ check_current_driver()
install()
{
uninstall_user_mode
install_prerequisites
download_packages