#!/bin/bash

/sbin/modprobe nvidia-uvm

if [ "$?" -eq 0 ]; then
  # Find out the major device number used by the nvidia-uvm driver
  D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`

  if [ ! -e /dev/nvidia-uvm ]; then
    mknod -m 666 /dev/nvidia-uvm c $D 0
  fi
  if [ ! -e /dev/nvidia-uvm-tools ]; then
    mknod -m 666 /dev/nvidia-uvm-tools c $D 1
  fi
else
  exit 1
fi
