Skip to content

Commit

Permalink
Merge pull request #152 from slaclab/comp_and_load_drivers-RHEL7
Browse files Browse the repository at this point in the history
updating comp_and_load_drivers.sh to case on distro to determine the CC
  • Loading branch information
ruck314 authored Jul 11, 2024
2 parents 8970397 + 82f04bb commit cdf40e1
Showing 1 changed file with 20 additions and 3 deletions.
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

0 comments on commit cdf40e1

Please sign in to comment.