#!/bin/sh

[ -z $FS_PREFIX ] && FS_PREFIX=""
[ -z $HD_HTTP_LOCAL_PORT ] && HD_HTTP_LOCAL_PORT="80"

grep -q newgui2021 $FS_PREFIX/tmp/firmware_features.txt || exit 0

mydir=`dirname "$0"`
mydir=`cd "$mydir" && pwd`

dirpath="$FS_PREFIX/tmp/tv_app_suppliers"
filepath="$dirpath/home_tv"

[ -e "$dirpath" ] || mkdir "$dirpath"

cat << EOF > "$filepath"
{
  "plugin" : "home_tv",
  "caption" : "Домашнее ТВ v3",
  "tv_app" : "{\"type\":\"plugin\",\"plugin_name\":\"home_tv\",\"update_url\":\"http://127.0.0.1:$HD_HTTP_LOCAL_PORT/cgi-bin/plugins/home_tv/update\"}"
}
EOF

touch $FS_PREFIX/tmp/plugins/home_tv/update_epfs_if_needed_flag
