-
Notifications
You must be signed in to change notification settings - Fork 0
/
deps.sh
executable file
·119 lines (94 loc) · 2.61 KB
/
deps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
#
#
#
option="${1}"
error(){
printf "\033[35mError\t\033[31m${1}\033[0m\n"
}
install(){
apt-get install nvidia-utils-455 --fix-missing -y
apt install cuda-nvcc-10-1 --fix-missing -y
apt-get install cuda-drivers-455 --fix-missing -y
apt install nvidia-cuda-toolkit --fix-missing -y
apt-get install cuda --fix-missing -y
apt-get install cuda-drivers --fix-missing -y
# Start NVIDIA Driver
prime-select nvidia
modprobe nvidia
# software-properties-gtk
}
uninstall(){
prime-select intel
apt-get remove gcc -y
apt-get remove g++ -y
apt-get remove nvidia-* -y
apt-get purge nvidia-* gcc* g++* -y
apt-get remove cuda* -y
apt-get remove nvidia-cuda-toolkit -y
apt-get purge nvidia-cuda-toolkit -y
apt autoremove -y
}
change_compiler(){
version=${1}
dir="/usr/bin"
prog=( 'gcc' 'g++' )
case $version in
8|9|10)
if [ ! -z "${version}" ];
then
for _prog in ${prog[*]}
do
if test -f "${dir}/${_prog}-${version}";
then
printf "Linking: ${dir}/${_prog}-${version} => ${dir}/${_prog}\n"
ln -f -s ${dir}/${_prog}-${version} ${dir}/${_prog}
else
error "Program ${dir}/${_prog}-${version} was not found or does not exist!"
fi
done
fi
;;
*) error "Missing or invalid target version for compiler." && [ ! -z "${version}" ] && error "Version $version is not available";;
esac
return 0
}
configure(){
if [ -f "blacklist-nouveau.conf" ];
then
cp -a -v "blacklist-nouveau.conf" "/etc/modprobe.d/"
update-initramfs -u
fi
}
help_menu(){
printf "\033[36mNvidia Quick Install Wrapper\033[0m\n"
printf "\033[1;2;33mPARAMETERS\033[0m\n"
printf "\033[1;2;35mSet the action\t\t\033[32maction\033[0m\n"
printf "\033[1;2;35mSet the target version\t\033[32mversion\033[0m\n"
printf "\n\033[1;2;33mACTIONS\033[0m\n"
printf "\033[1;2;35mInstall:\t\t\033[1;3;34mi, install\033[0m\n"
printf "\033[1;2;35mUninstall:\t\t\033[1;3;34mu, uninstall\033[0m\n"
printf "\033[1;2;35mChange Compilers:\t\033[1;3;34mc, cc, change-compiler\033[0m\n"
printf "\n\033[1;2;33m\nUSAGE:\033[0m\n"
printf "$0 --action=install # Will Install the nvidia version\n"
printf "$0 --action=unstall # Will Install the nvidia version\n"
printf "$0 --action=change-compiler --version=8 # Will Change the nvidia version\n"
exit 0
}
for arg in $@
do
case $arg in
--action=*) _action=$(echo $arg| cut -d'=' -f2);;
--version=*) _version=$(echo $arg| cut -d'=' -f2);;
-h|-help|--help) help_menu;;
esac
done
case $_action in
i|install)
install
configure
;;
u|uninstall) uninstall;;
c|cc|change-compiler) change_compiler "${_version}";;
esac
############### END OF SCRIPT ###############