sundtek: added addon settings to update driver from web

This commit is contained in:
vpeter4 2014-09-01 21:07:18 +02:00
parent 3fe5fdc60f
commit 1ce487c7cb
6 changed files with 98 additions and 1 deletions

View File

@ -1,3 +1,5 @@
4.3.2
new addon settings option to enable to update driver from web with latest version
4.3.1
update driver
4.3.0

View File

@ -18,7 +18,7 @@
PKG_NAME="sundtek-mediatv"
PKG_VERSION="4.3"
PKG_REV="1"
PKG_REV="2"
PKG_ARCH="any"
PKG_LICENSE="nonfree"
PKG_SITE="http://support.sundtek.com/"

View File

@ -0,0 +1,81 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# OpenELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
. /etc/profile
SUNDTEK_ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.sundtek-mediatv"
SUNDTEK_ADDON_HOME="$HOME/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv"
SUNDTEK_ADDON_SETTINGS="$SUNDTEK_ADDON_HOME/settings.xml"
logger -t Sundtek "### Starting updating driver ###"
xbmc-send -a "Notification(Sundtek, Starting updating driver, 2000)"
cd "$SUNDTEK_ADDON_DIR"
rm -fr tmp
mkdir tmp
cd tmp
ARCH=$(sed -n 's|.*\.\([^-]*\)-.*|\1|p' /etc/release | tr -d '\n')
if [ "$ARCH" = "x86_64" ]; then
INSTALLER_URL="http://sundtek.de/media/netinst/64bit/installer.tar.gz"
elif [ "$ARCH" = "i386" ]; then
INSTALLER_URL="http://sundtek.de/media/netinst/32bit/installer.tar.gz"
elif [ "$ARCH" = "arm" ]; then
INSTALLER_URL="http://sundtek.de/media/netinst/armsysvhf/installer.tar.gz"
else
logger -t Sundtek "### Unsupported architecture ###"
xbmc-send -a "Notification(Sundtek, Unsupported architecture, 5000)"
cd ..
rm -fr tmp
exit 1
fi
logger -t Sundtek "### Downloading driver archive for $ARCH ###"
xbmc-send -a "Notification(Sundtek, Downloading driver archive for $ARCH, 2000)"
wget -O installer.tar.gz $INSTALLER_URL
logger -t Sundtek "### Extracting archive ###"
xbmc-send -a "Notification(Sundtek, Extracting archive, 2000)"
tar -xzf installer.tar.gz
if [ $? -ne 0 ]; then
logger -t Sundtek "### Archive damaged ###"
xbmc-send -a "Notification(Sundtek, Archive damaged, 5000)"
cd ..
rm -fr tmp/
exit 2
fi
killall -9 mediaclient.bin &>/dev/null
killall -9 mediaclient &>/dev/null
killall -9 mediasrv &>/dev/null
# we run this via wrapper
mv opt/bin/mediaclient opt/bin/mediaclient.bin
chmod 755 opt/bin/*
cp -Pa opt/bin/* ../bin/
cp -Pa opt/lib/* ../lib/
cd ..
rm -fr tmp
logger -t Sundtek "### Driver update finished, please reboot ###"
xbmc-send -a "Notification(Sundtek, Driver update finished, 2000)"
xbmc-send -a "Notification(Sundtek, Please reboot, 5000)"
exit 0

View File

@ -18,6 +18,7 @@
import os
import sys
import subprocess
import xbmcaddon
__settings__ = xbmcaddon.Addon(id = 'driver.dvb.sundtek-mediatv')
@ -28,9 +29,15 @@ __settings_xml__ = xbmc.translatePath(os.path.join(__cwd__, 'resources', 'setti
__mediaclient__ = xbmc.translatePath(os.path.join(__cwd__, 'bin', 'mediaclient.bin'))
__ld_preload__ = xbmc.translatePath(os.path.join(__cwd__, 'lib', 'libmediaclient.so'))
__mediaclient_e__ = 'LD_PRELOAD=' + __ld_preload__ + ' ' + __mediaclient__ + ' -e'
__update_sh__ = xbmc.translatePath(os.path.join(__cwd__, 'bin', 'update-driver.sh'))
if __name__ == "__main__" and len(sys.argv) == 2 and sys.argv[1] == 'refresh_tuners':
sys.path.append(__resources_lib__)
from functions import refresh_sundtek_tuners
refresh_sundtek_tuners(__settings_xml__, __mediaclient_e__)
__settings__.openSettings()
elif __name__ == "__main__" and len(sys.argv) == 2 and sys.argv[1] == 'update_driver':
proc = subprocess.Popen([__update_sh__], shell = True)
return_code = proc.wait()
print "sundtek update driver rv", return_code
__settings__.openSettings()

View File

@ -27,4 +27,7 @@
<string id="9010">Refresh tuners... (press me)</string>
<string id="9020"> IR protocol</string>
<string id="9030"> keymap filename</string>
<string id="3000">Driver</string>
<string id="3010">Update from web... (press me)</string>
</strings>

View File

@ -29,4 +29,8 @@
<setting id="ENABLE_TUNER_TYPES" type="bool" label="9005" default="true" />
<setting label="9010" option="close" type="action" action="RunScript($ID, refresh_tuners)" />
</category>
<category label="3000">
<setting type="sep" />
<setting label="3010" option="close" type="action" action="RunScript($ID, update_driver)" />
</category>
</settings>