-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
289 lines (276 loc) · 13.1 KB
/
install.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#!/bin/bash
menu(){
BLUE=`echo '\033[94m'`
GREEN=`echo '\033[92m'`
RED=`echo '\033[31m'`
YELLOW=`echo '\033[93m'`
REST=`echo "\033[m"`
echo -e "${GREEN} ++++++++++++++++++++++++++++++++++++++++++++++++++++ ${REST}"
echo -e "${GREEN} For Debian based, Arch and Manjaro Linux ${REST}"
echo -e "${GREEN} Not For UBUNTU Based....${REST}"
echo -e "${GREEN} ++++++++++++++++++++++++++++++++++++++++++++++++++++ ${REST}"
echo -e "${BLUE} 1) ${RED} GDM-Arch ${REST}"
echo -e "${BLUE} 2) ${RED} GDM-Debian ${REST}"
echo -e "${BLUE} 3) ${RED} GDM-Manjaro ${REST}"
echo -e "${BLUE} 4) ${RED} LIGHTDM-Arch ${REST}"
echo -e "${BLUE} 5) ${RED} LIGHTDM-Debian ${REST}"
echo -e "${BLUE} 6) ${RED} LIGHTDM-Manjaro ${REST}"
echo -e "${BLUE} 7) ${RED} SDDM-Arch ${REST}"
echo -e "${BLUE} 8) ${RED} SDDM-Debian ${REST}"
echo -e "${BLUE} 9) ${RED} SDDM-Manjaro ${REST}"
echo -e "${GREEN} +++++++++++++++++++++++++++++++++++++++++++++++++++ ${REST}"
echo -e " ${RED} << To Exit Press ENTER >> ${REST}"
read -p " Enter Your Choice:=> " opt
}
function gdm-arch(){
pacman -S nvidia nvidia-dkms nvidia-settings
mkdir /etc/pacman.d/hooks
mv nvidia.hook /etc/pacman.d/hooks
mv optimus.conf /etc/X11/xorg.conf.d/optimus.conf
echo "Remove auto generated nvidia Configuration file -->> Remove From /etc/modprobe.d/ and /etc/X11/xorg.conf.d/"
mv blacklist-nouveau /etc/modprobe.d/nvidia.conf
mv nvidia-drm.conf /etc/modprobe.d/nvidia-drm.conf
mv optimus.sh /usr/local/bin/optimus.sh
chmod a+rx /usr/local/bin/optimus.sh
mv optimus.desktop /usr/local/share/optimus.desktop
ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop
ln -s /usr/local/share/optimus.desktop /etc/xdg/autostart/optimus.desktop
whiptail --title "Change Required" --msgbox "Edit PCI value Accordingly before You proceed -->>> Edit /usr/local/bin/optimus.sh and add your system PCI value" 8 78
}
function gdm-debian(){
whiptail --title "Warning" --msgbox "Before Running this script Logout And Press Ctrl+Alt+F2 and run : systemctl stop gdm" 8 78
whiptail --title "Attention" --msgbox "After Running systemctl stop gdm. Got Black Screen Just Press Ctrl+Alt+F2 .... " 8 78
if (whiptail --title "Is GDM Stopped?" --yesno "If GDM is Stopped then press YES else NO" 8 78); then
apt install linux-headers-$(uname -r) nvidia-settings nvidia-driver nvidia-xconfig -Vy
mv nouveau /etc/modprobe.d/nvidia-blacklists-nouveau.conf
update-initramfs -u
clear
rmmod nouveau
lsmod | grep -i nouveau
modprobe nvidia-drm
mv xorg /etc/X11/xorg.conf
nvidia-xconfig --query-gpu-info | grep 'BusID : ' | cut -d ' ' -f6
mv optimus /usr/share/gdm/greeter/autostart/optimus.desktop
cp /usr/share/gdm/greeter/autostart/optimus.desktop /etc/xdg/autostart/optimus.desktop
echo " If You Can See Only PCI Value Then Do This:"
echo "Edit PCI value Accordingly before You proceed -->>> Edit /etc/X11/xorg.conf and add your system PCI value"
else
clear
echo "Run This Command Before you proceed : systemctl stop gdm "
fi
}
function gdm-manjaro(){
whiptail --title "Attention Required" --msgbox "Do uninstall and remove Old Nvidia Driver Packages and Settings" 8 78
if(whiptail --title "Are You Ready to proceed?" --yesno "If You are Ready to proceed then press YES else NO" 8 78); then
mhwd -i pci video-nvidia
mkdir /etc/pacman.d/hooks
mv nvidia.hook /etc/pacman.d/hooks
mv optimus.conf /etc/X11/xorg.conf.d/optimus.conf
whiptail --title "Change Required" --msgbox " Remove auto generated nvidia Configuration file -->> Remove From /etc/modprobe.d/ and /etc/X11/xorg.conf.d/" 8 78
mv blacklist-nouveau /etc/modprobe.d/nvidia.conf
mv nvidia-drm.conf /etc/modprobe.d/nvidia-drm.conf
mv optimus.sh /usr/local/bin/optimus.sh
chmod a+rx /usr/local/bin/optimus.sh
mv optimus.desktop /usr/local/share/optimus.desktop
ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop
ln -s /usr/local/share/optimus.desktop /etc/xdg/autostart/optimus.desktop
whiptail --title "Change Required" --msgbox "Edit PCI value Accordingly before You proceed -->>> Edit /usr/local/bin/optimus.sh and add your system PCI value" 8 78
else
clear
whiptail --title "Do It then run again" --msgbox "Remove all Previously Installed Nvidia Stuff" 8 78
fi
}
function lightdm-arch(){
pacman -S nvidia nvidia-dkms nvidia-settings
mkdir /etc/pacman.d/hooks
mv nvidia.hook /etc/pacman.d/hooks
mv optimus.conf /etc/X11/xorg.conf.d/optimus.conf
whiptail --title "Change Required" --msgbox " Remove auto generated nvidia Configuration file -->> Remove From /etc/modprobe.d/ and /etc/X11/xorg.conf.d/" 8 78
mv blacklist-nouveau /etc/modprobe.d/nvidia.conf
mv nvidia-drm.conf /etc/modprobe.d/nvidia-drm.conf
mv display_setup /etc/lightdm/display_setup.sh
chmod +x /etc/lightdm/display_setup.sh
echo " If You Can See Only PCI Value Then Do This:"
echo "Edit PCI value Accordingly before You proceed -->>> Edit /etc/X11/xorg.conf and add your system PCI value"
echo "---------------------------------------------------------------------------------------------------------"
echo "Edit and Add Following: /etc/lightdm/lightdm.conf"
echo "Add This At ->> [Seat:*] ... display-setup-script=/etc/lightdm/display_setup.sh"
echo "---------------------------------------------------------------------------------------------------------"
whiptail --title "Change Required" --msgbox "Edit PCI value Accordingly before You proceed -->>> Edit /usr/local/bin/optimus.sh and add your system PCI value" 8 78
}
function lightdm-debian(){
whiptail --title "Warning" --msgbox "Before Running this script Logout And Press Ctrl+Alt+F2 and run : systemctl stop lightdm" 8 78
whiptail --title "Attention" --msgbox "After Running systemctl stop lightdm. Got Black Screen Just Press Ctrl+Alt+F2 .... " 8 78
if (whiptail --title "Is LIGHTDM Stopped?" --yesno "If LIGHTDM is Stopped then press YES else NO" 8 78); then
apt install linux-headers-$(uname -r) nvidia-settings nvidia-driver nvidia-xconfig -Vy
mv nouveau /etc/modprobe.d/nvidia-blacklists-nouveau.conf
update-initramfs -u
clear
rmmod nouveau
lsmod | grep -i nouveau
modprobe nvidia-drm
mv xorg /etc/X11/xorg.conf
nvidia-xconfig --query-gpu-info | grep 'BusID : ' | cut -d ' ' -f6
mv display_setup /etc/lightdm/display_setup.sh
chmod +x /etc/lightdm/display_setup.sh
echo " If You Can See Only PCI Value Then Do This:"
echo "Edit PCI value Accordingly before You proceed -->>> Edit /etc/X11/xorg.conf and add your system PCI value"
echo "---------------------------------------------------------------------------------------------------------"
echo "Edit and Add Following: /etc/lightdm/lightdm.conf"
echo "Add This At ->> [Seat:*] ... display-setup-script=/etc/lightdm/display_setup.sh"
echo "---------------------------------------------------------------------------------------------------------"
else
clear
echo "Run This Command Before you proceed : systemctl stop lightdm "
fi
}
function lightdm-manjaro(){
whiptail --title "Attention Required" --msgbox "Do uninstall and remove Old Nvidia Driver Packages and Settings" 8 78
if(whiptail --title "Are You Ready to proceed?" --yesno "If You are Ready to proceed then press YES else NO" 8 78); then
mhwd -i pci video-nvidia
mkdir /etc/pacman.d/hooks
mv nvidia.hook /etc/pacman.d/hooks
whiptail --title "Change Required" --msgbox " Remove auto generated nvidia Configuration file -->> Remove From /etc/modprobe.d/ and /etc/X11/xorg.conf.d/" 8 78
mv optimus.conf /etc/X11/xorg.conf.d/optimus.conf
mv blacklist-nouveau /etc/modprobe.d/nvidia.conf
mv nvidia-drm.conf /etc/modprobe.d/nvidia-drm.conf
mv display_setup /etc/lightdm/display_setup.sh
chmod +x /etc/lightdm/display_setup.sh
echo " If You Can See Only PCI Value Then Do This:"
echo "Edit PCI value Accordingly before You proceed -->>> Edit /etc/X11/xorg.conf and add your system PCI value"
echo "---------------------------------------------------------------------------------------------------------"
echo "Edit and Add Following: /etc/lightdm/lightdm.conf"
echo "Add This At ->> [Seat:*] ... display-setup-script=/etc/lightdm/display_setup.sh"
echo "---------------------------------------------------------------------------------------------------------"
whiptail --title "Change Required" --msgbox "Edit PCI value Accordingly before You proceed -->>> Edit /usr/local/bin/optimus.sh and add PCI value" 8 78
else
clear
whiptail --title "Do It then run again" --msgbox "Remove all Previously Installed Nvidia Stuff" 8 78
fi
}
function sddm-arch(){
whiptail --title "Attention Required" --msgbox "Do uninstall and remove Old Nvidia Driver Packages and Settings" 8 78
if(whiptail --title "Are You Ready to proceed?" --yesno "If You are Ready to proceed then press YES else NO" 8 78); then
pacman -S nvidia nvidia-dkms nvidia-settings
mkdir /etc/pacman.d/hooks
mv nvidia.hook /etc/pacman.d/hooks
mv optimus.conf /etc/X11/xorg.conf.d/optimus.conf
whiptail --title "Change Required" --msgbox " Remove auto generated nvidia Configuration file -->> Remove From /etc/modprobe.d/ and /etc/X11/xorg.conf.d/" 8 78
mv blacklist-nouveau /etc/modprobe.d/nvidia.conf
mv nvidia-drm.conf /etc/modprobe.d/nvidia-drm.conf
whiptail --title "Change Required" --msgbox "Edit This File /usr/share/sddm/scripts/Xsetup ... Add as shown in next dialogbox" 8 78
whiptail --title "Add This " --msgbox "xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto " 8 78
whiptail --title "Change Required" --msgbox "Edit PCI value Accordingly before You proceed -->>> Edit /usr/local/bin/optimus.sh and add your PCI value" 8 78
else
clear
whiptail --title "Do It then run again" --msgbox "Remove all Previously Installed Nvidia Stuff" 8 78
fi
}
function sddm-debian(){
whiptail --title "Warning" --msgbox "Before Running this script Logout And Press Ctrl+Alt+F2 and run : systemctl stop sddm" 8 78
whiptail --title "Attention" --msgbox "After Running systemctl stop sddm. Got Black Screen Just Press Ctrl+Alt+F2 For Logout Just Login Then Run This Script.... " 8 78
if (whiptail --title "Is SDDM Stopped?" --yesno "If SDDM is Stopped then press YES else NO" 8 78); then
apt install linux-headers-$(uname -r) nvidia-settings nvidia-driver nvidia-xconfig -Vy
mv nouveau /etc/modprobe.d/nvidia-blacklists-nouveau.conf
update-initramfs -u
clear
rmmod nouveau
lsmod | grep -i nouveau
modprobe nvidia-drm
mv xorg /etc/X11/xorg.conf
nvidia-xconfig --query-gpu-info | grep 'BusID : ' | cut -d ' ' -f6
echo " If You Can See Only PCI Value Then Do This:"
echo "Edit PCI value Accordingly before You proceed -->>> Edit /etc/X11/xorg.conf and add your system PCI value"
echo "---------------------------------------------------------------------------------------------------------"
echo "Edit This File /usr/share/sddm/scripts/Xsetup ..... Add This ->>"
echo "xrandr --setprovideroutputsource modesetting NVIDIA-0"
echo "xrandr --auto"
echo "---------------------------------------------------------------------------------------------------------"
else
clear
echo "Run This Command Before you proceed : systemctl stop sddm "
fi
}
function sddm-manjaro(){
whiptail --title "Attention Required" --msgbox "Do uninstall and remove Old Nvidia Driver Packages and Settings" 8 78
if(whiptail --title "Are You Ready to proceed?" --yesno "If You are Ready to proceed then press YES else NO" 8 78); then
mhwd -i pci video-nvidia
mkdir /etc/pacman.d/hooks
mv nvidia.hook /etc/pacman.d/hooks
mv optimus.conf /etc/X11/xorg.conf.d/optimus.conf
whiptail --title "Change Required" --msgbox " Remove auto generated nvidia Configuration file -->> Remove From /etc/modprobe.d/ and /etc/X11/xorg.conf.d/" 8 78
mv blacklist-nouveau /etc/modprobe.d/nvidia.conf
mv nvidia-drm.conf /etc/modprobe.d/nvidia-drm.conf
whiptail --title "Change Required" --msgbox "Edit This File /usr/share/sddm/scripts/Xsetup ... Add as shown in next dialogbox" 8 78
whiptail --title "Add This " --msgbox "xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto " 8 78
whiptail --title "Change Required" --msgbox "Edit PCI value Accordingly before You proceed -->>> Edit /usr/local/bin/optimus.sh and add your PCI value" 8 78
else
clear
whiptail --title "Do It then run again" --msgbox "Remove all Previously Installed Nvidia Stuff" 8 78
fi
}
function nvidia(){
clear
menu
while [ opt != '' ]
do
if [[ $opt = "" ]]; then
exit;
else
case $opt in
1) clear;
gdm-arch;
exit;
;;
2) clear;
gdm-debian;
exit;
;;
3) clear;
gdm-manjaro;
exit;
;;
4) clear;
lightdm-arch;
exit;
;;
5) clear;
lightdm-debian;
exit;
;;
6) clear;
lightdm-manjaro;
exit;
;;
7) clear;
sddm-arch;
exit;
;;
8) clear;
sddm-debian;
exit;
;;
9) clear;
sddm-manjaro;
exit;
;;
x) clear;
;;
q) clear;
;;
\n) clear;
;;
*) clear;
menu;
;;
esac
fi
done
}
if [ `whoami` == "root" ]; then
nvidia;
else
echo " You're in LINUX Not Windows... Do Run With ROOT Priviledge "
fi