The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / kodi / br-kodi
1 #!/bin/sh
2
3 # We're called with the real Kodi executable as
4 # first argument, followed by any Kodi extra args
5 KODI="${1}"
6 shift
7
8 # In case someone asked we terminate, just kill
9 # the Kodi process
10 trap_kill() {
11     LOOP=0
12     killall "${KODI##*/}"
13 }
14 trap trap_kill INT QUIT TERM
15
16 LOOP=1
17 while [ ${LOOP} -eq 1 ]; do
18     # Hack: BusyBox ash does not catch signals while a non-builtin
19     # is running, and only catches the signal when the non-builtin
20     # command ends. So, we just background the Kodi binary, and wait
21     # for it. But BusyBox' ash's wait builtin does not return the
22     # exit code even if there was only one job (which is correct
23     # for POSIX). So we explicitly wait for the Kodi job
24     "${KODI}" "${@}" &
25     wait %1
26     ret=$?
27     case "${ret}" in
28         0)  ;;
29         64) poweroff; LOOP=0;;
30         66) reboot;   LOOP=0;;
31         *)  # Crash
32             sleep 1
33             ;;
34     esac
35 done
36 exit ${ret}