kumquat-buildroot/package/xbmc/br-xbmc

37 lines
925 B
Plaintext
Raw Normal View History

xbmc: new package XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media. We do provide a sub-option for each major feature we support, to avoid letting the user hunt-down required libraries, since the dependency is not always obvious and straightforward. We also provide our own wrapper script, because the ones bundled in XBMC are not suitable to all platforms. We need such a wrapper script because XBMC exits with different exit codes, depending on how the user quit XBMC: 0 is normal exit, 64 is for halt, and 66 is for reboot. So we can't simply call the real XBMC binary from the startup script, or we would lose this information. So, we provide a wrapper script that takes appropriate action according to the above exit codes. When run as root from a startup script, there is no HOME set, so XBMC defaults to saving its configuration in /.xbmc (yes, at the root of the rootfs). Since this does not play well with read-only filesystems (and is inherently ugly anyway), and sicne there is no real clean way to tell XBMC where to store its configuration, just provide a symlink to a better place: /.xbmc -> /var/xbmc (note: the only location _guaranteed_ to be writable is /tmp, but we want the configuration to survive a reboot. So, /var/xbmc looks a better place than /var/run/xbmc. and the user will have to take action to ensure /var/xbmc be writable.) (note: for this reason, we do not want to set $HOME to /root either, even if it is root running XBMC.) Some of XBMC sub-options select libraries that depend on toolchain options, such as IPv6. But those are already covered, being also implicit dependencies of XBMC, as XBMC can only be used on an (e)glibc toolchain anyway. When^WIf XBMC is one day buildable under uClibc/musl, this will be time to revisit those dependencies. This package was originally found at : https://github.com/huceke/buildroot-rbp By gimli <ebsi4711@gmail.com> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: gimli <ebsi4711@gmail.com> Cc: Martin Bark <martin@barkynet.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-03-27 00:06:00 +01:00
#!/bin/sh
# We're called with the real XBMC executable as
# first argument, followed by any XBMC extra args
XBMC="${1}"
shift
# In case someone asked we terminate, just kill
# the XBMC process
trap_kill() {
LOOP=0
killall "${XBMC##*/}"
}
trap trap_kill INT QUIT TERM
LOOP=1
while [ ${LOOP} -eq 1 ]; do
# Hack: Busybox ash does not catch signals while a non-builtin
# is running, and only catches the signal when the non-builtin
# command ends. So, we just background the XBMC binary, and wait
# for it. But Busybox' ash's wait builtin does not return the
# exit code even if there was only one job (which is correct
# for POSIX). So we explicitly wait for the XBMC job
"${XBMC}" "${@}" &
wait %1
ret=$?
case "${ret}" in
0) ;;
64) halt; LOOP=0;;
66) reboot; LOOP=0;;
*) # Crash
sleep 1
;;
esac
done
exit ${ret}