aboutsummaryrefslogtreecommitdiff
path: root/package/kodi/br-kodi
diff options
context:
space:
mode:
authorGravatar Bernd Kuhls <bernd.kuhls@t-online.de>2014-12-23 18:46:27 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-12-27 19:58:28 +0100
commit3578459748d80cd469729319543b199380a4370f (patch)
tree6e24ab45a2f8d7a729ae213a95f4cdf0854d4760 /package/kodi/br-kodi
parentbc5b451b5ea48eef88ed0713be0af1f65a3c015b (diff)
downloadbuildroot-3578459748d80cd469729319543b199380a4370f.tar.gz
buildroot-3578459748d80cd469729319543b199380a4370f.tar.bz2
package/xbmc: rename to 'kodi', the new upstream project name
Background information: http://xbmc.org/introducing-kodi-14. In a first step to bump version to 14.0-Helix, we move the xbmc package to a new directory called kodi. Appropriate Config.in.legacy variables are added. [Thomas: rename patches to the new convention.] Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/kodi/br-kodi')
-rwxr-xr-xpackage/kodi/br-kodi36
1 files changed, 36 insertions, 0 deletions
diff --git a/package/kodi/br-kodi b/package/kodi/br-kodi
new file mode 100755
index 0000000000..83d4d4e5ac
--- /dev/null
+++ b/package/kodi/br-kodi
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# We're called with the real Kodi executable as
+# first argument, followed by any Kodi extra args
+KODI="${1}"
+shift
+
+# In case someone asked we terminate, just kill
+# the Kodi process
+trap_kill() {
+ LOOP=0
+ killall "${KODI##*/}"
+}
+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 Kodi 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 Kodi job
+ "${KODI}" "${@}" &
+ wait %1
+ ret=$?
+ case "${ret}" in
+ 0) ;;
+ 64) poweroff; LOOP=0;;
+ 66) reboot; LOOP=0;;
+ *) # Crash
+ sleep 1
+ ;;
+ esac
+done
+exit ${ret}