Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hack/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ sh /data/hack/network.sh &
sh /data/hack/telnet.sh &
sh /data/hack/ftp.sh &
sh /data/hack/plugins.sh &
sh /data/hack/kodi_autostart.sh &
46 changes: 46 additions & 0 deletions hack/kodi_autostart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh
# kodi_autostart.sh — Auto-start Kodi when SD card is detected at boot.
# Scans /tmp/mnt/ for kodi.bin; UUID-independent.
#
# Place this file on the Boxee Box at: /data/hack/kodi_autostart.sh
# Then add this line to /data/hack/boot.sh:
# sh /data/hack/kodi_autostart.sh &

LOG=/tmp/kodi_autostart.log
echo "$(date): kodi_autostart.sh started" > $LOG

# Wait up to 60 seconds for the Kodi SD card to be automounted
KODI_DIR=""
for i in $(seq 1 60); do
for dir in /tmp/mnt/*/; do
if [ -x "${dir}kodi.bin" ]; then
KODI_DIR="${dir%/}"
break 2
fi
done
sleep 1
done

if [ -z "$KODI_DIR" ]; then
echo "$(date): kodi.bin not found in /tmp/mnt/ — Kodi SD card not present." >> $LOG
exit 1
fi

echo "$(date): Found Kodi at $KODI_DIR" >> $LOG

# Let the system settle before killing Boxee
sleep 3

killall Boxee BoxeeLauncher BoxeeHal 2>/dev/null
sleep 2

cd "$KODI_DIR" || exit 1

export HOME=/data
export KODI_HOME="$KODI_DIR"
export PYTHONHOME="$KODI_DIR/python2.7"
export PYTHONPATH="$KODI_DIR/python2.7:$KODI_DIR/python2.7/lib-dynload"
export LD_LIBRARY_PATH="$KODI_DIR/lib:$KODI_DIR:/opt/local/lib:/opt/boxee/lib:$LD_LIBRARY_PATH"

echo "$(date): Starting Kodi from $KODI_DIR (HOME=$HOME)" >> $LOG
exec ./kodi.bin >> $LOG 2>&1