#!/bin/bash
cd /usr/lib
ver=$(echo nvidia-[0-9]*)
echo "=> Detected $ver"
cd $ver
icd=$(ls libnvidia-opencl.so.* | head -n1)
echo "=> OpenCL ICD: $icd"
echo "$icd" >/etc/OpenCL/vendors/nvidia.icd
echo "=> Moving NVidia OpenCL lib to backup"
mkdir -p backup    
for x in libOpenCL.so*; do
	echo "$x -> backup"
	mv -i $x backup
done
