-
Notifications
You must be signed in to change notification settings - Fork 5
/
easyfglrxinstall.sh
executable file
·546 lines (465 loc) · 19.7 KB
/
easyfglrxinstall.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
#!/bin/sh
######################################################################################
# #
# easyfglrxinstall.sh - Install the fglrx driver on Debian-based operating systems #
# Copyright (C) 2013-2022 Christian Heinrichs <christian.heinrichs@mykolab.ch> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
######################################################################################
####################################
# #
# Easy fglrx installation script #
# #
####################################
# easyfglrxinstall.sh written by Christian Heinrichs
# Last modified on 19 January 2022
# Accepted distro versions should be irrelevant, also this script should work on
# Debian as well as Ubuntu systems regardless of the distro version
agmethod() {
printf "[F]ast or [v]erbose mode? "
read modechoice
if [ $modechoice = "f" ] || [ $modechoice = "F" ]
then
printf "agmethod() running in fast mode\n\n"
# Uninstall all .deb packages and .run leftovers
printf "Removing all leftover fglrx installation files\n\n"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get purge -y fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo apt-get purge -y fglrx fglrx-amdcccle fglrx-dev fglrx-updates fglrx-amdcccle-updates
# Not sure about this one anymore, could be fglrx-driver now
printf "Installing via apt-get\n\n"
sudo apt-get install -y fglrx fglrx-amdcccle fglrx-driver
# Set up initial driver config
printf "Setting up initial fglrx configuration\n\n"
sudo amdconfig --initial
# Reboot dialog
printf "Reboot? (Y/N) "
read rebootchoice
case $rebootchoice in
[yY]) printf "System going down\n\n"
systemctl reboot;;
[nN]) printf "Be sure to reboot!\n"
mainmenu
return;;
*) printf "Wrong input! Returning to main menu.\n"
mainmenu
return;;
esac
elif [ $modechoice = "v" ] || [ $modechoice = "V" ]
then
printf "agmethod() running in verbose mode\n\n"
printf "Remove all installed fglrx files? "
read delchoice
case $delchoice in
[yY]) # Uninstall all .deb packages and .run leftovers
printf "Removing all leftover fglrx installation files\n\n"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo apt-get purge fglrx fglrx-amdcccle fglrx-dev fglrx-updates fglrx-amdcccle-updates;;
[nN]) printf "You chose no. Please make sure that the fglrx driver was removed already. Continuing...\n";;
*) printf "Wrong input! Returning\n"
agmethod
return;;
esac
printf "Do you want to install the fglrx driver with apt-get? "
read instchoice
case $instchoice in
[yY]) printf "Installing via apt-get\n\n"
sudo apt-get install fglrx fglrx-amdcccle fglrx-driver;;
[nN]) printf "Returning to main menu.\n"
mainmenu
return;;
*) printf "Wrong input! Returning.\n"
agmethod
return;;
esac
printf "Create initial fglrx configuration? "
read cfgchoice
case $cfgchoice in
# Setup initial driver configuration
[yY]) printf "Setting up initial fglrx configuration\n\n"
sudo amdconfig --initial;;
[nN]) printf "You chose no. Make sure to set the configuration before rebooting! Continuing...\n";;
*) printf "Wrong input! Returning.\n"
agmethod
return;;
esac
# Reboot dialog
printf "Reboot? (Y/N) "
read rebootchoice
case $rebootchoice in
[yY]) printf "System going down\n\n"
systemctl reboot;;
[nN]) printf "Be sure to reboot!\n"
mainmenu;;
*) printf "Wrong input! Returning to main menu.\n"
mainmenu;;
esac
else
printf "Please enter either f or v.\n"
fi
}
debmethod() {
printf "[F]ast or [v]erbose mode? "
read modechoice
if [ $modechoice = "f" ] || [ $modechoice = "F" ]
then
printf "debmethod() running in fast mode\n\n"
# Uninstall all .deb packages and .run leftovers
printf "Removing all leftover fglrx installation files\n\n"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get purge -y fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo apt-get purge -y fglrx fglrx-amdcccle fglrx-dev fglrx-updates fglrx-amdcccle-updates
# Get required dependencies for build
printf "Downloading and installing build packages\n\n"
sudo apt-get install -y build-essential cdbs dh-make dkms execstack dh-modaliases fakeroot libqtgui4
printf "Do you have a 32-bit or a 64-bit system? (32/64) "
read archchoice
case $archchoice in
32) printf "System is not a 64-bit architecture. Skipping installation of lib32gcc1\n\n";;
64) printf "Installing required 64-bit package\n\n"
sudo apt-get install -y lib32gcc1;;
*) printf "Wrong input! Returning.\n"
debmethod
return;;
esac
printf "Extracting .zip archive\n\n"
unzip amd*.zip
printf "Building package\n\n"
sudo sh amd*.run --buildpkg
# Install Debian package
printf "Installing Debian package\n\n"
sudo dpkg -i fglrx*.deb
# Setup initial driver config
printf "Setting up initial fglrx configuration\n\n"
sudo amdconfig --initial
# Reboot dialog
printf "Reboot? (Y/N) "
read rebootchoice
case $rebootchoice in
[yY]) printf "System going down\n\n"
systemctl reboot;;
[nN]) printf "Be sure to reboot!\n"
mainmenu
return;;
*) printf "Wrong input! Returning to main menu.\n"
mainmenu
return;;
esac
elif [ $modechoice = "v" ] || [ $modechoice = "V" ]
then
printf "debmethod() running in verbose mode\n\n"
# Uninstall all .deb packages and .run leftovers
printf "Uninstall all leftover fglrx files? "
read uninstchoice
case $uninstchoice in
[yY]) printf "Removing all leftover fglrx installation files\n\n"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo apt-get purge fglrx fglrx-amdcccle fglrx-dev fglrx-updates fglrx-amdcccle-updates;;
[nN]) printf "Past fglrx installations must be removed. Returning to debmethod()\n"
debmethod
return;;
*) printf "Wrong input! Returning.\n"
debmethod
return;;
esac
# Get required dependencies for build
printf "Download and install build packages? "
read builddecision
case $builddecision in
[yY]) printf "Downloading and installing build packages\n\n"
sudo apt-get install build-essential cdbs dh-make dkms execstack dh-modaliases fakeroot libqtgui4;;
[nN]) printf "Make sure you have all the build packages installed.\n";;
*) printf "Wrong input! Returning.\n"
debmethod
return;;
esac
printf "Do you have a 32-bit or a 64-bit system? (32/64) "
read archchoice
case $archchoice in
32) printf "System is not a 64-bit architecture. Skipping installation of lib32gcc1\n\n";;
64) printf "Installing required 64-bit package\n\n"
sudo apt-get install lib32gcc1;;
*) printf "Wrong input! Returning.\n"
debmethod
return;;
esac
printf "Extract fglrx .zip archive? "
read extchoice
case $extchoice in
[yY]) printf "Extracting fglrx .zip archive\n\n"
unzip -v amd*.zip;;
[nN]) printf "You chose no. Make sure that the extracted files are in this folder. Continuing...\n";;
*) printf "Wrong input! Returning.\n"
debmethod
return;;
esac
printf "WARNING: Is the .run file in the same folder as this script? (Y/N) "
read runfilechoice
case $runfilechoice in
[yY]) printf "Continuing...\n";;
[nN]) printf "The .run file must be in the same folder as this script.\n"
debmethod
return;;
*) printf "Wrong input! Returning.\n"
debmethod
return;;
esac
printf "Do you want to build the package for your distro version? "
read buildchoice
case $buildchoice in
[yY]) printf "Building package\n\n"
sudo sh amd*.run --buildpkg;;
[nN]) printf "You chose no. Returning to main menu.\n"
mainmenu
return;;
*) printf "Wrong input! Returning.\n"
debmethod
return;;
esac
printf "The Debian package should have been built for your distribution. Install it? (Y/N) "
read instchoice
# Install Debian package
case $instchoice in
[yY]) printf "Installing package\n\n"
sudo dpkg -i fglrx*.deb;;
[nN]) printf "You chose no. Returning to main menu.\n"
mainmenu
return;;
*) printf "Wrong input! Returning\n"
debmethod
return;;
esac
printf "Create initial fglrx configuration? "
read cfgchoice
# Setup initial driver config
case $cfgchoice in
[yY]) printf "Setting up initial fglrx configuration\n\n"
sudo amdconfig --initial;;
[nN]) printf "You chose no. Make sure to set the configuration before rebooting! Continuing...\n";;
*) printf "Wrong input. Returning.\n"
debmethod
return;;
esac
# Reboot dialog
printf "Reboot? (Y/N) "
read rebootchoice
case $rebootchoice in
[yY]) printf "System going down\n\n"
systemctl reboot;;
[nN]) printf "Be sure to reboot!\n"
mainmenu
return;;
*) printf "Wrong input! Returning to main menu.\n"
mainmenu
return;;
esac
else
printf "Please enter either f or v\n"
fi
}
runmethod() {
printf "[F]ast or [v]erbose mode? "
read modechoice
if [ $modechoice = "f" ] || [ $modechoice = "F" ]
then
printf "runmethod() running in fast mode\n\n"
printf "WARNING: Is the fglrx .run file in the same folder as this script? (Y/N) "
read samefolder
# Create xorg.conf backup
case $samefolder in
[yY]) printf "Creating xorg.conf backup\n\n"
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf~
printf "Removing all leftover fglrx installation files\n\n"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get purge -y fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo apt-get purge -y fglrx fglrx-amdcccle fglrx-dev fglrx-updates fglrx-amdcccle-updates
printf "Extracting .zip archive\n\n"
unzip amd*.zip
printf "Granting executable permission rights to fglrx .run file\n\n"
sudo chmod +x amd*.run
printf "Executing fglrx .run file\n\n"
sudo ./amd*.run
printf "Setting up initial fglrx configuration\n\n"
sudo amdconfig --initial;;
[nN]) printf "It has to be in this folder. Returning.\n"
runmethod
return;;
*) printf "Wrong input! Returning.\n"
runmethod
return;;
esac
# Reboot dialog
printf "Reboot? (Y/N) "
read rebootchoice
case $rebootchoice in
[yY]) printf "System going down\n\n"
systemctl reboot;;
[nN]) printf "Be sure to reboot!\n"
mainmenu
return;;
*) printf "Wrong input! Returning to main menu.\n"
mainmenu
return;;
esac
elif [ $modechoice = "v" ] || [ $modechoice = "V" ]
then
printf "runmethod() running in verbose mode\n\n"
printf "WARNING: Is the fglrx .run file in the same folder as this script? (Y/N) "
read samefolder
case $samefolder in
[yY]) printf "Creating xorg.conf backup\n\n"
sudo cp -v /etc/X11/xorg.conf /etc/X11/xorg.conf~;;
[nN]) printf "The .run file has to be in this folder. Returning.\n"
runmethod
return;;
*) printf "Wrong input! Returning.\n"
runmethod
return;;
esac
printf "Do you want to uninstall leftover fglrx files from past installations? "
read uninstchoice
case $uninstchoice in
[yY]) printf "Removing all leftover fglrx installation files\n\n"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo apt-get purge fglrx fglrx-amdcccle fglrx-dev fglrx-updates fglrx-amdcccle-updates;;
[nN]) printf "Past installations must be removed. Returning to runmethod()\n"
runmethod
return;;
*) printf "Wrong input! Returning\n"
runmethod
return;;
esac
printf "Extract .zip archive? "
read unzipfiles
case $unzipfiles in
[yY]) printf "Extracting fglrx .zip archive\n\n"
unzip -v amd*.zip;;
[nN]) print "You chose no. Make sure that the extracted files are in this folder. Continuing...\n";;
*) printf "Wrong input! Returning\n"
runmethod
return;;
esac
printf "Grant executable file permission rights to the .run file? "
read chmodchoice
case $chmodchoice in
[yY]) printf "Granting executable file permission rights to fglrx .run file\n\n"
sudo chmod +x -v amd*.run;;
[nN]) printf "You chose no. The .run file must be executable. Continuing...\n";;
*) printf "Wrong input! Returning.\n"
runmethod
return;;
esac
printf "Execute fglrx .run file? "
read execrunchoice
case $execrunchoice in
[yY]) printf "Executing fglrx .run file\n\n"
sudo ./amd*.run;;
[nN]) printf "Returning to main menu.\n"
mainmenu
return;;
*) printf "Wrong input! Returning.\n"
runmethod
return;;
esac
printf "Create configuration file? "
read cfgchoice
case $cfgchoice in
[yY]) printf "Setting up initial fglrx configuration\n\n"
sudo amdconfig --initial;;
[nN]) printf "You chose no. Make sure to set the configuration before rebooting! Continuing...\n";;
*) printf "Wrong input! Returning.\n"
runmethod
return;;
esac
# Reboot dialog
printf "Reboot? (Y/N) "
read rebootchoice
case $rebootchoice in
[yY]) printf "System going down\n\n"
systemctl reboot;;
[nN]) printf "Be sure to reboot!\n"
mainmenu
return;;
*) printf "Wrong input! Returning to main menu.\n"
mainmenu
return;;
esac
else
printf "Please enter either f or v\n"
fi
}
rebootmethod() {
printf "Rebooting in three seconds.\n"
sleep 3
systemctl reboot
}
mainmenu() {
printf "
Choose one of the installation methods:
1. apt-get method
2. Create a Debian package and install it
3. Execute the fglrx .run file
4. AMD driver uninstall only
5. Reboot the system
6. Exit\n\n"
read methodchoice
if [ $methodchoice = 1 ]
then
agmethod
return
elif [ $methodchoice = 2 ]
then
debmethod
return
elif [ $methodchoice = 3 ]
then
runmethod
return
elif [ $methodchoice = 4 ]
then
# Uninstall all .deb packages and .run leftovers
printf "Uninstalling...\n\n"
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo apt-get purge fglrx fglrx-amdcccle fglrx-dev fglrx-updates fglrx-amdcccle-updates
printf "Do you want to reboot? "
read rebootchoice
if [ $rebootchoice = "y" ] || [ $rebootchoice = "Y" ]
then
systemctl reboot
else
printf "Be sure to reboot to apply the changes.\n"
mainmenu
return
fi
elif [ $methodchoice = 5 ]
then
rebootmethod
return
elif [ $methodchoice = 6 ]
then
printf "Exit\n"
exit 0
else
printf "Wrong input.\n"
mainmenu
return
fi
}
# Start main menu
mainmenu