Annotation of /alx-src/trunk/alx-config/init.d/hwdetect
Parent Directory | Revision Log
Revision 217 -
(hide annotations)
(download)
Sat Mar 5 17:08:18 2005 UTC (19 years, 6 months ago) by niro
File size: 7125 byte(s)
Sat Mar 5 17:08:18 2005 UTC (19 years, 6 months ago) by niro
File size: 7125 byte(s)
test; not ready for public
1 | niro | 217 | #!/bin/bash |
2 | |||
3 | # note: must be startet before /etc/rc.d/init.d/modules !!! | ||
4 | |||
5 | #default xf86config | ||
6 | write_default_xf86config(){ | ||
7 | cat > /etc/X11/XF86Config << "EOF" | ||
8 | Section "Module" | ||
9 | |||
10 | Load "dbe" # Double buffer extension | ||
11 | SubSection "extmod" | ||
12 | Option "omit xfree86-dga" # don't initialise the DGA extension | ||
13 | EndSubSection | ||
14 | |||
15 | Load "type1" | ||
16 | Load "speedo" | ||
17 | Load "freetype" | ||
18 | # Load "xtt" | ||
19 | # Load "glx" | ||
20 | |||
21 | #notebooks and sis card needs dri | ||
22 | Load "dri" | ||
23 | |||
24 | #vnc | ||
25 | Load "vnc" | ||
26 | |||
27 | EndSection | ||
28 | |||
29 | Section "Files" | ||
30 | |||
31 | RgbPath "/usr/X11R6/lib/X11/rgb" | ||
32 | |||
33 | FontPath "/usr/X11R6/lib/X11/fonts/local/" | ||
34 | FontPath "/usr/X11R6/lib/X11/fonts/misc/" | ||
35 | FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled" | ||
36 | FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled" | ||
37 | #prevents slow startup when disabled -> speedo, type1 | ||
38 | #FontPath "/usr/X11R6/lib/X11/fonts/Speedo/" | ||
39 | #FontPath "/usr/X11R6/lib/X11/fonts/Type1/" | ||
40 | FontPath "/usr/X11R6/lib/X11/fonts/TrueType/" | ||
41 | FontPath "/usr/X11R6/lib/X11/fonts/freefont/" | ||
42 | FontPath "/usr/X11R6/lib/X11/fonts/75dpi/" | ||
43 | FontPath "/usr/X11R6/lib/X11/fonts/100dpi/" | ||
44 | |||
45 | # The module search path. The default path is shown here. | ||
46 | |||
47 | # ModulePath "/usr/X11R6/lib/modules" | ||
48 | |||
49 | EndSection | ||
50 | |||
51 | Section "ServerFlags" | ||
52 | |||
53 | # ctrl+alt+fn disabled; dont't allow to switch consoles | ||
54 | # Option "DontVTSwitch" | ||
55 | |||
56 | # ctrl+alt+backspace disabled; don't restart the xserver | ||
57 | # Option "DontZap" | ||
58 | |||
59 | # ctrl+alt+[+]/[-] disabled; don't allow to change resolution | ||
60 | # Option "Dont Zoom" | ||
61 | |||
62 | EndSection | ||
63 | |||
64 | Section "InputDevice" | ||
65 | |||
66 | Identifier "Keyboard1" | ||
67 | Driver "Keyboard" | ||
68 | |||
69 | Option "AutoRepeat" "500 30" | ||
70 | # Option "Xleds" "1 2 3" | ||
71 | Option "XkbRules" "xfree86" | ||
72 | Option "XkbModel" "pc104" | ||
73 | Option "XkbLayout" "de" | ||
74 | |||
75 | EndSection | ||
76 | |||
77 | |||
78 | Section "InputDevice" | ||
79 | |||
80 | Identifier "Mouse1" | ||
81 | Driver "mouse" | ||
82 | |||
83 | Option "Protocol" "IMPS/2" | ||
84 | Option "Device" "/dev/mouse" | ||
85 | Option "Resolution" "1200" | ||
86 | Option "ZAxisMapping" "4 5" | ||
87 | |||
88 | EndSection | ||
89 | |||
90 | #vnc | ||
91 | Section "InputDevice" | ||
92 | Identifier "vncKeyboard" | ||
93 | Driver "rfbkeyb" | ||
94 | EndSection | ||
95 | |||
96 | #vnc | ||
97 | Section "InputDevice" | ||
98 | Identifier "vncMouse" | ||
99 | Driver "rfbmouse" | ||
100 | EndSection | ||
101 | |||
102 | |||
103 | Section "Monitor" | ||
104 | |||
105 | Identifier "mon0" | ||
106 | HorizSync 28 - 96 | ||
107 | VertRefresh 50-60 | ||
108 | |||
109 | EndSection | ||
110 | |||
111 | |||
112 | Section "Device" | ||
113 | Identifier "vga0" | ||
114 | Driver "vesa" | ||
115 | #VideoRam 32768 | ||
116 | # Insert Clocks lines here if appropriate | ||
117 | |||
118 | # vnc options | ||
119 | Option "rfbauth" "/root/.vnc/passwd" | ||
120 | Option "rfbport" "5900" | ||
121 | |||
122 | #Option "nevershared" | ||
123 | Option "alwaysshared" | ||
124 | |||
125 | Option "dontdisconnect" | ||
126 | |||
127 | #Option "httpdir" "/usr/share/vnc/classes" | ||
128 | #Option "httpport" "5800" | ||
129 | |||
130 | Option "usevnc" | ||
131 | |||
132 | EndSection | ||
133 | |||
134 | |||
135 | Section "Screen" | ||
136 | Identifier "Screen 1" | ||
137 | Device "vga0" | ||
138 | Monitor "mon0" | ||
139 | DefaultDepth 16 | ||
140 | |||
141 | Subsection "Display" | ||
142 | Depth 8 | ||
143 | Modes "1024x768" | ||
144 | ViewPort 0 0 | ||
145 | EndSubsection | ||
146 | Subsection "Display" | ||
147 | Depth 16 | ||
148 | Modes "1024x768" | ||
149 | ViewPort 0 0 | ||
150 | EndSubsection | ||
151 | Subsection "Display" | ||
152 | Depth 24 | ||
153 | Modes "1024x768" | ||
154 | ViewPort 0 0 | ||
155 | EndSubsection | ||
156 | EndSection | ||
157 | |||
158 | Section "ServerLayout" | ||
159 | |||
160 | Identifier "Simple Layout" | ||
161 | Screen "Screen 1" | ||
162 | InputDevice "Mouse1" "CorePointer" | ||
163 | InputDevice "Keyboard1" "CoreKeyboard" | ||
164 | |||
165 | #vnc | ||
166 | InputDevice "vncMouse" "ExtraPointer" | ||
167 | InputDevice "vncKeyboard" "ExtraKeyboard" | ||
168 | |||
169 | EndSection | ||
170 | |||
171 | # Section "DRI" | ||
172 | # Mode 0666 | ||
173 | # EndSection | ||
174 | EOF | ||
175 | |||
176 | } | ||
177 | |||
178 | |||
179 | run_hwdetection() { | ||
180 | echo -e ${COLOREDSTAR}"Hardware Autodetection started ..." | ||
181 | echo -e ${COLOREDSTAR}"Prozessor: $(cat /proc/cpuinfo |grep "model name" | sed -e 's:model\ name*.*\: ::')" | ||
182 | |||
183 | |||
184 | #cleaning up old data-crap | ||
185 | if [ -e /etc/sysconfig/hwsetup ] | ||
186 | then | ||
187 | echo -e ${COLOREDSTAR}"Cleaning up old data ..." | ||
188 | rm -f /etc/sysconfig/hwsetup/* | ||
189 | fi | ||
190 | |||
191 | echo -en "${COLOREDSTAR}";hwsetup -p > /dev/null | ||
192 | |||
193 | #clean up modules | ||
194 | if [ -f /etc/modules.autoload ] | ||
195 | then | ||
196 | echo -e ${COLOREDSTAR}"Cleaning up /etc/modules.autoload ..." | ||
197 | echo > /etc/modules.autoload | ||
198 | evaluate_retval | ||
199 | fi | ||
200 | |||
201 | #load module for parallel printing if exists | ||
202 | if [ -e /lib/modules/`uname -r`/kernel/drivers/char/lp.o ] | ||
203 | then | ||
204 | echo "lp" >> /etc/modules.autoload | ||
205 | fi | ||
206 | |||
207 | #get what hwsetup has found | ||
208 | if [ -f /etc/sysconfig/hwsetup/knoppix ] | ||
209 | then | ||
210 | source /etc/sysconfig/hwsetup/knoppix | ||
211 | fi | ||
212 | |||
213 | #network setup (dhcp) | ||
214 | #for i in $(cat /proc/net/dev|grep eth.|cut -d ':' -f1) | ||
215 | #do | ||
216 | # echo -e ${COLOREDSTAR}"Network ${i}: ${NETCARD_FULLNAME}" | ||
217 | if [ -n "${NETCARD_DRIVER}" ] | ||
218 | then | ||
219 | echo -e ${COLOREDSTAR}"Network eth0: ${NETCARD_FULLNAME}" | ||
220 | echo -e ${COLOREDSTAR}"Network module: ${NETCARD_DRIVER}" | ||
221 | |||
222 | #net module | ||
223 | echo "${NETCARD_DRIVER}" >> /etc/modules.autoload | ||
224 | |||
225 | #eth0 settings | ||
226 | echo "ONBOOT=\"yes\"" > /etc/conf.d/net.eth0 | ||
227 | echo "NETWORKING=\"dhcp\"" >> /etc/conf.d/net.eth0 | ||
228 | echo "DHCP_PROG=\"/sbin/dhcpcd\"" >> /etc/conf.d/net.eth0 | ||
229 | echo "DHCP_STOP=\"-z\"" >> /etc/conf.d/net.eth0 | ||
230 | evaluate_retval | ||
231 | else | ||
232 | #disable networking system-wide | ||
233 | [ ! -d /var/state ] && install -d /var/state | ||
234 | echo "SYSTEM_NO_NETWORK=true" > /var/state/network | ||
235 | fi | ||
236 | #done | ||
237 | |||
238 | #sound setup | ||
239 | if [ -n "${SOUND_DRIVER}" ] | ||
240 | then | ||
241 | echo -e ${COLOREDSTAR}"Sound (${SOUND_FULLNAME}) found" | ||
242 | echo -e ${COLOREDSTAR}"Sound module: ${SOUND_DRIVER}" | ||
243 | echo "${SOUND_DRIVER}" >> /etc/modules.autoload | ||
244 | evaluate_retval | ||
245 | fi | ||
246 | |||
247 | #write default xfree-config | ||
248 | echo -e ${COLOREDSTAR}"Writing default xfree-config ..." | ||
249 | write_default_xf86config | ||
250 | evaluate_retval | ||
251 | |||
252 | #xserver setup | ||
253 | if [ -n "${XDESC}" ] | ||
254 | then | ||
255 | echo -e ${COLOREDSTAR}"Video: ${XDESC}" | ||
256 | echo -e ${COLOREDSTAR}"Video module: ${XMODULE}" | ||
257 | #second check if an module really exists | ||
258 | if [ -n "${XMODULE}" ] | ||
259 | then | ||
260 | echo -e ${COLOREDSTAR}"updating xfree-config ..." | ||
261 | ( mv /etc/X11/XF86Config /etc/X11/XF86Config-orig && | ||
262 | sed -e "s/Driver*.*\"vesa\"/Driver\ \"${XMODULE}\"/g" \ | ||
263 | < /etc/X11/XF86Config-orig > /etc/X11/XF86Config && | ||
264 | rm -f /etc/X11/XF86Config-orig ) | ||
265 | evaluate_retval | ||
266 | fi | ||
267 | fi | ||
268 | |||
269 | #mouse setup | ||
270 | if [ -n "${MOUSE_DEVICE}" ] | ||
271 | then | ||
272 | echo -e ${COLOREDSTAR}"Mouse (${MOUSE_FULLNAME} found at ${MOUSE_DEVICE}" | ||
273 | echo -e ${COLOREDSTAR}"updating xfree-config ..." | ||
274 | ( source /etc/sysconfig/hwsetup/mouse && | ||
275 | XMOUSETYPEFIXED=${XMOUSETYPE/\//\\/} && | ||
276 | MOUSE_DEVICEFIXED="`echo "${MOUSE_DEVICE}"|cut -d '/' -f3`" && | ||
277 | mv /etc/X11/XF86Config /etc/X11/XF86Config-orig && | ||
278 | sed -e "s/Option\ \"Protocol\"*.*\"IMPS\/2\"/Option\ \"Protocol\"\ \"${XMOUSETYPEFIXED}\"/g" \ | ||
279 | -e "s/Option\ \"Device\"*.*\"\/dev\/mouse\"/Option\ \"Device\"\ \"\/dev\/${MOUSE_DEVICEFIXED}\"/g" \ | ||
280 | < /etc/X11/XF86Config-orig > /etc/X11/XF86Config && | ||
281 | rm -f /etc/X11/XF86Config-orig ) | ||
282 | evaluate_retval | ||
283 | fi | ||
284 | } | ||
285 | |||
286 | ########### main part starts here ############## | ||
287 | |||
288 | source /etc/sysconfig/rc | ||
289 | source $rc_functions | ||
290 | |||
291 | case $1 in | ||
292 | start) | ||
293 | #we wouldn't start hwdetection if settings where imported (alx-only) | ||
294 | if [ ! -e /etc/alx-config/imported ] | ||
295 | then | ||
296 | run_hwdetection | ||
297 | fi | ||
298 | ;; | ||
299 | |||
300 | restart) | ||
301 | $0 start | ||
302 | ;; | ||
303 | |||
304 | *) | ||
305 | echo "Usage: $0 {start|restart}" | ||
306 | exit 1 | ||
307 | ;; | ||
308 | esac |
Properties
Name | Value |
---|---|
svn:executable | * |