This repository has been archived by the owner on May 31, 2022. It is now read-only.
forked from xulongwu4/nvidia-optimus-manager
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnvidia-optimus-installer.sh
122 lines (114 loc) · 3.03 KB
/
nvidia-optimus-installer.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
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
# Automated script to install nvidia-optimus-manager
# VARIABLES
####################################
LDM=/etc/lightdm/lightdm.conf.d # OLD DIRECTORY - USER CONFIRM
GDM=/etc/gdm
MOD=/etc/modprobe.d
BIN=/usr/bin
OPT=nvidia-optimus-manager
DIR=`pwd`
SYSD=nvidia-optimus-autoconfig.service
####################################
clear
echo ""
echo " -------------------------------------------"
echo ""
echo " NVIDIA-OPTIMUS-MANAGER INSTALLER"
echo ""
echo " -------------------------------------------"
echo ""
sleep 3
echo ""
clear
echo ""
echo "This script will install and autoconfigure"
echo "the Nvidia-Optimus-Manager for Solus Budgie,"
echo "MATE, or Gnome editions."
echo ""
echo "This WILL require a reboot, once completed"
echo ""
sleep 3
clear
# DESKTOP CHECKS & CONFIGURATION
if [ `echo $XDG_CURRENT_DESKTOP` = "GNOME" ]
then
echo ""
echo "Setting things up for Gnome..."
echo ""
sleep 2
sudo cp ${DIR}/99-nvidia.conf ${GDM}/99-nvidia.conf
sudo cp ${DIR}/${OPT} ${BIN}/${OPT}
sudo chmod a+x ${BIN}/${OPT}
sudo cp ${DIR}/${SYSD} /etc/systemd/system/${SYSD}
echo ""
sudo systemctl daemon-reload && sudo systemctl enable nvidia-optimus-autoconfig
echo ""
# SYSTEM PREP
echo ""
echo "Getting things ready..."
echo ""
sudo mkdir -p ${MOD}
echo "blacklist nouveau" | sudo tee ${MOD}/blacklist-nouveau.conf
echo ""
echo "Installing necessary applications..."
echo ""
sudo eopkg it pciutils
elif [ `echo $XDG_CURRENT_DESKTOP` = "MATE" ]
then
echo ""
echo "Setting things up for MATE..."
echo ""
sleep 2
sudo cp $DIR/99-nvidia.conf $GDM/99-nvidia.conf
sudo cp $DIR/$OPT $BIN/$OPT
sudo cp $DIR/$SYSD /etc/systemd/system/$SYSD
echo ""
sudo systemctl daemon-reload && sudo systemctl enable nvidia-optimus-autoconfig
echo ""
# SYSTEM PREP
echo ""
echo "Getting things ready..."
echo ""
sudo mkdir -p ${MOD}
echo "blacklist nouveau" | sudo tee ${MOD}/blacklist-nouveau.conf
echo ""
echo "Installing necessary applications..."
echo ""
sudo eopkg it pciutils
elif [ `echo $XDG_CURRENT_DESKTOP` = "Budgie:GNOME" ]
then
echo ""
echo "Setting things up for Budgie..."
echo ""
sleep 2
sudo cp ${DIR}/99-nvidia.conf ${GDM}/99-nvidia.conf
sudo cp ${DIR}/${OPT} ${BIN}/${OPT}
sudo chmod a+x ${BIN}/${OPT}
sudo cp ${DIR}/${SYSD} /etc/systemd/system/${SYSD}
echo ""
sudo systemctl daemon-reload && sudo systemctl enable nvidia-optimus-autoconfig
echo ""
# SYSTEM PREP
echo ""
echo "Getting things ready..."
echo ""
sudo mkdir -p ${MOD}
echo "blacklist nouveau" | sudo tee ${MOD}/blacklist-nouveau.conf
echo ""
echo "Installing necessary applications..."
echo ""
sudo eopkg it pciutils
fi
echo ""
echo " INSTALLATION COMPLETE!"
echo ""
echo " You will need to reboot to apply all changes."
echo ""
echo ""
read -p " Reboot now (y/n)?" choice
case "$choice" in
y|Y ) sudo reboot;;
n|N ) echo "Goodbye";;
esac
exit