add logic to wsl_cuda_fix.sh
This commit is contained in:
parent
630c628b93
commit
8f0dcc4f0f
@ -1,22 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check libraries
|
||||
ldconfig
|
||||
# Capture output and errors from ldconfig (refresh shared library cache)
|
||||
output=$(sudo ldconfig 2>&1)
|
||||
echo "ldconfig output: $output"
|
||||
|
||||
# Backup files in WSL lib
|
||||
cd /usr/lib/wsl/lib/
|
||||
cp libcuda.so libcuda.so.backup
|
||||
cp libcuda.so.1 libcuda.so.1.backup
|
||||
|
||||
# Delete wrong files
|
||||
rm -r libcuda.so
|
||||
rm -r libcuda.so.1
|
||||
|
||||
# Create symbolic links
|
||||
ln -s libcuda.so.1.1 libcuda.so
|
||||
ln -s libcuda.so.1.1 libcuda.so.1
|
||||
|
||||
# Check libraries again
|
||||
ldconfig
|
||||
|
||||
echo "Fixed"
|
||||
# Check the output
|
||||
if [ -n "$output" ]; then # -n checks if the string is not empty
|
||||
# If output is not empty, proceed with the original steps
|
||||
|
||||
# Navigate to the directory
|
||||
cd /usr/lib/wsl/lib/
|
||||
|
||||
# Backup existing files
|
||||
echo "Creating backups..."
|
||||
sudo cp libcuda.so libcuda.so.backup
|
||||
sudo cp libcuda.so.1 libcuda.so.1.backup
|
||||
|
||||
# Remove the original files
|
||||
echo "Removing original files..."
|
||||
sudo rm libcuda.so
|
||||
sudo rm libcuda.so.1
|
||||
|
||||
# Create symbolic links
|
||||
echo "Creating symbolic links..."
|
||||
sudo ln -s libcuda.so.1.1 libcuda.so
|
||||
sudo ln -s libcuda.so.1.1 libcuda.so.1
|
||||
|
||||
# Refresh shared library cache
|
||||
echo "Refreshing shared library cache..."
|
||||
sudo ldconfig
|
||||
|
||||
# Confirmation message
|
||||
echo "Fixed and updated. Backup files have been created."
|
||||
else
|
||||
echo "No need to fix. ldconfig output is empty."
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user