/
hwdetect_7_graphics
executable file
·155 lines (117 loc) · 4.63 KB
/
hwdetect_7_graphics
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
#!/bin/bash
#
#**************************************************************************
# Copyright (C) 2008 Jan Mette *
# Copyright (C) 2009 Jan Mette and Phil Miller *
# <jan[dot]mette[at]berlin[dot]de> *
# <philm[at]chakra-project[dot]org> *
# *
# This script 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 2 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, write to the *
# Free Software Foundation, Inc., *
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
#**************************************************************************
# config is in /etc/chakra-hwdetect.conf
hwdetect_graphics()
{
#get variables
NONFREE=`get_nonfree`
XDRIVER=`get_xdriver`
[ -n "$XDRIVER" ] || XDRIVER="vesa"
case "$XDRIVER" in
vesa)
#force vesa driver
printhl "Forcing driver: vesa."
# add a status file in /tmp
touch /tmp/vesa
#disable nonfree if any
NONFREE="no"
;;
*)
printhl "no vesa driver forced."
;;
esac
[ -n "$NONFREE" ] || NONFREE="yes"
case "$NONFREE" in
yes)
# check for vendors
CARD_NVIDIA=$(lspci -n | sed -n "s/.* 0300: 10de:\(....\).*/\1/p")
CARD_ATI=$(lspci -n | sed -n "s/.* 0300: 1002:\(....\).*/\1/p")
# do we have one?
if [ "$CARD_NVIDIA" != "" ]
then
# check if its a card supported by the latest driver
if [ $(grep -i "$CARD_NVIDIA" ${HW_DB_PATH}/${NV_DB}) ]
then
printhl "NVIDIA hardware detected"
printhl "Installing driver: nvidia. This can take some seconds."
pacman -Udf ${HW_DRIVER_PATH}/nvidia-utils-${NVIDIA_DRV_VER}* &>/dev/null
pacman -Udf ${HW_DRIVER_PATH}/nvidia-${NVIDIA_DRV_VER}* &>/dev/null
# add a status file in /tmp
touch /tmp/nvidia
# or maybe a legacy card
elif [ $(grep -i "$CARD_NVIDIA" ${HW_DB_PATH}/${NV96XX_DB}) ]
then
printhl "NVIDIA hardware detected"
printhl "Installing driver: nvidia-96xx. This can take some seconds."
pacman -Udf ${HW_DRIVER_PATH}/nvidia-96xx* &>/dev/null
# add a status file in /tmp
touch /tmp/nvidia-96xx
# or maybe another legacy card
elif [ $(grep -i "$CARD_NVIDIA" ${HW_DB_PATH}/${NV173XX_DB}) ]
then
printhl "NVIDIA hardware detected"
printhl "Installing driver: nvidia-173xx. This can take some seconds."
pacman -Udf ${HW_DRIVER_PATH}/nvidia-173xx* &>/dev/null
# add a status file in /tmp
touch /tmp/nvidia-173xx
else
printhl "No non-free drivers available for this hardware"
fi
elif [ "$CARD_ATI" != "" ]
then
if [ $(grep -i "$CARD_ATI" ${HW_DB_PATH}/${ATI_DB}) ]
then
printhl "ATI hardware detected"
printhl "Installing driver: ATI catalyst. This can take some seconds."
pacman -Udf ${HW_DRIVER_PATH}/catalyst* &>/dev/null
# add a status file in /tmp
touch /tmp/catalyst
else
printhl "No non-free drivers available for this hardware"
fi
else
printhl "No non-free drivers available for this hardware"
fi
;;
*)
printhl "Non-free graphics drivers disabled"
# arg! this don't work yet
# # check for nvidia
# CARD_NVIDIA=$(lspci -n | sed -n "s/.* 0300: 10de:\(....\).*/\1/p")
#
# # do we have one?
# if [ "$CARD_NVIDIA" != "" ]
# then
# printhl "NVIDIA hardware detected"
# printhl "Installing driver: nouveau. This can take some seconds."
#
# pacman -Rd libdrm --noconfirm &>/dev/null
# pacman -Udf ${HW_DRIVER_PATH}/xf86-video-nouveau* &>/dev/null
# pacman -Udf ${HW_DRIVER_PATH}/nouveau-drm* &>/dev/null
# pacman -Udf ${HW_DRIVER_PATH}/nouveau-libdrm* &>/dev/null
#
# fi
;;
esac
}