#!/bin/bash

# Copyright (c) 2019-2022, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

set -e

case "$1" in
    configure)
        if [ -h /usr/local/cuda ]; then
            rm -f /usr/local/cuda
        fi
        if [ ! -e /usr/local/cuda ]; then
            ln -s /etc/alternatives/cuda /usr/local/cuda
        else
            cat <<EOM
WARNING: /usr/local/cuda already exists. Not creating symlink from
/usr/local/cuda to /etc/alternatives/cuda.
EOM
        fi
        ;;
esac

exit 0
