This commit is contained in:
gutosie
2020-05-11 15:00:56 +03:00
committed by GitHub
parent 90d156dc99
commit 0e69d2d6aa

View File

@@ -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__]