Skip to content

Commit

Permalink
Merge pull request #3 from llhuii/master
Browse files Browse the repository at this point in the history
Add redhat support
  • Loading branch information
back1860 authored Nov 28, 2018
2 parents 73bf984 + 784697d commit 35fb27b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions nvidia-gpu-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ NVIDIA_DRIVER_VERSION="${NVIDIA_DRIVER_VERSION:-384.111}"
get_release()
{
eval "$(sed 's/^[A-Za-z]/OS_&/' /etc/os-release)"
if test $OS_ID = rhel; then
# translate redhat into centos
OS_ID=centos
# get the major number of OS_VERSION_ID
OS_VERSION_ID=$(echo $OS_VERSION_ID | cut -d. -f1)
fi
}

pre_check()
Expand Down Expand Up @@ -198,12 +204,18 @@ install_devel_centos()
yum update -y
yum install -y kernel-devel kernel-headers
if [ ! -d $kernel_dir ] ; then
# ln -s $(ls /usr/src/kernels | head -n1) $kernel_dir
echo "kernel development not found for $KERNEL_VERSION"
echo "RUN this command below to upgrade your kernel:"
echo " yum update -y && yum install -y kernel-devel kernel-headers"
echo "And then reboot!"
exit 1
installed_version=$(rpm -q kernel-devel | sed s/kernel-devel-//)
echo "kernel development not found for $KERNEL_VERSION, found: $installed_version"
if test $(echo $installed_version | cut -d. -f1,2,3) = $(echo $KERNEL_VERSION | cut -d. -f1,2,3); then
echo "But the kernel version until the patch number is same."
echo "So try to use /usr/src/kernels/$installed_version as the kernel dir anyway."
ln -s /usr/src/kernels/$installed_version $kernel_dir
else
echo "RUN this command below to upgrade your kernel:"
echo " yum update -y && yum install -y kernel-devel kernel-headers"
echo "And then reboot!"
exit 1
fi
fi
else
mkdir -p /usr/src/kernels
Expand Down

0 comments on commit 35fb27b

Please sign in to comment.