home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / X11R6 / bin / xine-check < prev    next >
Encoding:
Text File  |  2005-02-16  |  40.1 KB  |  1,410 lines

  1. #! /bin/sh
  2. #
  3. # xine-check - some simple diagnostics for running xine
  4. #
  5. # Copyright (c) 2002 Siggi Langauf
  6. # This file is free software. You may do with it whatever you want, but
  7. # if you give away any copies (modified or unmodified), you must include
  8. # the Authors' names. This comes with no warranty, use at your own risk!
  9. #
  10. # Authors: Siggi Langauf <siggi at users dot sf dot net> (main hacking)
  11. #          Toby J Coleridge <toby at 4mationnet dot com> (excessive testing)
  12. #          Colin Marquardt <colin at marquardt-home dot de> (DMA message)
  13.  
  14. VERSION=0.9.12
  15.  
  16. COMMON_PLACES=/:/usr:/usr/local:/usr/local/xine:/usr/xine:/opt:/opt/xine:/usr/X11:/usr/X11R6
  17. TMP_BASE=/tmp/xine-check.$$
  18.  
  19. umask 077
  20. i=1
  21. while [ $i -lt 99 ] \
  22.       && tmpdir=$TMP_BASE.$i; mkdir $tmpdir; rc=$?; [ $rc != 0 ]; do
  23.   i=`expr $i + 1`
  24. done
  25. if [ $rc != 0 ]; then
  26.   echo "Unable to create temp directory. Something is seriously wrong..."
  27.   exit 1
  28. fi
  29.  
  30. logfile=""
  31. bugreport=$tmpdir/xine-bugreport
  32. verbose=false
  33. quiet=false
  34. batch=false
  35. #batch=true
  36. runmode=interactive
  37. do_log=false
  38.  
  39. # localisation stuff
  40. available_langs="en"
  41. locale_lang=`(locale >/dev/null && locale | grep LC_MESSAGES= | sed -e s/LC_MESSAGES\=//g -e s/\"//g | cut -d _ -f 1) 2>/dev/null || echo en`
  42.  
  43. lang=""
  44. for lg in $available_langs; do
  45.   if test x$lg = x"$locale_lang";
  46.     then lang=$lg
  47.   fi
  48. done
  49. if test x$lang = x -o $lang="POSIX";
  50.   then lang="en"
  51. fi
  52.  
  53. messagefile=$tmpdir/locale.$lang
  54. indent="         "
  55. DUMPVARS="" #this holds the variables to dump into bugreports, use vars()!
  56.  
  57. echo "Please be patient, this script may take a while to run..."
  58.  
  59. cat <<EOF >$tmpdir/locale.en
  60.  
  61. root You're running me with root permissions?
  62. You should definitely run xine as normal user, not root. Running it as
  63. root will expose you to some severe security issues.
  64. This script should run as the same user that you would use to run
  65. xine. If you run me as root (as you currently are), I cannot check
  66. if your real-life user has sufficient permissions...
  67. Unless you want to recheck something with root permissions, you should
  68. abort me now (press Ctrl-C) and run me from your usual account.
  69.  
  70. several-xine-config several instances of xine-config found in your PATH
  71. xine-config executables have been found in these places:
  72. \$xine_configs
  73. This probably means you have several versions of xine-lib installed.
  74. It's probably best to uninstall all unused xine-libs.
  75. Further tests will use \$xine_config.
  76.  
  77. xine-config-in-path found \$xine_config in your PATH
  78. xine-config is a script installed by xine-lib. It is used
  79. to determine various xine file locations on your systems.
  80.  
  81. xine-config-somewhere found \$xine_config, but not in PATH
  82. xine-config is a script installed by xine-lib. It is used
  83. to determine various xine file locations on your systems.
  84. I have found this script altough it is not in your PATH.
  85. Note that this is somewhat suspicious...
  86.  
  87. assuming-xine-package-deb No xine-config found. Assuming xine from Debian package
  88. The xine-config script can be used to deternime some file locations
  89. used by xine-lib, but you don't have such a script on your system.
  90. However, it looks like you installed xine from the Debian packages.
  91. So I'll just guess that you are using the standard locations.
  92. If you want me to be sure about those file locations, you can install
  93. the 'libxine-dev' package, which contains xine-config. However, this
  94. package is not really needed to run xine...
  95.  
  96. assuming-xine-package-rpm No xine-config found. Assuming xine from RPMs
  97. The xine-config script can be used to deternime some file locations
  98. used by xine-lib, but you don't have such a script on your system.
  99. However, it looks like you installed xine from the RedHat packages.
  100. So I'll just guess that you are using the standard locations.
  101. If you want me to be sure about those file locations, you can install
  102. the 'xine-lib-devel' package (or 'xine-devel', depend on what packages
  103. you're using, which contains xine-config. However, this package is
  104. not really needed to run xine...
  105.  
  106. assuming-xine-package No xine-config found. Assuming xine from binary packages
  107. The xine-config script can be used to deternime some file locations
  108. used by xine-lib, but you don't have such a script on your system.
  109. However, it looks like you installed xine via some package manager.
  110. So I'll just guess that you are using the standard locations.
  111. If you want me to be sure about those file locations, you can install
  112. the xine-lib development package, which is usually called 
  113. 'xine-lib-devel', 'xine-devel', 'libxine-dev' or similar.
  114. That package contains xine-config, but this is not really needed to
  115. run xine...
  116.  
  117. no-xine-config no xine-config on this machine.
  118. This means that xine-lib is either not installed 
  119. or it is installed in a very unusual place.
  120. So you should probably install xine-lib before running xine-check...
  121.  
  122. xine-config-executable \$xine_config is executable
  123. Looks like xine-config permissions are set correctly.
  124.  
  125. xine-config-not-executable \$xine_config is NOT executable
  126. There's something wrong with the permissions of xine-config
  127. in your installation of xine-lib. This could be fixed by issuing
  128.  chmod a+rx \$xine_config
  129. as root. But there's probably something more seriously wrong,
  130. so I'll advise you to reinstall xine-lib.
  131.  
  132. custom-exec-prefix Your xine-lib uses a customized exec-prefix
  133. I'll assume you knew what you were doing when you configured it,
  134. I won't do any further xine-lib location checks...
  135.  
  136. plugindir-exists plugin directory \$plugindir exists.
  137. This directory should hold all kinds of xine plugins.
  138.  
  139. unknown-plugin found unknown plugin: \$i
  140. I don't know any xine plugins that follow this naming scheme.
  141. Maybe this is a leftover from obsolete xine versions.
  142. Maybe you need to upgrade me (xine-check)so I know about this
  143. (new) kind of plugin...
  144.  
  145. no-plugindir no plugin directory (\$plugindir)
  146. The plugin-directory doesn't exist. xine-config claims that there
  147. is a plugin directory at \$plugindir.
  148. However, there is no such directory.
  149. You probably need to reinstall xine-lib.
  150.  
  151. found-plugins found \$type plugins
  152. These \$type plugins have been found:
  153. \$plugins
  154.  
  155. missing-plugins There are no \$type plugins.
  156. xine needs at least one \$type plugin, but none is installed.
  157. You should probably reinstall xine-lib...
  158.  
  159. unknown-plugindir unable to determine plugin directory
  160. I could not determine your plugin directory. That would be much easier
  161. if you had xine-config installed (see message above)...
  162. Note that I could not check your xine plugins.
  163.  
  164. unknown-skindir unable to determine skin directory
  165. I could not determine your skin directory. That would be much easier
  166. if you had xine-config installed (see message above)...
  167. Note that I could not check your xine-ui skins.
  168.  
  169. skindir-exists skin directory \$skindir exists.
  170. This directory should hold all xine skins.
  171.  
  172. no-skindir no skin directory (\$skindir)
  173. The skin-directory doesn't exist. xine-config claims that there
  174. is a skin directory at \$skindir.
  175. However, there is no such directory.
  176. You probably need to reinstall xine-ui.
  177.  
  178. logo-exists found logo in \$skindir
  179. This indicates that the skins have actually been installed there...
  180.  
  181. no-xine-logo xine logo not found in \$skindir.
  182. You should probably (re)install xine-ui, as it won't run without logo.
  183.  
  184. found-skins I even found some skins.
  185. These skins have been found:
  186. \$skins
  187.  
  188. no-skins There are no skins.
  189. Looks like the skins haven't been installd in \$skindir.
  190. You should reinstall xine-ui, as it won't run without any skins...
  191.  
  192. several-xine multiple xine executables found
  193. I have found multiple xine executables on your machine:
  194. \$xine_executables
  195. xine is the main player as installed by the xine-ui package.
  196. You should probably uninstall the instances you don't use...
  197.  
  198. found-xine found the player at \$xine_executables
  199. The 'xine' binary has been found. This indicates that you
  200. have xine-ui installed.
  201.  
  202. no-xine unable to find 'xine' binary in usual places
  203. Maybe you don't have xine-ui installed, maybe you have instlled
  204. it in a strange location, let's see if it's in your PATH...
  205.  
  206. several-xine-in-path multiple xine executables found in your PATH
  207. I have found more than one occurance of 'xine' in your PATH:
  208. \$xine_executable1
  209. You have probably installed xine-ui more than once, or the directory
  210. where you have installed xine occurs more than once in your PATH.
  211. Technically, this is not really a problem, but it's probably
  212. somewhat confusing, as it's not obvious, which xine you're using.
  213. You should probably uninstall the copies that you don't use...
  214. Further tests assume, you're using \$xine_executable
  215.  
  216. xine-in-path \$xine_executable is in your PATH
  217.  
  218. no-xine-in-path There is no 'xine' executable in your PATH
  219. Maybe you don't have xine-ui installed?
  220. If xine-ui is installed, it would probably be a good idea to add
  221. it's binary directory to your PATH...
  222.  
  223. using-linux you're using Linux, doing specific tests
  224. I can do some additional checks on Linux systems. Most of them check
  225. for Linux-specific properties...
  226.  
  227. have-procfs looks like you have a /proc filesystem mounted.
  228. Many system parameters can be read from the pseudo-files in proc,
  229. as provided by the procfs.
  230. I'll now check some of those...
  231.  
  232. kernel-1.x Kernel 1.x?? You must be kidding...
  233. This kernel definitely lacks DVD support and probably much more...
  234.  
  235. kernel-2.2.old Your kernel is older than 2.2.17.
  236. These kernels didn't have DVD support, so you will have to upgrade
  237. your kernel in order to watch DVDs. If you don't care about DVDs,
  238. xine will run fine, showing you any kind of VCD, file or
  239. network stream that xine supports...
  240.  
  241. kernel-2.2.new You're running a recent 2.2.x kernel.
  242. These kernels already have DVD support and anything else
  243. (except maybe raw devices) that's useful for xine.
  244.  
  245. kernel-2.4.bad Kernel version between 2.4.10 and 2.4.16
  246. These kernel versions have been reported to have various bugs,
  247. some serious security issues, some DVD specific problems.
  248. You shold probably upgrade to a recent stable kernel.
  249.  
  250. kernel-2.4.good You seem to have a reasonable kernel version (\$KERNEL_VERSION)
  251. I've detected a recent 2.4.x kernel, which should have support for
  252. DVD devices, as well as anything else that could accelerate
  253. video playback.
  254.  
  255. kernel-recent You seem to have a reasonable kernel version (\$KERNEL_VERSION)
  256. I've detected a recent 2.6 (or newer) kernel, which should have support for
  257. DVD devices, as well as anything else that could accelerate video playback.
  258.  
  259. kernel-pre-2.2 seems like you're running a pre-2.2 kernel.
  260. for DVD support you need to upgrade to a recent 2.2 or 2.4 kernel.
  261.  
  262. kernel-unknown ummm, you're running a strange kernel version.
  263. Your kernel says, it's version \$KERNEL_VERSION, but I don't know
  264. anything about this version. That probably means
  265. You should either upgrade your kernel or upgrade this script.
  266.   
  267. arch-i386-mtrr intel compatible processor, checking MTRR support
  268. video performance can be greatly improved if there is a way to
  269. make the cache controller access video memory directly. MTRRs
  270. allow the X server to do this on i386 and compatible processors...
  271.  
  272. mtrr-not-configured you have MTRR support but it's unused.
  273. It seems like your X server didn't set any MTRR ranges for the
  274. graphics card. Maybe upgrading your X server helps...
  275. You don't have a PCI graphics card, do you? AFAIK, MTRR only
  276. helps with AGP cards.
  277.  
  278. mtrr-set you have MTRR support and there are some ranges set.
  279. This probably means that your X server has set MTRR ranges for
  280. your graphics memory, which can give a significant performance
  281. increase when writing big amounts of (video) data.
  282.  
  283. no-mtrr no MTRR support in kernel.
  284. If you have an AGP graphics card, you can probably get some
  285. performance improvements if you recompile your kernel with
  286. MTRR support.
  287.  
  288. arch-non-i386 Architecture is \$ARCH (not intel), assuming there is no MTRR.
  289. MTRR (Memory Type Range Registers) are used on intel CPUs to
  290. control caching mechanisms for special memory ranges. There is
  291. probably nothing like this on \$ARCH CPUs...
  292.  
  293. no-procfs You don't seem to have a /proc filesystem
  294. The /proc filesystem provides an interface to most of the Linux
  295. kernel's parameters. All major distributions have been using this
  296. interface for years now...
  297. There's probably something wrong with your system setup.
  298. You should consider reinstalling or upgrading your machine.
  299.     
  300. unknown-os unknown operating system (\$OS)
  301. I don't know anything specific about your '\$OS' operating system.
  302. some of the following checks might fail for unknown reasons...
  303.  
  304. have-cdrom /dev/cdrom points to \$CDROM
  305. You have a /dev/cdrom device, which is the default that xine
  306. will use for VCD or audio CD playback.
  307.  
  308. no-cdrom You don't have a /dev/cdrom device.
  309. This is the default device that xine uses for playing VCDs or CDs.
  310. You could make your life easier by creating a symlink named /dev/cdrom
  311. pointing to your real CD device (something like /dev/scd0 or /dev/hdc).
  312. If your cdrom device is /dev/hdb (slave ATAPI device on primary bus),
  313.   ln -s hdb /dev/cdrom
  314. typed as root will give you the symlink.
  315. Alternatively, you can configure xine to use the real device directly,
  316. using the setup dialog within xine.
  317.  
  318. cdrom-not-readable /dev/cdrom points to \$CDROM, but that's unreadable.
  319. Looks, like you have a /dev/cdrom device that points to your CD-ROM
  320. drive. That is good, as xine uses this device to read VCDs or audio CDs
  321. by default.
  322. However, you don't have permission to read from this device, so you
  323. won't be able to use it, at least not with this account, that's bad...
  324. Most people nowadays fix this by using a 'cdrom' group:
  325. make sure, that you have a group named 'cdrom', become root and type
  326. chgrp cdrom \$CDROM
  327. chmod g+r \$CDROM
  328. Now you only have to make sure you're in the cdrom group. The command
  329. id -a
  330. (executed as normal user) should tell you. Some systems add users to
  331. the 'cdrom' group when they log in from a local console. If yours
  332. doesn't, you'll have to add yourself to that group using your system's
  333. user management tools...
  334.  
  335. dvdrom-not-rw /dev/dvd points to \$DVDROM, no r/w permissions
  336. Looks, like you have a /dev/dvd device that points to your DVD-ROM
  337. drive. That is good, as xine uses this device to read DVDs by
  338. default.
  339. However, you don't have read/write permissions for this device, so you
  340. won't be able to use it, at least not with this account, that's bad...
  341. If you're wondering about write permissions: they're needed to set
  342. some DVD-specific modes on the drive.
  343. Many people nowadays fix this by using a 'cdrom' group:
  344. make sure, that you have a group named 'cdrom', become root and type
  345. chgrp cdrom \$DVDROM
  346. chmod g+rw \$DVDROM
  347. Now you only have to make sure you're in the cdrom group. The command
  348. id -a
  349. (executed as normal user) should tell you. Some systems add users to
  350. the 'cdrom' group when they log in from a local console. If yours
  351. doesn't, you'll have to add yourself to that group using your system's
  352. user management tools...
  353.  
  354. have-dvdrom /dev/dvd points to \$DVDROM
  355. You have a /dev/dvd device, which is the default that xine
  356. will use for DVD playback.
  357.  
  358. no-dvdrom You don't have a /dev/dvd device.
  359. This is the default device that xine uses for playing DVDs.
  360. You could make your life easier by creating a symlink named /dev/dvd
  361. pointing to your DVD device (something like /dev/scd0 or /dev/hdc).
  362. If your DVD-ROM device is /dev/hdb (slave ATAPI device on primary bus),
  363.   ln -s hdb /dev/dvd
  364. typed as root will give you the symlink.
  365. Alternatively, you can configure xine to use the real device directly,
  366. using the setup dialog within xine, but I can't check your DMA 
  367. settings in that case...
  368.  
  369. dangling-dvdrom /dev/dvd is \$DVDROM, not a DVD device
  370. /dev/dvd is the default device that xine uses for playing DVDs.
  371. You could make your life easier by creating a symlink named /dev/dvd
  372. pointing to your DVD device (something like /dev/scd0 or /dev/hdc).
  373. If your DVD-ROM device is /dev/hdb (slave ATAPI device on primary bus),
  374.   rm /dev/dvd
  375.   ln -s hdb /dev/dvd
  376. typed as root will give you the symlink.
  377. Alternatively, you can configure xine to use the real device directly,
  378. using the setup dialog within xine, but I can't check your DMA 
  379. settings in that case...
  380.  
  381. dvd-dma-disabled DMA is disabled for your DVD interface.
  382. This will probably result in a serious performance hit when
  383. playing DVDs. You can issue the command
  384.   hdparm -d1 \$DVDROM
  385. as root to enable DMA. It would be wise to add this command to
  386. some script that is executed executed at boot time.
  387. Note that you probably have to set the DMA mode for your drive as well.
  388. Most DVD-ROMs work fine with multiword DMA mode 2. You can use
  389.   hdparm -d1 -X34 \$DVDROM
  390. (as root again) to set this mode. Maybe UDMA2 will give you even better
  391. performance, but it only works well with some controllers. You'll
  392. probably need UDMA capable IDE cables for this mode. If you want
  393. to try: make backups of your important data and type (as root again)
  394.   sync
  395.   hdparm -d1 -X66 \$DVDROM
  396. If your System still works fine after this, you probably want to keep
  397. these settings (add them to some boot script).
  398. If your system hangs or behaves very strangely after a few minutes, you
  399. should reboot immediately and never use this setting again on this
  400. machine. Good luck ;-)
  401.  
  402. dvd-dma-enabled DMA is enabled for your DVD drive
  403. This should give you good DVD performance without unnecessary CPU
  404. abuse.
  405.  
  406. no-hdparm I didn't find the 'hdparm' command.
  407. 'hdparm' is used on some systems (especially Linux) to set ATAPI drive
  408. parameters. In particular, this is needed with some drive/kernel
  409. combinations to enable DMA transfers.
  410. I would check this for you if you re-run me after installing hdparm...
  411.  
  412. dvd-not-atapi Your DVD drive seems not to be attached via ATAPI.
  413. This might be due to the use of an ide-scsi emulation.
  414. If you really have a SCSI DVD drive, your SCSI controller is likely
  415. to do perfect DMA, so there's no reason to worry about this.
  416. However, if you're using ide-scsi, there is a chance that DMA is
  417. disabled for the DVD drive. Moreover, I don't know how to enable
  418. DMA in that case, so you probably have to live with some performance
  419. loss. (FIXME: check for /proc/ide, provide solution)
  420.  
  421. no-display No DISPLAY found. Need X to check X...
  422. There is not DISPLAY variable set. This indicates that I'm not
  423. having access to an X display. I could check some X properties
  424. if you run me, as you would run xine, from an X terminal emulator...
  425.  
  426. have-xv found xvinfo: \$XVIDEO
  427. At least that's what xvinfo said. Let's see...
  428.  
  429. have-yv12 your Xv extension supports YV12 overlays (improves MPEG performance)
  430. Your display claims to be capable of converting YUV colorspace to
  431. RGB in hardware. This should improve performance when playing MPEG
  432. video, as xine doesn''t have to do this job in software...
  433.  
  434. no-yv12 Your X server doesn't support YV12 overlays.
  435. That means xine will have to to color space transformation and scaling
  436. in software, which is quite CPU intensive. Maybe upgrading your
  437. X server will help here.
  438. If you have an ATI card, you'll find accelerated X servers on
  439.    http://www.linuxvideo.org/gatos/
  440.  
  441. have-yuy2 your Xv extension supports YUY2 overlays
  442. Your display claims to be capable of converting packed YUV colorspace
  443. (aka. YUY2) to RGB in hardware. This should improve performance when
  444. playing some streams (DivX in particular), as xine doesn''t have to
  445. do this job in software...
  446.  
  447. xv-broken-hint Xv overlays detected, but can't check if it works...
  448. I can't check if Xv is broken, so if xine hangs when playing video,
  449. try 'xine -V XShm'. If that works (but is slow), your X server is broken.
  450. You should try to upgrade your X server in that case. Good luck... 
  451.  
  452. no-yuy2 Your X server doesn't support YV12 overlays.
  453. That means xine will have to to color space transformation and scaling
  454. in software, which is quite CPU intensive. Maybe upgrading your
  455. X server will help here.
  456. If you have an ATI card, you'll find accelerated X servers on
  457.    http://www.linuxvideo.org/gatos/
  458.  
  459. xv-planes Xv ports: \$planes
  460. Your X server reported that it supports these kinds of video overlay.
  461. That means, there is some hardware support for video.
  462.  
  463. no-xv-in-server Your X server doesn't have any XVideo support...
  464. XVideo is an X server extension introduced by XFree86 4.x. This
  465. extension provides access to hardware accelerated color space
  466. conversion and scaling, which gives a great performance boost.
  467. If you have a fast (>1GHz) machine, you may be able to watch all
  468. kinds of video, anyway. You will waste lots of CPU cycles, though...
  469.  
  470. no-xvinfo The 'xvinfo' binary hasn't been found.
  471. Xv is the X Video extension and xvinfo is a diagnostic tool for Xv.
  472. xine can use Xv to support hardware accelerated scaling and color space
  473. conversion of videos, which increases performance, especially on slow
  474. machines.
  475. Xv has been introduced with XFree86 4.0, so if you're still using an older
  476. X server, you might consider an upgrade.
  477. Note: You also need a Graphics card that has Xv driver support.
  478.       You might want to check the XFree86 homepage before upgrading:
  479.       http://www.xfree86.org
  480.  
  481.  
  482. EOF
  483.  
  484. case "$0" in
  485.   *-bugreport)
  486.     runmode=bugreport
  487.     ;;
  488. esac
  489.  
  490.  
  491. clean_exit() {
  492.     cd /
  493.     rm -rf $tmpdir
  494.     exit "$@"
  495. }
  496.  
  497. search() {
  498.   test="-f"
  499.   case "$1" in
  500.     -?)
  501.        test="$1"
  502.        shift
  503.     ;;
  504.   esac
  505.   target="$1"
  506.   path="$2"
  507.   test -z "$path" && path=$COMMON_PLACES
  508.   found=""
  509.   for dir in `echo "$path"|sed -e 's/:/ /g'`; do
  510.     if test $test "$dir/$target"; then
  511.     if [ -z "$found" ]; then
  512.       found="$dir/$target"
  513.     else
  514.       found="$found
  515. $dir/$target"
  516.     fi
  517.     fi
  518.   done
  519.   test -n "$found"
  520. }
  521.  
  522. log() {
  523.   [ -n "$logfile" ] && echo "$@" >>$logfile
  524. }
  525.  
  526. add() {
  527.   [ -n "$bugreport" ] && echo "$@" >>$bugreport
  528. }
  529.  
  530.  
  531. resolve_symlink() {
  532.     target="$1"
  533.     while test -h "$target"; do
  534.     local dir=`dirname $target`
  535.     target=`ls -l $target | sed -e 's/^.*-> //'`
  536.     if echo $target|grep -v ^/ >/dev/null 2>&1; then 
  537.       target="$dir/$target"
  538.     fi
  539.     done
  540.     echo "$target"
  541. }
  542.  
  543. check_perm(){
  544.     if [ "$#" -ne 2 ]; then
  545.       echo "internal error: invalid check_perm parameter count" >&2
  546.     fi
  547.     result=true
  548.     case "$1" in
  549.     *r*)
  550.         test -r "$2" || result=false
  551.         ;;
  552.     esac
  553.     case "$1" in
  554.     *w*)
  555.         test -w "$2" || result=false
  556.         ;;
  557.     esac
  558.     case "$1" in
  559.     *x*)
  560.         test -x "$2" || result=false
  561.         ;;
  562.     esac;
  563.     $result
  564. }
  565.  
  566.  
  567. # prompt/wait for <enter>
  568. confirm() {
  569.    echo "${indent}press <enter> to continue..."
  570.    read foo;
  571. }
  572.  
  573.  
  574. # get (possibly localized) message descriptions for message id
  575. # usage: getmessage <id>
  576. # where <id> is the message id
  577. # this function will set
  578. # $short       = short (<70 char) message
  579. # $description = verbose description of the issue, including any instructions
  580. getmessage(){
  581.     id="$1"
  582.     headline=false
  583.     found=false
  584.     short=
  585.     description=
  586.     tmpfile=$tmpdir/xine-check-dsc
  587.     true >$tmpfile
  588.     cat $messagefile | while read line; do
  589.     if $found; then
  590.       if test -n "$line"; then
  591.         eval "echo \"$line\" |sed -e \"s/^/$indent/\" >>$tmpfile"
  592.       else
  593.         found=false #end of description
  594.     fi
  595.     else
  596.       if $headline; then
  597.         set -- $line
  598.         if [ "$1" = "$id" ]; then
  599.         found=true;
  600.         shift
  601.         eval "echo \"$*\" >>$tmpfile"
  602.         $do_log && log "$status $id"
  603.         fi
  604.         else
  605.         if [ x"$line" = x ]; then
  606.         headline=true
  607.         else
  608.         headline=false
  609.         fi
  610.       fi
  611.     fi
  612.     done
  613.     short=`head -1 <$tmpfile`
  614.     description="`tail +2 <$tmpfile`"
  615.     rm $tmpfile
  616.     if test -z "$short"; then
  617.       echo "internal error: no message for $id" >&2
  618.     fi
  619. }
  620.  
  621.  
  622.  
  623. # give a standard message to the user
  624. # usage: msg <id> [<status>]
  625. # where <id> is the name of the message
  626. # and <status> is one of
  627. # 0 - okay, everything's fine
  628. # 1 - hint for possible problem
  629. # 2 - ouch! something's really wrong
  630. # if <status> is not given, use the return code from previous command
  631. msg(){
  632.     status=$?
  633.     id="$1"
  634.     shift
  635.     if [ "$#" -eq 1 ]; then
  636.       status="$1"
  637.       shift
  638.     fi
  639.     if [ "$#" -ne 0 ]; then
  640.     echo "internal error: msg with illegal parms">&2
  641.     clean_exit 1
  642.     fi
  643.     getmessage "$id"
  644.     case "$status" in
  645.     0)
  646.         echo "[ good ] $short"
  647.         if $verbose; then
  648.           echo "$description"
  649.         fi
  650.         ;;
  651.     1)
  652.         echo "[ hint ] $short"
  653.         if $quiet; then
  654.           echo "         type '$0 explain $id' for more"
  655.         else
  656.           echo "$description"
  657.           $batch || confirm
  658.         fi
  659.         ;;
  660.     2)
  661.         echo "[OUCH!!] $short"
  662.         if $quiet; then
  663.           echo "         type '$0 explain $id' for more"
  664.         else
  665.           echo "$description"
  666.           $batch || confirm
  667.         fi
  668.         ;;
  669.     ex)
  670.         echo "message $id:"
  671.          echo "* $short"
  672.         echo "$description"
  673.         ;;
  674.     -)
  675.         oldindent="$indent"
  676.         indent=""
  677.         echo "$description"
  678.         indent="$oldindent"
  679.         ;;
  680.     *)
  681.         echo "internal error: unknown status ($status)" >&2
  682.         clean_exit 1
  683.         ;;
  684.     esac
  685.     
  686. }
  687.  
  688. vars(){ #add to the list of variables to dump
  689.   DUMPVARS="$DUMPVARS $*"
  690. }
  691.  
  692.  
  693. menu(){
  694.   n=0
  695.   answertext=""
  696.   while [ "$answertext" = "" ]; do
  697.     for i in "$@"; do
  698.     n=`expr $n + 1`
  699.     echo "${n}) $i"
  700.     done
  701.     echo -n "please select (1..${n}): " #FIXME: anybody need echo "...\c" here?
  702.     read answer
  703.     n=0
  704.     for i in "$@"; do
  705.     n=`expr $n + 1`
  706.     if [ $n -eq "$answer" ]; then
  707.       answertext="$i"
  708.       answer=$n #the pure number, strip all junk
  709.     fi
  710.     done
  711.     [ "$answertext" = "" ] && echo 'please enter a number between 1 and '$n'!'
  712.   done
  713. }
  714.  
  715. yesno() {
  716.   echo "$* (y/n)?"
  717.   read answer
  718.   case "$answer" in
  719.     y*)
  720.     true;;
  721.     n*)
  722.     false;;
  723.     *)
  724.     echo "'pardon?? neither yes nor no? assuming no..."
  725.      false;;
  726.   esac
  727. }
  728.  
  729. ask() {
  730.   echo "$@"
  731.   read answer
  732. }
  733.  
  734.  
  735. # command line
  736. while [ "$#" -gt 0 ]; do
  737.   case "$1" in
  738.     -q|--quiet)
  739.       quiet=true
  740.       shift
  741.       ;;
  742.     -v|--verbose)
  743.       verbose=true
  744.       shift
  745.       ;;
  746.     -B|--batch)
  747.       batch=true
  748.       shift
  749.       ;;
  750.     -b|--bug|--bugreport)
  751.       runmode=bugreport
  752.       shift
  753.       ;;
  754.     explain|-e)
  755.       indent=
  756.       msg "$2" ex
  757.       clean_exit 0
  758.       ;;
  759.     *)
  760.     cat <<EOF
  761. xine-check version $VERSION
  762.  
  763. This script will check your system, to see if it is ready for playing
  764. video with xine.
  765.  
  766. usage: $0 [options] 
  767.  
  768. options may be one of these:
  769. -q  --quiet    only give one-line messages, even for found problems
  770. -v  --verbose  describe each check in detail (produces kind of FAQ)
  771. -B  --batch    do not wait for confirmation after long messages
  772. -b  --bug      produce a terse description, (NOT YET IMPLEMENTED)
  773. EOF
  774.     clean_exit 0
  775.     ;;
  776.   esac
  777. done
  778.  
  779.  
  780. if [ "$runmode" = "bugreport" ]; then
  781.   do_log=true
  782.   logfile=$tmpdir/xine-check.log
  783.   echo logging to ${logfile}...
  784.   echo >$logfile
  785. fi
  786.  
  787.  
  788.  
  789. ## actual checks start here:
  790.  
  791. case `id` in
  792. uid=0*) msg root 2;;
  793. esac
  794.  
  795.  
  796. # operating system dependant checks
  797.  
  798. UNAME=`uname -a`
  799. OS=`uname -s`
  800. ARCH=`uname -m||arch`
  801. DISTRO=unknown
  802. vars UNAME OS ARCH DISTRO
  803.  
  804. if test -f /etc/debian_version; then
  805.   DISTRO=Debian
  806.   DEBIAN_VERSION="`cat /etc/debian_version`"
  807.   vars DEBIAN_VERSION
  808. fi
  809. if test -f /etc/redhat-release; then
  810.   DISTRO=RedHat
  811.   REDHAT_RELEASE="`cat /etc/redhat-release`"
  812.   vars REDHAT_RELEASE
  813. fi
  814. if test -f /etc/VERSION; then
  815.   LINUX_VERSION="`cat /etc/VERSION`"
  816.   vars LINUX_VERSION
  817. fi
  818.  
  819. case "$OS" in
  820.   Linux)
  821.     [ "$DISTRO" = "unknown" ] && DISTRO="unknown_Linux"
  822.     msg using-linux 0
  823.     if test -f /proc/version; then
  824.       msg have-procfs 0
  825.       KERNEL_VERSION=`awk '{print $3}' </proc/version`
  826.       KERNEL_SUBMINOR=`echo $KERNEL_VERSION | sed -e 's/^.\..\.//' -e 's/[^0-9].*$//'`
  827.       case "$KERNEL_VERSION" in
  828.         1.*)
  829.       msg kernel-1.x 2
  830.       ;;
  831.         2.2.*)
  832.       if [ "$KERNEL_SUBMINOR" -lt 17 ]; then
  833.         msg kernel-2.2.old 1
  834.       else
  835.         msg kernel-2.2.new 0
  836.       fi
  837.       ;;
  838.     2.4.*)
  839.       if [ "$KERNEL_SUBMINOR" -gt 10 -a "$KERNEL_SUBMINOR" -lt 16 ]; then
  840.         msg kernel-2.4.bad 1
  841.       else
  842.         msg kernel-2.4.good 0
  843.       fi
  844.       ;;
  845.     2.5.*|2.6.*|2.7.*)
  846.        msg kernel-recent 0
  847.        ;;
  848.     2.*)
  849.       msg kernel-pre-2.2 1
  850.       ;;
  851.     *)
  852.       msg kernel-unknown 1
  853.       ;;
  854.       esac
  855.  
  856.       vars KERNEL_VERSION
  857.  
  858.       # MTRR support
  859.       case "$ARCH" in
  860.         i?86|k6|k7|athlon)
  861.       msg arch-i386-mtrr
  862.       if test -f /proc/mtrr; then
  863.         if [ `wc -l </proc/mtrr` -lt 2 ]; then
  864.         msg mtrr-not-configured 1
  865.         else
  866.           msg mtrr-set 0
  867.         fi
  868.       else
  869.         msg no-mtrr 2
  870.       fi
  871.       ;;
  872.     *)
  873.       msg arch-non-i386 1
  874.       ;;
  875.       esac
  876.     else
  877.     msg no-procfs 2
  878.     fi
  879.     ;;
  880.   *)
  881.     msg unknown-os 1
  882.     ;;
  883. esac
  884.  
  885. # search for xine executable
  886.  
  887. xine_executables=""
  888. if search -x bin/xine; then
  889.   xine_executables="$found"
  890.   if [ `echo "$xine_executables" | wc -l` -gt 1 ]; then
  891.     msg several-xine 1
  892.   else
  893.     msg found-xine 0
  894.   fi
  895. else
  896.   msg no-xine 0
  897. fi
  898.  
  899.  
  900. # search for xine executable in PATH
  901.  
  902. xine_executable=""
  903. if search -x xine "$PATH"; then
  904.   xine_executable1=`echo "$found"|sort|uniq`
  905.   if [ `echo "$xine_executable1" | wc -l` -gt 1 ]; then
  906.     xine_executable=`echo "$xine_executable1" | head -1`
  907.     msg several-xine-in-path 1
  908.   else
  909.     xine_executable="$xine_executable1"
  910.     msg xine-in-path 0
  911.   fi
  912. else
  913.   msg no-xine-in-path 2
  914. fi
  915.  
  916. vars xine_executable xine_executables
  917.  
  918. # search for xine-config in PATH
  919.  
  920. xine_config=""
  921. if search -x xine-config "$PATH"; then
  922.   xine_config=`echo "$found"|sort|uniq`
  923.   if [ `echo "$xine_config" | wc -l` -gt 1 ]; then
  924.     xine_configs="$xine_config"
  925.     xine_config=`echo "$xine_configs" | head -1`
  926.     msg several-xine-config 1
  927.   else
  928.     msg xine-config-in-path 0
  929.   fi
  930. else
  931.   if search -f bin/xine-config; then
  932.     xine_config="$found";
  933.     if [ `echo "$xine_config" | wc -l` -gt 1 ]; then
  934.       xine_configs="$xine_config"
  935.       xine_config=`echo "$xine_configs" | head -1`
  936.       msg several-xine-config 1
  937.     else
  938.       msg xine-config-somewhere 0
  939.     fi
  940.     if test -x "$xine_config"; then
  941.       msg xine-config-executable
  942.     else
  943.       msg xine-config-not-executable 2
  944.       xine_config=""
  945.     fi
  946.   else
  947.     if [ "$xine_executable" = "/usr/bin/xine" ]; then
  948.        xine_prefix=/usr
  949.        plugindir=/usr/lib/xine/plugins
  950.        skindir=/usr/share/xine/skins
  951.        case "$DISTRO" in
  952.      Debian)
  953.         msg assuming-xine-package-deb 1
  954.         ;;
  955.      RedHat)
  956.         msg assuming-xine-package-rpm 1
  957.         ;;
  958.      *)
  959.         msg assuming-xine-package 1
  960.         ;;
  961.        esac
  962.     else
  963.       msg no-xine-config 2
  964.     fi
  965.   fi
  966. fi
  967.  
  968. vars xine_configs xine_config xine_prefix plugindir skindir
  969.  
  970. if test -n "$xine_config"; then
  971.   xine_prefix=`$xine_config --prefix`
  972.   if [ "$xine_prefix" != `$xine_config --exec-prefix` ]; then
  973.     custom-exec-prefix 1
  974.   else
  975.     plugindir=`$xine_config --plugindir`
  976.     datadir=`$xine_config --datadir`
  977.     skindir="$datadir/skins" #FIXME: guesswork...
  978.   fi
  979. fi
  980.   
  981. ## consistency checks of xine-lib installation
  982. if test -n "$plugindir"; then
  983.   if test -d "$plugindir"; then
  984.       vars input demux decoder video_out
  985.       msg plugindir-exists
  986.       input=
  987.       demux=
  988.       decoder=
  989.       video_out=
  990.       audio_out=
  991.       cd $plugindir
  992.       for i in *.so; do
  993.     case "$i" in
  994.       xineplug_inp_*)
  995.         type=input;
  996.         pfx=xineplug_inp_;
  997.         ;;
  998.       xineplug_dmx_*)
  999.         type=demux;
  1000.         pfx=xineplug_dmx_;
  1001.         ;;
  1002.       xineplug_decode_*)
  1003.         type=decoder;
  1004.         pfx=xineplug_decode_;
  1005.         ;;
  1006.       xineplug_vo_out_*)
  1007.         type=video_out;
  1008.         pfx=xineplug_vo_out_;
  1009.         ;;
  1010.       xineplug_ao_out_*)
  1011.         type=audio_out;
  1012.         pfx=xineplug_ao_out_;
  1013.         ;;
  1014.       *)
  1015.         type=unknown;
  1016.         pfx="";
  1017.         msg unknown-plugin
  1018.         ;;
  1019.     esac
  1020.     name=`echo $i | sed -e "s/^$pfx//" -e 's/.so$//'`
  1021.     eval $type=\"\$$type $name\"
  1022.       done
  1023.  
  1024.       for type in input demux decoder video_out audio_out; do
  1025.     eval plugins=\"\$$type\"
  1026.         if test -n "$plugins"; then
  1027.       msg found-plugins
  1028.     else
  1029.       msg missing-plugins 2
  1030.     fi
  1031.       done
  1032.   else
  1033.     msg no-plugindir 2
  1034.   fi
  1035. else
  1036.   msg unknown-plugindir 1
  1037. fi
  1038.  
  1039.  
  1040. if test -n "$skindir"; then
  1041.     if test -d "$skindir"; then
  1042.       msg skindir-exists
  1043.       cd $skindir
  1044.       if test -f xine-ui_logo.mpv; then
  1045.         msg logo-exists
  1046.       else
  1047.         msg no-xine-logo 2
  1048.       fi
  1049.       skins=
  1050.       for dir in *; do
  1051.         test -f "$dir/skinconfig" && skins="$skins $dir"
  1052.       done
  1053.       vars skins
  1054.       if test -n "$skins"; then
  1055.     msg found-skins
  1056.       else
  1057.         msg no-skins 2
  1058.       fi
  1059.     else
  1060.       msg no-skindir 2
  1061.     fi
  1062. fi
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068. # device tests
  1069.  
  1070. vars CDROM DVDROM
  1071.  
  1072. CDROM=`resolve_symlink /dev/cdrom`
  1073. if test -b "$CDROM"; then
  1074.   if test -r "$CDROM"; then
  1075.     msg have-cdrom
  1076.   else
  1077.     msg cdrom-not-readable
  1078.   fi
  1079. else
  1080.   msg no-cdrom 1
  1081. fi
  1082.  
  1083. DVDROM=`resolve_symlink /dev/dvd`
  1084. if test -b "$DVDROM"; then
  1085.   if check_perm rw "$DVDROM"; then
  1086.     msg have-dvdrom
  1087.   else
  1088.     msg dvdrom-not-rw
  1089.   fi
  1090. else
  1091.   if test -z "$DVDROM"; then
  1092.     msg no-dvdrom 1
  1093.   else
  1094.     msg dangling-dvdrom
  1095.     DVDROM=""
  1096.   fi
  1097. fi
  1098.  
  1099.  
  1100. # DMA settings
  1101. if test -r "$DVDROM"; then # only test DMA if we have a drive...
  1102.  
  1103.     search -x hdparm "$PATH" || search -x bin/hdparm || search -x sbin/hdparm;
  1104.     if test -n "$found"; then
  1105.       hdparm=`echo "$found"|head -1`
  1106.     fi
  1107.  
  1108.     case "$DVDROM" in
  1109.     */hd?|*/ide/*/cd|*/ata/*/cd)
  1110.         drivetype="ATAPI"
  1111.         ;;
  1112.     */scd?*|*/scsi/*/cd)
  1113.         drivetype="SCSI"
  1114.         ;;
  1115.     *)
  1116.         drivetype="unknown"
  1117.         ;;
  1118.     esac
  1119.     vars drivetype hdparm dma
  1120.     if test -n "$hdparm" && [ "$drivetype" = "ATAPI" ]; then
  1121.       dma=`$hdparm -d /dev/dvd | awk '$1 == "using_dma" {print $3}'`
  1122.       if [ 0"$dma" -eq 0 ]; then
  1123.     msg dvd-dma-disabled 1
  1124.       else
  1125.     msg dvd-dma-enabled 0 
  1126.       fi
  1127.     else
  1128.       if [ "$drivetype" != ATAPI ]; then
  1129.     msg dvd-not-atapi 1
  1130.       else
  1131.     msg no-hdparm 1
  1132.       fi
  1133.     fi
  1134.     
  1135. fi #have DVDROM
  1136.  
  1137.  
  1138. # X checks
  1139. if [ "x$DISPLAY" = "x" ]; then
  1140.     msg no-display 2
  1141. else
  1142.  
  1143. vars DISPLAY xvinfo XVIDEO YUV YUY2 planes
  1144.  
  1145. # Xv extension
  1146. search -x xvinfo "$PATH" || search -x bin/xvinfo;
  1147. if test -n "$found"; then
  1148.   xvinfo=`echo "$found"|head -1`
  1149.   XVIDEO=`$xvinfo|head -1`
  1150.   msg have-xv 0
  1151.   YUV=false
  1152.   YUY2=false
  1153.   planes=""
  1154.   for p in `$xvinfo|awk '$1=="id:" {print $3}' |sed -e 's/(//' -e 's/)//'`; do
  1155.     planes="$planes $p";
  1156.     case $p in
  1157.       YUY2|2YUY)
  1158.         YUY2=true
  1159.     ;;
  1160.       YV12|21VY)
  1161.         YUV=true
  1162.     ;;
  1163.     esac
  1164.   done
  1165.   if $YUV; then
  1166.     msg have-yv12
  1167.   else
  1168.     msg no-yv12
  1169.   fi
  1170.   if $YUY2; then
  1171.     msg have-yuy2
  1172.   else
  1173.     msg no-yuy2
  1174.   fi
  1175.   #if $YUV || $YUY2; then
  1176.   #  msg xv-broken-hint 1
  1177.   #fi
  1178.   if test -n "$planes"; then
  1179.     msg xv-planes 0
  1180.   else
  1181.     msg no-xv-in-server 1
  1182.   fi
  1183. else
  1184.   # no xvinfo found
  1185.   msg no-xvinfo 2
  1186. fi
  1187.  
  1188. fi #DISPLAY check
  1189.  
  1190. # dump variables for bug report
  1191. if [ "$runmode" = "bugreport" ]; then
  1192.   for var in $DUMPVARS; do
  1193.     eval log ${var}=\"\$$var\"
  1194.   done
  1195. else
  1196.   clean_exit 0    
  1197. fi
  1198.  
  1199. echo
  1200. echo
  1201. if yesno "Could you solve your xine problems using the previous hints?"; then
  1202.   echo 'Fine! It was a pleasure to help you. Any time again...'
  1203.   clean_exit
  1204. fi
  1205.  
  1206. echo
  1207. echo "What kind of trouble does xine cause for you?"
  1208. echo
  1209. menu "plays audio, but no video" \
  1210.      "plays video, but no audio"\
  1211.      "audio is interrupted and/or crackling"\
  1212.      "audio and video are out of sync"\
  1213.      "can't play DVDs"\
  1214.      "xine hangs instead of playing anything"\
  1215.      "xine doesn't start"\
  1216.      "something else"
  1217.  
  1218. if [ "$answertext" = "something else" ]; then
  1219.   echo "please describe your xine problem briefly in _one_ line ( < 65 characters):"
  1220.   read problem
  1221. else
  1222.   problem="$answertext"
  1223. fi
  1224. bugclass=$answer
  1225.  
  1226. echo
  1227.  
  1228. add "short description: $problem"
  1229.  
  1230. if test -n "$xine_config"; then
  1231.   lib_version=`$xine_config --version`
  1232. else
  1233.   lib_version=unknown
  1234. fi
  1235. add "xine-lib version: $lib_version"
  1236. add "xine --version says:"
  1237. add "`$xine_executable --version 2>&1`"
  1238. add ""
  1239.  
  1240. # problems involving audio drivers
  1241. case $bugclass in
  1242.   2|3|4)
  1243.     echo
  1244.     echo "What audio drivers are you using?"
  1245.     echo
  1246.     menu "OSS/Free (eg. Linux Kernel) drivers" \
  1247.      "ALSA, version 0.9.x" \
  1248.      "ALSA, version 0.5.x" \
  1249.      "older ALSA version" \
  1250.      "other driver"
  1251.     if [ $answer -eq 5 ]; then
  1252.       ask "What driver (name/version) are you using?"
  1253.       audio_driver="$answer"
  1254.     else
  1255.       audio_driver="$answertext"
  1256.     fi
  1257.     add "Audio driver: $audio_driver"
  1258.     ask "What sound card are you using?"
  1259.     add "Sound card: $answer"
  1260.     ;;
  1261. esac
  1262.  
  1263. # further checks for specific problems
  1264. case "$bugclass" in
  1265.   5) #can't play DVDs
  1266.     echo "which DVD plugin are you trying?"
  1267.     menu "DVD (as shipped with xine)" \
  1268.      "NAV (dvdnav from dvd.sourceforge.net)" \
  1269.      "d4d (by captain_css)" \
  1270.      "d5d (by captain_css)" \
  1271.      "dmd" \
  1272.      "other plugin, add the plugin name to the plugin version below"
  1273.     add   "used DVD plugin: $answertext"
  1274.     if [ $answer -ne 1 ]; then
  1275.       ask "What version of that plugin have you tried?"
  1276.       add "        version: $answer"
  1277.     fi 
  1278.     add "searching for libdvdread.so and libdvdcss.so gives:"
  1279.     search -r lib/libdvdread.so
  1280.     dvdlibs="$found"
  1281.     search -r lib/libdvdcss
  1282.     dvdlibs="$dvdlibs $found"    
  1283.     for lib in $dvdlibs; do
  1284.       add "$lib is `resolve_symlink $lib`"
  1285.     done
  1286.     add "(end of dvd lib list)"
  1287.     ;;
  1288.   6) #xine hangs
  1289.     echo "Please try to run xine using this command:"
  1290.     echo "xine -V XShm"
  1291.     echo "(you may add a MRL at the end of the command, if you want)"
  1292.     if yesno "Does this hang as well?"; then
  1293.       add "I tried 'xine -V XShm', but that hangs as well..."
  1294.     else
  1295.       echo
  1296.       echo "Okay, looks like we have found the problem:"
  1297.       echo "Your XVideo extension, ie your X server, is broken."
  1298.       echo "You have told xine to use XShm instead, which works, but consumes"
  1299.       echo "considerably more CPU time."
  1300.       echo "xine will remember this setting."
  1301.       echo "If xine runs fast enough with XShm, you can just leave it like that."
  1302.       echo "If it's too slow on your machine, you'll need a working"
  1303.       echo "XVideo extension. You'll have to upgrade your X server for that."
  1304.       echo "Please check with your distribution if they have a newer version"
  1305.       echo "of XFree86. If they don't, you'll have to look at www.xfree86.org."
  1306.       echo 'Good luck!'
  1307.       echo
  1308.       if yesno "Do you still want too report this as a xine bug?"; then
  1309.         echo
  1310.     echo "okay, I'll continue."
  1311.     echo "But note that your report is likely to be ignored if you don't"
  1312.     echo "report any xine bug. Broken X servers don't count..."
  1313.     add "xine-check thinks this is not a xine bug, but I do. (see below)"
  1314.     confirm
  1315.       else
  1316.         clean_exit 0
  1317.       fi
  1318.     fi
  1319.     ;;
  1320. esac
  1321.  
  1322. subject="bug: $problem"
  1323.  
  1324. echo
  1325. echo "You should include a _complete_ copy of xine's output in your bug report."
  1326. echo "Note, however, that there is a 40K limit on messages sent to the mailing list,"
  1327. echo "So you should strip down the parts that repeat over and over,"
  1328. echo "if there are any."
  1329. echo "You can either copy&paste this output from the terminal where you ran xine,"
  1330. echo "or you can collect xine's output in a file named $tmpdir/xine.out, "
  1331. echo "using this command:"
  1332. echo "xine --verbose=2 >$tmpdir/xine.out 2>&1"
  1333. echo "(assuming you have a Bourne compatible shell, like bash, for example)"
  1334. echo "If you need to add any parameters, you can do so..."
  1335. echo "This method is useful if you want to remove part of the output..."
  1336. echo "Which method would you prefer?"
  1337. menu "copy&paste" "logfile /tmp/xine.out"
  1338. add ""
  1339. add "xine output:"
  1340. add "-----------"
  1341.  
  1342. echo
  1343. if [ $answer -eq 1 ]; then
  1344.   echo "okay, please paste your xine output into this window and"
  1345.   echo 'PRESS CTRL-D on a new line TO FINISH! (sorry for shouting...)'
  1346.   cat >>"$bugreport"
  1347. else
  1348.   echo 'please press <return> when you have the log ready in'
  1349.   echo "$tmpdir/xine.out"
  1350.   if test -r $tmpdir/xine.out; then
  1351.     cat $tmpdir/xine.out >>"$bugreport"
  1352.     echo "Okay, got a copy of the log file. You may remove it, if you wish..."
  1353.   else
  1354.     echo
  1355.     echo "Hmmm, I could not read the $tmpdir/xine.out file."
  1356.     echo "Skipping this step."
  1357.     echo "You may add the output later, if this wasn't your intention..."
  1358.     confirm
  1359.     echo
  1360.   fi 
  1361. fi
  1362.  
  1363. add ""
  1364. add "additional description:"
  1365. add "----------------------"
  1366. add ""
  1367. add "PUT YOUR DESCRIPTION HERE"
  1368. add "(please replace these two lines by your complete problem description)"
  1369. add ""
  1370. add ""
  1371. add "system info, as found by xine-check:"
  1372. add "-----------------------------------"
  1373. cat "$logfile" >>$bugreport
  1374.  
  1375. echo
  1376. echo 'Okay.' "That's all I could guide you through..."
  1377. echo "I have assembled a skeleton for your bugreport in the file"
  1378. echo
  1379. echo "   $bugreport"
  1380. echo
  1381. echo "You're strongly encouraged to add a detailed description of your problem."
  1382. echo "Just look for 'additional description', and fill it in..."
  1383. echo
  1384. echo "When you're finished, you can use your favourite mailer to send it to"
  1385. echo "<xine-bugreport@xinehq.de>."
  1386. echo " Please use this subject line, or something even more descriptive:"
  1387. echo "Subject: $subject"
  1388.  
  1389. if search -x mail "$PATH" || search -x mailx "$PATH"; then
  1390.   mailer=`echo "$found"|head -1`
  1391.   echo "Alternatively, I could try to send the bug report for you, using"
  1392.   echo $mailer -s \""$subject"\"
  1393.   echo 'Please make sure to add the additional description before saying "yes"!' 
  1394.   if yesno "Do you want me to do this now?"; then
  1395.     $mailer -s "$subject" <"$bugreport" xine-bugreport@xinehq.de
  1396.     echo "okay, done."
  1397.     echo "If your machine is set up correctly to send mail to the internet,"
  1398.     echo "everything's fine and the message is on the way..."
  1399.     echo "Note that I cannot check if the mail went out correcly, so if you"
  1400.     echo "cannot send mails to the 'net using $mailer, you'll have to send"
  1401.     echo "the bugreport manually."
  1402.   fi
  1403. fi
  1404.  
  1405. echo "You'll find the data we just collected in $tmpdir"
  1406.  
  1407. echo 'Thanks for your bugreport! Have a nice day!' 
  1408.  
  1409.  
  1410.