Debian Codegraph @

source/tools/support/linux/system_report

raw
1 #!/bin/sh
2 #
3 # MegaGlest System Report
4 #
5 # Examines the Linux operating environment of a MegaGlest installation and
6 # dumps this information into REPORT_LOCATION for support purposes.
7 #
8 # -----------------------------------------------------------------------------
9 #
10 # Written by Tom Reynolds <tomreyn[at]megaglest.org>
11 # Copyright (c) 2012-2016 Tom Reynolds, The MegaGlest Team, under GNU GPL v3.0
12 #
13 # -----------------------------------------------------------------------------
14 #
15 # Configuration section
16
17 # Location to write report to
18 #REPORT_LOCATION=
19
20 # MegaGlest installation directory, see --help
21 #INSTALLATION_LOCATION=
22
23 # Make user press Enter to exit
24 #PAUSE=1
25
26 # End of configuration section
27 #
28 # -----------------------------------------------------------------------------
29 #
30
31 LANG=C
32 VERSION='0.3.4'
33 MYNAME=`basename $0`
34 DEFAULT_REPORT_FILENAME=system_report.log
35
36 if [ "$1"'x' = '-vx' -o "$1"'x' = '--versionx' ]
37 then
38 echo 'MegaGlest System Report '"$VERSION"
39 echo ''
40 exit 0
41 fi
42
43 if [ "$1"'x' = '-hx' -o "$1"'x' = '--helpx' ]
44 then
45 echo 'Usage:'
46 echo ' '"$MYNAME"' <OPTION>'
47 echo ' '"$MYNAME"' [INSTALLATION LOCATION]'
48 echo ''
49 echo 'Available options:'
50 echo ' --version output version information and exit'
51 echo ' --help display this help and exit'
52 echo ''
53 echo 'INSTALLATION LOCATION is an optional argument which specifies the MegaGlest'
54 echo 'installation directory, containing the "start_megaglest" wrapper script.'
55 echo ''
56 exit 0
57 fi
58
59
60 if [ "$REPORT_LOCATION"'x' = 'x' ]
61 then
62 REPORT_LOCATION=$DEFAULT_REPORT_FILENAME
63 fi
64
65 if [ "$PAUSE"'x' = 'x' ]
66 then
67 PAUSE=1
68 fi
69
70 # Check whether report file is writable
71 rm -f "$REPORT_LOCATION"
72 touch "$REPORT_LOCATION" >/dev/null 2>&1
73 if [ "$?"'x' != '0x' ]
74 then # Unable to write report file
75 rm -f /tmp/$DEFAULT_REPORT_FILENAME
76 touch /tmp/$DEFAULT_REPORT_FILENAME >/dev/null 2>&1
77 if [ "$?"'x' != '0x' ]
78 then # Unable to write to backup report file location
79 echo 'ERROR: Unable to write to either '"$REPORT_LOCATION"' or /tmp/'"$DEFAULT_REPORT_FILENAME" >&2
80 echo ' Please edit this script and set REPORT_LOCATION to a writable location.' >&2
81 echo '' >&2
82 rm -f "$REPORT_LOCATION"
83 exit 1
84 else # Writing to backup report file location succeeded
85 echo 'WARNING: Unable to write to '"$REPORT_LOCATION"'.'
86 echo ' I will write to /tmp/'"$DEFAULT_REPORT_FILENAME"' (which is writable) instead.' >&2
87 echo '' >&2
88 REPORT_LOCATION=/tmp/$DEFAULT_REPORT_FILENAME
89 fi
90 fi
91 rm -f "$REPORT_LOCATION"
92
93
94 installation_location_unusable () {
95 echo 'ERROR: The INSTALLATION_LOCATION you provided is unusable:' >&2
96 echo ' '"$INSTALLATION_LOCATION" >&2
97 echo '' >&2
98 echo 'Please specify the directory you installed to (which must contain the' >&2
99 echo 'start_megaglest script) as first parameter to this script, e.g.:' >&2
100 echo ' '"$MYNAME"' /home/paulo/MegaGlest-3' >&2
101 echo '' >&2
102 echo 'You may try to use the following commands to locate the script:' >&2
103 echo ' locate -b '"'"'\start_megaglest'"'" >&2
104 echo ' find -type f -name start_megaglest ~/' >&2
105 echo ' sudo find -type f -name start_megaglest /' >&2
106 echo '' >&2
107 echo 'Please be aware that this script is written to work with installations created' >&2
108 echo 'using the installation instructions on http://megaglest.org. It may or may not' >&2
109 echo 'work with variants of MegaGlest which were packaged by your Linux distribution.' >&2
110 echo '' >&2
111 }
112
113 # Locate MegaGlest installation location
114 if [ "$INSTALLATION_LOCATION"'x' != 'x' ] # The user provided an installation directory via env. variable
115 then
116 if [ -f "$INSTALLATION_LOCATION/start_megaglest" -o -h "$INSTALLATION_LOCATION/start_megaglest" ]
117 then # The user provided an installation directory which is usable
118 true
119 else # The user provided an installation directory which is NOT usable
120 installation_location_unusable
121 exit 1
122 fi
123 else # The user did not specify the $INSTALLATION_LOCATION environment variable
124 if [ "$1"'x' != 'x' ]
125 then # The user did, however, specify the installation location as a command line argument
126 INSTALLATION_LOCATION=$1
127 if [ -f "$INSTALLATION_LOCATION/start_megaglest" -o -h "$INSTALLATION_LOCATION/start_megaglest" ]
128 then # The user provided an installation directory which is usable
129 true
130 else # The user provided an installation directory which is NOT usable
131 installation_location_unusable
132 exit 1
133 fi
134 else # The user did not specify the installation location at all
135 if [ -f ~/megaglest/start_megaglest -o -h ~/megaglest/start_megaglest ]
136 then # However, there is a usable installation at ~/megaglest/
137 INSTALLATION_LOCATION=~/megaglest
138 echo 'WARNING: Using automatically selected installation directory ~/megaglest' >&2
139 echo ' This is usually what you want. To manually specify it, see --help.' >&2
140 echo '' >&2
141 else # Failed to guess the installation location, so give up.
142 echo 'ERROR: Unable to determine MegaGlest installation location.' >&2
143 echo '' >&2
144 echo 'Please specify the directory you installed to (which must contain the' >&2
145 echo 'start_megaglest script) as first parameter to this script, e.g.:' >&2
146 echo ' '"$MYNAME"' /home/paulo/MegaGlest-3' >&2
147 echo '' >&2
148 echo 'You may try to use the following commands to locate the script:' >&2
149 echo ' locate -b '"'"'\start_megaglest'"'" >&2
150 echo ' find -type f -name start_megaglest ~/' >&2
151 echo ' sudo find -type f -name start_megaglest /' >&2
152 echo '' >&2
153 echo 'Please be aware that this script is written to work with installations' >&2
154 echo 'created using the instructions on megaglest.org. It may not work with' >&2
155 echo 'variants of MegaGlest which were packaged by your Linux distribution.' >&2
156 echo '' >&2
157 exit 1
158 fi
159 fi
160 fi
161
162
163 # Start gathering information, writing it to REPORT_LOCATION
164 cat <<'EOF'
165
166 a.
167 __,. ._a,, v .. =ma;
168 <wVUXSc<ZA2YS> j[ _a2` :. .]W#=;
169 ]ZgQ#Zq2Xmmmmmoc .. jX( _ss,%_wXZ' _a, i _u)W#>>
170 =ZmWXY!3Qm$Z13WQo,.adUXXS3;uASoZXXnnSauudZXSn. +;. _=%|IcWWmm;
171 3qQEe .nQBd` 1dQZsdSmmmqmnZqmBW#BWomwwwwwmX8I 3, ._iii=<in3WWm'
172 .S**X( .n?S2 <2TCXSUXZS1SXXXGZ"?nnXXZd8X3Ev+` -h, s,. .=v+||1+<nmo$m#
173 :n|<#; n|ve :z+{2|vmaaonSi)d` _nn(d1{d{c|v. ]kdmms=>Iv=|lnwZ!` ?[
174 .1+<X; 3|ve :2|ve|voonvnS>Ie<dX13ak>{SXs=n. 4WP4k;<<vsuw2!`
175 vaaX; .nsvo )c<oc|3m#ZmI2><XSd#c|1e|iaao|v. _)Qswpc=vomY^
176 {dWp( nmp2 dqm21q2o="vn2vudXZ!{ivv%3mXo>v: ._|||3mBmo%Z"`
177 =v$SowwommXwwSmX()3Q2oaZm3zWmoouGmEvQv~)Sm{> .=||||=)Qr]Ze
178 .X2SomqqmQWmgwmXX( {dQmqmUn+3WQgqmBmnAouXdWon` ._||||++=+imom#'
179 )u####ZZZZZZ###X( -{X##Zsn;~3Z##XXXoZdGZ###p_=|||++++<vnn$mWe
180 X?"^- . -~"Y' -~~ {v> -""YXm#mZ3d!"|||||=+|+<unv" )#.
181 :n( -"{Sd'=||i|==+|sun}^ -m:
182 {z _#Z|ii|====iao1o( X;
183 =o .jZ||>==+<vu21oZP ]; _;<i,_______us,
184 v. _=v#(+=<adS2nouZSd` )( _2 3vn22121211v;
185 +; ._|iid+==wX1Isi%|lno' ._ .( .d( 3viillIlll|i`
186 |=|ii|||=<dnlvXZZZc|nSisuS( _i,_d1=_XzSSXX1|IXo%.
187 ._|iii|=+|iumSmZX!~^!1%onvnun` _dS111nIdY111124v|v]qo.
188 .=iii|==+|voX*Zmm1e 2{XZd#ve _UqwZmgpvnZXXwoi]nwi:~~
189 ._|iii|++|iuS2"`:XUDv` _i2{+33E| .ZqSoX1XCvBsoXX1>]nmv.
190 _=iii||+|<voS*~ )ei|v.<dS11vaoIl% ]21vosvXlvSlvvon=]nXl.
191 _|ili||||iuS2!` :1||{dSwXS%|iXi|c ]1+|Iliiina|||iIn]1|v.
192 .=illi||||soSe^ .v||)odS??1||vi|i .di|3XX#Si3dGoa%|{]o|{.
193 .=ili||||vuX2!- _wc|ine. :o%|vs|s_j2%|)e""X|vv*YSX|<voi{:
194 _<vIl|||ivoXe^ _wmX{oqo2nuZSoudvsISnvn%iIss2%n%n=aCcino|{=
195 _|iI||||iaoX}~ .aZ!` -XXWmwwwmUoXdmmmm1nXmqonqevqonnwooZnou1.
196 .||ii|||vuSe"` :>~ -?X#ZZZX2{o#XXXXv;?X#UAX1vXZUXS2!oXXXv.
197 =l||||<uoX}~ -""""- :Y""~]Xq; -"!!^nv>!!?"`-Y""!!
198 =l||iaoX2"` )o;
199 .=iiau2*"` :2=
200 =+|""-- v>
201 <(
202 s
203 <.
204 - S Y S T E M R E P O R T - -;
205 :
206 EOF
207 echo ' v'"$VERSION"''
208 echo ''
209 echo '________________________________________________________________________________'
210 echo ''
211 echo ' Collecting information on this computer and MegaGlest.'
212 echo ''
213 echo ' Please stand by...'
214 echo '________________________________________________________________________________'
215 echo ''
216 echo ''
217 echo '--------------------------------------------------------------------------------' >> $REPORT_LOCATION
218 echo ' MEGAGLEST SYSTEM REPORT '"$VERSION" >> $REPORT_LOCATION
219 echo ' '"`date -Ru`" >> $REPORT_LOCATION
220 echo '--------------------------------------------------------------------------------' >> $REPORT_LOCATION
221
222 echo ' → Operating system'
223 echo '' >> $REPORT_LOCATION
224 echo '' >> $REPORT_LOCATION
225 echo '***** Operating system *********************************************************' >> $REPORT_LOCATION
226 echo '' >> $REPORT_LOCATION
227 if [ `which lsb_release`'x' = 'x' ]
228 then # no lsb_release in path
229 lsb=0
230 release='unknown release'
231 if [ -e "/etc/os-release" ]; then
232 distribution="$(cat "/etc/os-release" | grep '^ID=' | awk -F '=' '{print $2}' \
233 | awk '{print toupper(substr($0,1,1))substr($0,2)}')"
234 codename="$(cat "/etc/os-release" | grep '^PRETTY_NAME=' | awk -F '"' '{print $2}')"
235 elif [ -e /etc/debian_version ]; then distribution='Debian'; codename="$(cat /etc/debian_version)"
236 elif [ -e /etc/SuSE-release ]; then distribution='SuSE'; codename="$(cat /etc/SuSE-release)"
237 elif [ -e /etc/redhat-release ]; then
238 if [ -e /etc/fedora-release ]; then distribution='Fedora'; codename="$(cat /etc/fedora-release)"
239 else distribution='Redhat'; codename="$(cat /etc/redhat-release)"; fi
240 elif [ -e /etc/fedora-release ]; then distribution='Fedora'; codename="$(cat /etc/fedora-release)"
241 elif [ -e /etc/mandrake-release ]; then distribution='Mandrake'; codename="$(cat /etc/mandrake-release)"
242 else distribution='unknown distribution'; codename='unknown codename'; fi
243 else
244 lsb=1
245 distribution=`lsb_release -i | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'`
246 release=`lsb_release -r | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'`
247 codename=`lsb_release -c | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'`
248 fi
249 architecture=`uname -m`
250 echo '* Distribution: '"$distribution" >> $REPORT_LOCATION
251 echo '* Release: '"$release" >> $REPORT_LOCATION
252 echo '* Codename: '"$codename" >> $REPORT_LOCATION
253 echo '* Architecture: '"$architecture" >> $REPORT_LOCATION
254 echo '* LSB support: '"$lsb" >> $REPORT_LOCATION
255 echo '' >> $REPORT_LOCATION
256
257 echo '>>> uname -a' >> $REPORT_LOCATION
258 uname -a >> $REPORT_LOCATION 2>&1
259 sleep 1
260 echo '' >> $REPORT_LOCATION
261
262 echo '>>> cat /etc/issue' >> $REPORT_LOCATION
263 cat /etc/issue >> $REPORT_LOCATION 2>&1
264 sleep 1
265
266 echo ' → MegaGlest version'
267 echo '' >> $REPORT_LOCATION
268 echo '' >> $REPORT_LOCATION
269 echo '***** MegaGlest version ********************************************************' >> $REPORT_LOCATION
270 echo '' >> $REPORT_LOCATION
271
272 if [ "$ERROR_RUNNING_MEGAGLEST"'x' = '0x' -o "$ERROR_RUNNING_MEGAGLEST"'x' = 'x' ]
273 then # Only run this if MegaGlest didn't already fail last time it was run
274 echo ' (I will now try to run MegaGlest, but it should quit automatically.)'
275 echo '' >> $REPORT_LOCATION
276 echo '>>> ./start_megaglest --use-language=en --version' >> $REPORT_LOCATION
277 $INSTALLATION_LOCATION/start_megaglest --use-language=en --version >> $REPORT_LOCATION 2>&1
278 if [ "$?"'x' = '0x' ]
279 then # all cool
280 ERROR_RUNNING_MEGAGLEST=0
281 else # an error occurred
282 ERROR_RUNNING_MEGAGLEST=1
283 fi
284 sleep 1
285 else
286 echo 'WARNING: A previous run of MegaGlest failed. Skipping test.' >&2
287 echo '>>> SKIPPED: ./start_megaglest --use-language=en --version' >> $REPORT_LOCATION
288 fi
289
290 echo ' → CPU'
291 echo '' >> $REPORT_LOCATION
292 echo '' >> $REPORT_LOCATION
293 echo '***** CPU **********************************************************************' >> $REPORT_LOCATION
294 echo '' >> $REPORT_LOCATION
295 echo '>>> cat /proc/cpuinfo' >> $REPORT_LOCATION
296 cat /proc/cpuinfo >> $REPORT_LOCATION
297 sleep 1
298
299 echo ' → Memory'
300 echo '' >> $REPORT_LOCATION
301 echo '' >> $REPORT_LOCATION
302 echo '***** Memory *******************************************************************' >> $REPORT_LOCATION
303 echo '' >> $REPORT_LOCATION
304 echo '>>> free -mt' >> $REPORT_LOCATION
305 free -mt >> $REPORT_LOCATION
306 sleep 1
307
308 echo ' → MegaGlest configuration'
309 echo '' >> $REPORT_LOCATION
310 echo '' >> $REPORT_LOCATION
311 echo '***** MegaGlest configuration **************************************************' >> $REPORT_LOCATION
312 echo '' >> $REPORT_LOCATION
313
314 # Currently commented out due to http://glest.org/glest_board/?topic=8482
315 #if [ "$ERROR_RUNNING_MEGAGLEST"'x' = '0x' -o "$ERROR_RUNNING_MEGAGLEST"'x' = 'x' ]
316 #then # Only run this if MegaGlest didn't already fail last time it was run
317 echo ' (I will now try to run MegaGlest, but it should quit automatically.)'
318 echo '' >> $REPORT_LOCATION
319 echo '>>> ./start_megaglest --use-language=en --show-ini-settings' >> $REPORT_LOCATION
320 $INSTALLATION_LOCATION/start_megaglest --use-language=en --show-ini-settings >> $REPORT_LOCATION 2>&1
321 if [ "$?"'x' = '0x' ]
322 then # all cool
323 ERROR_RUNNING_MEGAGLEST=0
324 else # an error occurred
325 ERROR_RUNNING_MEGAGLEST=1
326 fi
327 sleep 1
328 #else
329 # echo 'WARNING: A previous run of MegaGlest failed. Skipping test.' >&2
330 # echo '>>> SKIPPED: ./start_megaglest --use-language=en --show-ini-settings' >> $REPORT_LOCATION
331 #fi
332
333 echo ' → Graphics'
334 echo '' >> $REPORT_LOCATION
335 echo '' >> $REPORT_LOCATION
336 echo '***** Graphics *****************************************************************' >> $REPORT_LOCATION
337 echo '' >> $REPORT_LOCATION
338
339 if [ "`which lspci`"'x' = 'x' ]
340 then # not available in search path
341 echo 'WARNING: "lspci" utility is not available.' >&2
342 echo ' Consider installing it to provide more useful information on your system.' >&2
343 echo '' >&2
344 echo '>>> SKIPPED: lspci -knnv | grep -EA12 '"'"'(VGA|Display)'"'" >> $REPORT_LOCATION
345 else # it's available
346 echo ">>> lspci -knnv | grep -EA12 '(VGA|Display)'" >> $REPORT_LOCATION
347 lspci -knnv | grep -EA12 '(VGA|Display)' >> $REPORT_LOCATION 2>&1
348 fi
349 sleep 1
350 echo '' >> $REPORT_LOCATION
351
352 if [ "`which xrandr`"'x' = 'x' ]
353 then # not available in search path
354 echo 'WARNING: "xrandr" utility is not available.' >&2
355 echo ' Consider installing it to provide more useful information on your system.' >&2
356 echo '' >&2
357 echo '>>> SKIPPED: xrandr' >> $REPORT_LOCATION
358 else # it's available
359 echo ">>> xrandr" >> $REPORT_LOCATION
360 xrandr >> $REPORT_LOCATION 2>&1
361 fi
362 sleep 1
363 echo '' >> $REPORT_LOCATION
364
365 # Currently commented out due to http://glest.org/glest_board/?topic=8482
366 #if [ "$ERROR_RUNNING_MEGAGLEST"'x' = '0x' -o "$ERROR_RUNNING_MEGAGLEST"'x' = 'x' ]
367 #then # Only run this if MegaGlest didn't already fail last time it was run
368 echo ' (I will now try to run MegaGlest, but it should quit automatically.)'
369 echo '' >> $REPORT_LOCATION
370 echo '>>> ./start_megaglest --use-language=en --opengl-info' >> $REPORT_LOCATION
371 $INSTALLATION_LOCATION/start_megaglest --use-language=en --opengl-info >> $REPORT_LOCATION 2>&1
372 if [ "$?"'x' = '0x' ]
373 then # all cool
374 ERROR_RUNNING_MEGAGLEST=0
375 else # an error occurred
376 ERROR_RUNNING_MEGAGLEST=1
377 fi
378 sleep 1
379 #else
380 # echo 'WARNING: A previous run of MegaGlest failed. Skipping test.' >&2
381 # echo '>>> SKIPPED: ./start_megaglest --use-language=en --opengl-info' >> $REPORT_LOCATION
382 #fi
383
384 if [ "`which glxinfo`"'x' = 'x' ]
385 then # not available in search path
386 echo 'WARNING: "glxinfo" utility is not available.' >&2
387 echo ' Consider installing it to provide more useful information on your system.' >&2
388 echo '' >&2
389 echo '>>> SKIPPED: glxinfo | grep -E '"'"'^(name|display|server|client|GLX|OpenGL)'"'" >> $REPORT_LOCATION
390 else
391 echo ">>> glxinfo | grep -E '^(name|display|server|client|GLX|OpenGL)'" >> $REPORT_LOCATION
392 glxinfo | grep -E '^(name|display|server|client|GLX|OpenGL)' >> $REPORT_LOCATION 2>&1
393 fi
394 sleep 1
395 echo '' >> $REPORT_LOCATION
396
397 echo '' >> $REPORT_LOCATION
398 echo '--------------------------------------------------------------------------------' >> $REPORT_LOCATION
399 echo '' >> $REPORT_LOCATION
400 echo '' >> $REPORT_LOCATION
401 echo '' >> $REPORT_LOCATION
402
403 echo ''
404 echo ' Processing complete.'
405 echo '________________________________________________________________________________'
406 sleep 1
407 echo ''
408 echo ' Please find your report in this file:'
409 echo ' '"$REPORT_LOCATION"
410 echo ''
411 echo ' Please post this report to a pastebin such as (one of)'
412 echo ' http://paste.megaglest.org'
413 echo ' http://pastebin.com'
414 echo ''
415 echo ' After posting it there you will be taken to a new Internet address. Please'
416 echo ' take note of this new location/URL/Internet address and make it available to'
417 echo ' the MegaGlest developers. Unless you were instructed to do otherwise, please'
418 echo ' post both the Internet address of where you uploaded to and a verbose'
419 echo ' description of the issues you are experiencing at'
420 echo ' http://forums.megaglest.org'
421 echo ''
422 echo ' Thank you for making it easy for us to assist you,'
423 echo ''
424 echo ' -- The MegaGlest development team'
425
426 if [ "$PAUSE"'x' = '1x' -o "$PAUSE"'x' = 'truex' ]
427 then
428 echo '________________________________________________________________________________'
429 echo ''
430 echo ' Please read all of the above, then press return to exit.'
431 read input >/dev/null
432 fi