From 0e69d2d6aaae3b7336a4dabccf1821d5a8089ee8 Mon Sep 17 00:00:00 2001 From: gutosie Date: Mon, 11 May 2020 15:00:56 +0300 Subject: [PATCH] vip --- NeoBoot/files/stbbranding.py | 108 +++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 17 deletions(-) diff --git a/NeoBoot/files/stbbranding.py b/NeoBoot/files/stbbranding.py index 98f1c99..7aa02b1 100644 --- a/NeoBoot/files/stbbranding.py +++ b/NeoBoot/files/stbbranding.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -#from __future__ import print_function -#from Plugins.Extensions.NeoBoot.__init__ import _ , Log, PluginPath + +from Plugins.Extensions.NeoBoot.__init__ import _ import sys import os import time @@ -18,6 +18,44 @@ def getNeoLocation(): f.close() return locatino + +#check ext +def getFormat(): + neoformat='UNKNOWN' + if os.path.exists('/proc/mounts'): + with open('/proc/mounts', 'r') as f: + lines = f.read() + f.close() + if lines.find('ext2') != -1: + neoformat='ext2' + elif lines.find('ext3') != -1: + neoformat='ext3' + elif lines.find('ext4') != -1: + neoformat='ext4' + elif lines.find('nfs') != -1: + neoformat='nfs' + + return neoformat + + +def getNEO_filesystems(): + neo_filesystems='UNKNOWN' + if os.path.exists('/tmp/.neo_format'): + with open('/tmp/.neo_format', 'r') as f: + lines = f.read() + f.close() + if lines.find('ext2') != -1: + neo_filesystems='1' + elif lines.find('ext3') != -1: + neo_filesystems='1' + elif lines.find('ext4') != -1: + neo_filesystems='1' + elif lines.find('nfs') != -1: + neo_filesystems='1' + + return neo_filesystems + + def Log(param = ''): global LogFileObj #first close object if exists @@ -208,7 +246,6 @@ def getNeoMount2(): elif lines.find('/dev/sdf1 /media/usb2') != -1: neo='usb_install_/dev/sdf1' - return neo def getNeoMount3(): @@ -295,7 +332,7 @@ def getVuModel(): f = open("/proc/stb/info/vumodel",'r') procmodel = f.readline().strip() f.close() - model = procmodel.title().replace("olose", "olo SE").replace("olo2se", "olo2 SE").replace("2", "²") + model = procmodel.title().replace("olose", "olo SE").replace("olo2se", "olo2 SE").replace("2", "²") return model #zwraca nazwe stb z pliku hostname @@ -349,22 +386,57 @@ def runCMDS(cmdsList): ret = os.system(myCMD) return rett -##################################### -def getImageDistro(): - if fileExists('/etc/issue.net'): - try: - obraz = open('/etc/issue.net', 'r').readlines() - imagetype = obraz[0][:-1] - image = imagetype[0:-2] - return image - except: - False - - elif fileExists('/etc/vtiversion.info'): - image = 'VTI' +def getImageDistroN(): + image='Internal storage' + + if fileExists('/.multinfo') and fileExists ('%sImageBoot/.imagedistro' % getNeoLocation() ): + with open('%sImageBoot/.imagedistro' % getNeoLocation() , 'r') as f: + image = f.readline().strip() + f.close() + + elif not fileExists('/.multinfo') and fileExists('/etc/vtiversion.info'): + f = open("/etc/vtiversion.info",'r') + imagever = f.readline().strip().replace("Release ", " ") + f.close() + image = imagever + + elif not fileExists('/.multinfo') and fileExists('/etc/bhversion'): + f = open("/etc/bhversion",'r') + imagever = f.readline().strip() + f.close() + image = imagever + +# elif not fileExists('/.multinfo') and fileExists('/etc/vtiversion.info'): +# image = 'VTI Team Image ' + + elif fileExists('/.multinfo') and fileExists('/etc/bhversion'): + image = 'Flash ' + ' ' + getBoxHostName() + + elif fileExists('/.multinfo') and fileExists('/etc/vtiversion.info'): + image = 'Flash ' + ' ' + getBoxHostName() + + + elif fileExists('/usr/lib/enigma2/python/boxbranding.so') and not fileExists('/.multinfo'): + from boxbranding import getImageDistro + image = getImageDistro() + + elif fileExists('/media/InternalFlash/etc/issue.net') and fileExists('/.multinfo') and not fileExists('%sImageBoot/.imagedistro' % getNeoLocation() ): + obraz = open('/media/InternalFlash/etc/issue.net', 'r').readlines() + imagetype = obraz[0][:-3] + image = imagetype + + elif fileExists('/etc/issue.net') and not fileExists('/.multinfo'): + obraz = open('/etc/issue.net', 'r').readlines() + imagetype = obraz[0][:-3] + image = imagetype + + else: + image = 'Inernal Flash ' + ' ' + getBoxHostName() + return image + def getKernelVersionString(): try: result = popen('uname -r', 'r').read().strip('\n').split('-') @@ -622,3 +694,5 @@ def getMachineProcModel(): boxbrand = sys.modules[__name__] + +