[Tips] Install addons with a shell script / commands

[Tips] Install addons with a shell script / commands

  • tested on RPi3
  • caution: This was posted in Kodi forum and got a comment of Team Kodi, “This is absolutely NOT recommended and possibly breaks everything.”

Manually unzip to addons directory alone will not make those addons recognized by kodi.
They need to be added to addons database, enable and refresh data to be ready to use.

  • download > extract to /home/osmc/.kodi/addons
  • check depends in ./<addon_dir>/addon.xml field <requires>
  • download the <requires> addons > extract to /home/osmc/.kodi/addons
  • check each new addon.xml for other <requires>
  • add addons to database
  • enable each addon in database
  • refresh addons data
  • restart kodi

Example script for install skin.shortcuts

#!/bin/bash

kodipath=/home/osmc/.kodi/userdata
addonpath=/home/osmc/.kodi/addons
pkgpath=$addonpath/packages
dbpath=$kodipath/Database

# for 'unzip'
apt install -y bsdtar

# download addon and 'requires'
wget -qN --show-progress https://github.com/BigNoid/script.skinshortcuts/archive/master.zip -O $pkgpath/script.skinshortcuts.zip
wget -qN --show-progress https://github.com/XBMC-Addons/script.module.simplejson/archive/master.zip -O $pkgpath/script.module.simplejson.zip
wget -qN --show-progress http://mirrors.kodi.tv/addons/jarvis/script.module.unidecode/script.module.unidecode-0.4.16.zip -O $pkgpath/script.module.unidecode.zip

# extract
bsdtar -xf $pkgpath/script.skinshortcuts.zip -C $addonpath
bsdtar -xf $pkgpath/script.module.simplejson.zip -C $addonpath
bsdtar -xf $pkgpath/script.module.unidecode.zip -C $addonpath
chown -R osmc:osmc $addonpath

# add addons to database
xbmc-send -a "UpdateLocalAddons()"
sleep 2 # wait for database finished

# enable addons in database
sqlite3 $dbpath/Addons27.db "UPDATE installed SET enabled = 1 WHERE addonID = 'script.module.simplejson'"
sqlite3 $dbpath/Addons27.db "UPDATE installed SET enabled = 1 WHERE addonID = 'script.module.unidecode'"
sqlite3 $dbpath/Addons27.db "UPDATE installed SET enabled = 1 WHERE addonID = 'script.skinshortcuts'"

# refresh addons data (neeeded for reloadskin - may not for restart)
xbmc-send -a "UpdateLocalAddons()"
sleep 2 # wait for database finished

# restart OSMC
systemctl restart mediacenter
1 Like