Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating comp_and_load_drivers.sh to case on distro to determine the CC #152

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions data_gpu/driver/comp_and_load_drivers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,26 @@ if [ "$EUID" -ne 0 ]; then
exit 1
fi

# Get the gcc that kernel was built with
version_content=$(cat /proc/version)
CC=$(echo "$version_content" | grep -oP 'x86_64-linux-gnu-gcc-\d+')
# Determine the Linux distribution
if [ -f /etc/os-release ]; then
. /etc/os-release
distro=$ID
else
echo "Error: Cannot determine the Linux distribution." >&2
exit 1
fi

# Set the CC variable based on the distribution
if [ "$distro" == "ubuntu" ]; then
# Get the gcc that kernel was built with
version_content=$(cat /proc/version)
CC=$(echo "$version_content" | grep -oP 'x86_64-linux-gnu-gcc-\d+')
elif [ "$distro" == "rhel" ] || [ "$distro" == "rocky" ]; then
CC="x86_64-redhat-linux-gcc"
else
echo "Error: Unsupported Linux distribution." >&2
exit 1
fi
echo "CC: $CC"

# Define Nvidia path
Expand Down
Loading