diff --git a/tvheadend/config.json b/tvheadend/config.json index 8e456ae8..f0dab43f 100644 --- a/tvheadend/config.json +++ b/tvheadend/config.json @@ -2,12 +2,13 @@ "name": "TVHeadend", "version": "dev", "stage": "experimental", - "slug": "addon-tvheadend", + "slug": "tvheadend", "description": "TV streaming server and recorder.", "url": "https://github.com/GauthamVarmaK/addon-tvheadend", - "startup": "services", + "startup": "application", "arch": ["aarch64", "amd64", "armhf", "armv7", "i386"], "webui": "http://[HOST]:[PORT:9981]/", + "usb": true, "ports": { "9981/tcp": 9981, "9982/tcp": 9982 @@ -16,5 +17,13 @@ "9981/tcp": "TVH Web Interface", "9982/tcp": "TVH HTSP" }, - "map": ["config:rw"] + "map": ["config:rw"], + "options": { + "system_packages": [], + "init_commands": [] + }, + "schema":{ + "system_packages": ["str"], + "init_commands": ["str"] + } } diff --git a/tvheadend/rootfs/etc/cont-init.d/customizations.sh b/tvheadend/rootfs/etc/cont-init.d/customizations.sh new file mode 100644 index 00000000..d8f92588 --- /dev/null +++ b/tvheadend/rootfs/etc/cont-init.d/customizations.sh @@ -0,0 +1,24 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# Home Assistant Community Add-on: TVHeadend +# Executes user customizations on startup +# ============================================================================== + +# Install user configured/requested packages +if bashio::config.has_value 'system_packages'; then + apk update \ + || bashio::exit.nok 'Failed updating Alpine packages repository indexes' + + for package in $(bashio::config 'system_packages'); do + apk add "$package" \ + || bashio::exit.nok "Failed installing system package ${package}" + done +fi + +# Executes user commands on startup +if bashio::config.has_value 'init_commands'; then + while read -r cmd; do + eval "${cmd}" \ + || bashio::exit.nok "Failed executing init command: ${cmd}" + done <<< "$(bashio::config 'init_commands')" +fi