xbmc/xbmc — pull request #5085 by veger (2014-07-23 21:25:32+00:00)
Title: [linux] Make checking for command existence more consistent and POSIX compatible

The 'which' commands does not return proper exit codes on Ubuntu (and apparently on lots of other distros as well, see [How to check if a program exists from a bash script?](http://stackoverflow.com/a/677212/246263))

So this pull request replaces ```which``` with ```command -v```, which is POSIX compatible and has consistent exit codes on all distros/operating systems.

Additionally, sometimes ```which > /dev/null``` was used and other times ```which >/dev/null 2>&1``` was used. This patch adds a function to check whether a command is available and therefore consistently uses ```command -v $1 >/dev/null 2>&1```

I checked this commit on Ubuntu 14.04: without the patch I get an error on this line:

systemd-coredumpctl dump -o core xbmc.bin &> /dev/null

as I do not have the ```system-coredumpctl``` command, and after the commit/patch the error is gone, as ```system-coredumpcl``` is not being called anymore.
As a result my xbmc crashes are properly dumped (again):

$ ./xbmc
Running DIL (3.22.0) Version
DtsDeviceOpen: Opening HW in mode 0
DtsDeviceOpen: Create File Failed
Fatal Python error: ceval: orphan tstate
Aborted (core dumped)
Crash report available at /home/xbmc/xbmc_crashlog-20140723_225513.log

Soon I will send my initial/actual debug report ;)