diff --git a/projects/clr/opencl/packaging/rocm-opencl.prerm b/projects/clr/opencl/packaging/rocm-opencl.prerm index 722d3e1aa4..927973f727 100644 --- a/projects/clr/opencl/packaging/rocm-opencl.prerm +++ b/projects/clr/opencl/packaging/rocm-opencl.prerm @@ -14,8 +14,12 @@ case "$1" in rm -f @ROCM_PATH@/lib/libOpenCL.so rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ - rmdir --ignore-fail-on-non-empty @ROCM_PATH@/lib - rmdir --ignore-fail-on-non-empty @ROCM_PATH@ + if [ -e "@ROCM_PATH@" ] ; then + if [ -e "@ROCM_PATH@/lib" ] ; then + rmdir --ignore-fail-on-non-empty @ROCM_PATH@/lib + fi + rmdir --ignore-fail-on-non-empty @ROCM_PATH@ + fi rm_ldconfig ;; *)