Skip to content

Instantly share code, notes, and snippets.

@shivasiddharth
Last active February 26, 2020 16:02
Show Gist options
  • Save shivasiddharth/c6d66185fc26d83e75459f095cc5c4a4 to your computer and use it in GitHub Desktop.
Save shivasiddharth/c6d66185fc26d83e75459f095cc5c4a4 to your computer and use it in GitHub Desktop.
Script to install Kodi
#!/bin/bash
set -o errexit
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (use sudo)" 1>&2
exit 1
fi
apt-get install kodi
apt-get install kodi-peripheral-joystick kodi-pvr-iptvsimple kodi-inputstream-adaptive kodi-inputstream-rtmp
apt-get install kodi-vfs-libarchive kodi-vfs-nfs kodi-vfs-sftp
grep -q "gpu_mem_192" /boot/config.txt || \
echo "gpu_mem_192" >> /boot/config.txt
grep -q "start_x=1" /boot/config.txt || \
echo "start_x=1" >> /boot/config.txt
grep -q "hdmi_group=2" /boot/config.txt || \
echo "hdmi_group=2" >> /boot/config.txt
grep -q "hdmi_mode=82" /boot/config.txt || \
echo "hdmi_mode=82" >> /boot/config.txt
grep -q "hdmi_safe=1" /boot/config.txt || \
echo "hdmi_safe=1" >> /boot/config.txt
sudo tee -a /lib/systemd/system/kodi.service <<_EOF_
[Unit]
Description = Kodi Media Center
After = remote-fs.target network-online.target
Wants = network-online.target
[Service]
User = pi
Group = pi
Type = simple
ExecStart = /usr/bin/kodi-standalone
Restart = on-abort
RestartSec = 5
[Install]
WantedBy = multi-user.target
_EOF_
systemctl enable kodi.service
systemctl start kodi.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment