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
1 changed files with 16 additions and 9 deletions

View File

@ -158,13 +158,13 @@ _uninstall_user_mode_centos()
echo "rpm -qa | grep $package" echo "rpm -qa | grep $package"
found_package=$(rpm -qa | grep $package) found_package=$(rpm -qa | grep $package)
if [[ $? -eq 0 ]]; then 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}" cmd="rpm -e --nodeps ${found_package}"
echo $cmd echo $cmd
eval $cmd eval $cmd
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo ERROR: failed to uninstall existing user-mode driver. >&2 echo "ERROR: failed to uninstall existing user-mode driver." >&2
echo Please try again manually and run the script again. >&2 echo "Please try again manually and run the script again." >&2
exit $EXIT_FAILURE exit $EXIT_FAILURE
fi fi
fi fi
@ -182,11 +182,17 @@ _uninstall_user_mode_ubuntu()
"intel-igc-opencl") "intel-igc-opencl")
for package in "${PACKAGES[@]}"; do for package in "${PACKAGES[@]}"; do
apt remove -y $package found_package=$(dpkg-query -W -f='${binary:Package}\n' ${package})
if [[ $? -ne 0 ]]; then if [[ $? -eq 0 ]]; then
echo ERROR: failed to uninstall existing user-mode driver. >&2 echo "Found installed user-mode driver, performing uninstall..."
echo Please try again manually and run the script again. >&2 cmd="apt-get autoremove -y $package"
exit $EXIT_FAILURE 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 fi
done done
} }
@ -391,7 +397,8 @@ check_current_driver()
} }
install() install()
{ {
uninstall_user_mode uninstall_user_mode
install_prerequisites install_prerequisites
download_packages download_packages