Files
buildroot/package/kodi/br-kodi
Romain Naour 402b1afcdf package/kodi/br-kodi: fix shellcheck SC2086
Shellcheck 0.9.0 now report SC2086:

In package/kodi/br-kodi line 38:
exit ${ret}
     ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-02-09 14:50:28 +01:00

39 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# We're called with the real Kodi executable as
# first argument, followed by any Kodi extra args
KODI="${1}"
shift
# shellcheck disable=SC2329 # https://www.shellcheck.net/wiki/SC2329
# shellcheck disable=SC2317 # shellcheck 0.9.0 "spammy"
# 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}"