Files
NeoBoot-9/NeoBoot/plugin.py
2020-11-08 10:57:05 +02:00

1477 lines
85 KiB
Python

# -*- coding: utf-8 -*-
####################### _(-_-)_ gutosie _(-_-)_ #######################
# Copyright (c) , gutosie license
#
# Redystrybucja wersji programu i dokonywania modyfikacji JEST DOZWOLONE, pod warunkiem zachowania niniejszej informacji o prawach autorskich.
# Autor NIE ponosi JAKIEJKOLWIEK odpowiedzialności za skutki użtkowania tego programu oraz za wykorzystanie zawartych tu informacji.
# Modyfikacje przeprowadzasz na wlasne ryzyko!!!
# O wszelkich zmianach prosze poinformować na http://all-forum.cba.pl w temacie pod nazwa -#[NEOBOOT]#-
# This text/program is free document/software. Redistribution and use in
# source and binary forms, with or without modification, ARE PERMITTED provided
# save this copyright notice. This document/program is distributed WITHOUT any
# warranty, use at YOUR own risk.
#neoboot modules
#from __init__ import _
from Plugins.Extensions.NeoBoot.__init__ import _
from files.stbbranding import getLabelDisck, getINSTALLNeo, getNeoLocation, getLocationMultiboot, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getFSTAB, getFSTAB2, getKernelVersionString, getKernelImageVersion, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getTunerModel, getImageDistroN, getFormat, getNEO_filesystems
from files import Harddisk
from Components.About import about
from enigma import getDesktop, eTimer
import urllib2, urllib
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Screens.Standby import TryQuitMainloop
from Components.About import about
from Components.Sources.List import List
from Components.Button import Button
from Components.ActionMap import ActionMap, NumberActionMap
from Components.GUIComponent import *
from Components.MenuList import MenuList
from Components.Input import Input
from Components.Label import Label
from Components.ProgressBar import ProgressBar
from Components.ScrollLabel import ScrollLabel
from Components.Pixmap import Pixmap, MultiPixmap
from Components.config import *
from Components.ConfigList import ConfigListScreen
from Tools.LoadPixmap import LoadPixmap
from Tools.Directories import fileExists, fileCheck, pathExists, createDir, resolveFilename, SCOPE_PLUGINS
from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen
from os.path import dirname, isdir, isdir as os_isdir
import os
import time
if fileExists('/etc/vtiversion.info') and fileExists('/.multinfo'):
from Screens.Console import Console
else:
from files.neoconsole import Console
PLUGINVERSION = '9.03'
UPDATEVERSION = '9.08'
LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
try:
from enigma import addFont
font_osans = LinkNeoBoot + '/neoskins/osans.ttf'
font_sagoe = LinkNeoBoot + '/neoskins/sagoe.ttf'
addFont(font_osans, 'genel', 100, True)
addFont(font_sagoe, 'baslk', 100, True)
addFont(font_sagoe, 'tasat', 100, True)
addFont(font_sagoe, 'dugme', 90, True)
except:
print 'ERROR INSERTING FONT'
def neoTranslator():
neolang = ''
usedlang = open('/etc/enigma2/settings', 'r')
lang = 'config.osd.language=pl_PL'
local = usedlang.read().find(lang)
if local != -1:
neolang = 'islangPL'
else:
neolang = 'isnotlangPL'
return neolang
def getDS():
s = getDesktop(0).size()
return (s.width(), s.height())
def isFHD():
desktopSize = getDS()
return desktopSize[0] == 1920
def isHD():
desktopSize = getDS()
return desktopSize[0] >= 1280 and desktopSize[0] < 1920
def isUHD():
desktopSize = getDS()
return desktopSize[0] >= 1920 and desktopSize[0] < 3840
def Freespace(dev):
statdev = os.statvfs(dev)
space = statdev.f_bavail * statdev.f_frsize / 1024
print '[NeoBoot] Free space on %s = %i kilobytes' % (dev, space)
return space
class MyUpgrade(Screen):
if isFHD():
from Plugins.Extensions.NeoBoot.neoskins.default import MyUpgradeFULLHD
skin=MyUpgradeFULLHD
elif isUHD():
from Plugins.Extensions.NeoBoot.neoskins.default import MyUpgradeUltraHD
skin=MyUpgradeUltraHD
else:
from Plugins.Extensions.NeoBoot.neoskins.default import MyUpgradeHD
skin=MyUpgradeHD
__module__ = __name__
def __init__(self, session):
Screen.__init__(self, session)
self.list = []
self['list'] = List(self.list)
self.wybierz()
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
'back': self.changever})
def changever(self):
ImageChoose = self.session.open(NeoBootImageChoose)
if fileExists('' + LinkNeoBoot + '/.location'):
out = open('%sImageBoot/.version' % getNeoLocation(), 'w')
out.write(PLUGINVERSION)
out.close()
self.close()
else:
self.close(self.session.open(MessageBox, _('No file location NeoBot, do re-install the plugin.'), MessageBox.TYPE_INFO, 10))
self.close()
return ImageChoose
def wybierz(self):
self.list = []
mypath = '' + LinkNeoBoot + ''
if not fileExists(mypath + 'icons'):
mypixmap = '' + LinkNeoBoot + '/images/ok.png'
png = LoadPixmap(mypixmap)
res = (_('Update neoboot in all images ?'), png, 0)
self.list.append(res)
self['list'].list = self.list
def KeyOk(self):
self.sel = self['list'].getCurrent()
if self.sel:
self.sel = self.sel[2]
if self.sel == 0 and self.goKeyOk():
pass
self.close()
def goKeyOk(self):
from Plugins.Extensions.NeoBoot.files.tools import UpdateNeoBoot
self.session.open(UpdateNeoBoot)
class NeoBootInstallation(Screen):
if isFHD():
from Plugins.Extensions.NeoBoot.neoskins.default import NeoBootInstallationFULLHD
skin=NeoBootInstallationFULLHD
elif isUHD():
from Plugins.Extensions.NeoBoot.neoskins.default import NeoBootInstallationUltraHD
skin=NeoBootInstallationUltraHD
else:
from Plugins.Extensions.NeoBoot.neoskins.default import NeoBootInstallationHD
skin=NeoBootInstallationHD
def __init__(self, session):
Screen.__init__(self, session)
self.list = []
self['config'] = MenuList(self.list)
self['key_red'] = Label(_('Instruction'))
self['key_green'] = Label(_('Installation'))
self['key_yellow'] = Label(_('SetDiskLabel'))
self['key_blue'] = Label(_('Device Manager'))
self['label1'] = Label(_('Welcome to NeoBoot %s Plugin installation.') % PLUGINVERSION)
self['label3'] = Label(_('It is recommended to give a label to the disk.'))
self['label2'] = Label(_('Here is the list of mounted devices in Your STB\nPlease choose a device where You would like to install NeoBoot'))
self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'DirectionActions'], {'red': self.Instrukcja,
'green': self.checkinstall,
'ok': self.checkinstall,
'key_menu': self.datadrive,
'yellow': self.SetDiskLabel,
'blue': self.devices,
'back': self.close})
self.updateList()
if fileExists('/etc/fstab'):
neoformat = getFormat()
writefile = open('/tmp/.neo_format' , 'w')
writefile.write(neoformat)
writefile.close()
def SetDiskLabel(self):
from Plugins.Extensions.NeoBoot.files.devices import SetDiskLabel
self.session.open(SetDiskLabel)
def Instrukcja(self):
from Plugins.Extensions.NeoBoot.files.tools import MyHelpNeo
self.session.open(MyHelpNeo)
def datadrive(self):
try:
message = "echo -e '\n"
message += _('NeoBot checks the connected media.\nWAIT ...\n\nDISCS:')
message += "'"
os.system(" 'mount | sed '/sd/!d' | cut -d" " -f1,2,3,4,5' ")
cmd = '/sbin/blkid '
system(cmd)
print '[MULTI-BOOT]: ', cmd
self.session.open(Console, _(' NeoBot - Available media:'), [message, cmd])
if fileExists('' + LinkNeoBoot + '/files/mountpoint.sh'):
if not fileExists('%sImageBoot/.version' % getNeoLocation()):
os.system('mkdir -p %s; sync; chmod 0755 ' + LinkNeoBoot + '/files/mountpoint.sh; ' + LinkNeoBoot + '/files/mountpoint.sh' % getNeoLocation())
else:
pass
except:
pass
def updateList(self):
mycf, myusb, myusb2, myusb3, mysd, mycard, myhdd, myssd = ('', '', '', '', '', '', '', '')
myoptions = []
if fileExists('/proc/mounts'):
fileExists('/proc/mounts')
f = open('/proc/mounts', 'r')
for line in f.readlines():
if line.find('/media/cf') != -1:
mycf = '/media/cf/'
continue
if line.find('/media/usb') != -1:
myusb = '/media/usb/'
continue
if line.find('/media/usb2') != -1:
myusb2 = '/media/usb2/'
continue
if line.find('/media/usb3') != -1:
myusb3 = '/media/usb3/'
continue
if line.find('/media/card') != -1:
mysd = '/media/card/'
continue
if line.find('/hdd') != -1:
myhdd = '/media/hdd/'
continue
if line.find('/ssd') != -1:
myhdd = '/media/ssd/'
continue
f.close()
else:
self['label2'].setText(_('Sorry it seems that there are not Linux formatted devices mounted on your STB. To install NeoBoot you need a Linux formatted part1 device. Click on the blue button to open Devices Panel'))
fileExists('/proc/mounts')
if mycf:
self.list.append(mycf)
else:
mycf
if myusb:
self.list.append(myusb)
else:
myusb
if myusb2:
self.list.append(myusb2)
else:
myusb2
if myusb3:
self.list.append(myusb3)
else:
myusb3
if mysd:
mysd
self.list.append(mysd)
else:
mysd
if mycard:
mycard
self.list.append(mycard)
else:
mycard
if myhdd:
myhdd
self.list.append(myhdd)
else:
myhdd
if myssd:
myssd
self.list.append(myssd)
else:
myssd
self['config'].setList(self.list)
def checkReadWriteDir(self, configele):
supported_filesystems = frozenset(('ext4', 'ext3', 'ext2', 'nfs'))
candidates = []
mounts = Harddisk.getProcMounts()
for partition in Harddisk.harddiskmanager.getMountedPartitions(False, mounts):
if partition.filesystem(mounts) in supported_filesystems:
candidates.append((partition.description, partition.mountpoint))
if candidates:
locations = []
for validdevice in candidates:
locations.append(validdevice[1])
if Harddisk.findMountPoint(os.path.realpath(configele)) + '/' in locations or Harddisk.findMountPoint(os.path.realpath(configele)) in locations:
if fileExists(configele, 'w'):
return True
else:
dir = configele
self.session.open(MessageBox, _('The directory %s is not a ext2, ext3, ext4 or nfs partition.\nMake sure you select a valid partition type to install.') % dir, type=MessageBox.TYPE_ERROR)
return False
elif getFormat() == 'ext4' or getFormat() == 'ext3' or getFormat() == 'ext2' or getFormat() == 'nfs' :
return True
else:
dir = configele
self.session.open(MessageBox, _('The directory %s is not a EXT2, EXT3, EXT4 or NFS partition.\nMake sure you select a valid partition type.') % dir, type=MessageBox.TYPE_ERROR)
return False
else:
dir = configele
self.session.open(MessageBox, _('The directory %s is not a EXT2, EXT3, EXT4 or NFS partition.\nMake sure you select a valid partition type.\nIt may be helpful to restart the stb device completely.') % dir, type=MessageBox.TYPE_ERROR)
return False
def devices(self):
check = False
if check == False:
message = _('After selecting OK start Mounting Manager, option Mount - green\n')
message += _('Do you want to run the manager to mount the drives correctly ?\n')
ybox = self.session.openWithCallback(self.device2, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Device Manager'))
def device2(self, yesno):
if yesno:
# if fileExists('/usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager*/devicemanager.cfg'):
# system('rm -f /usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager*/devicemanager.cfg; touch /usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager*/devicemanager.cfg')
# if fileExists('/etc/devicemanager.cfg'):
# system(' rm -f /etc/devicemanager.cfg; touch /etc/devicemanager.cfg ')
from Plugins.Extensions.NeoBoot.files.devices import ManagerDevice
self.session.open(ManagerDevice)
else:
self.close()
def checkinstall(self):
if fileExists('/.multinfo'):
mess = _('Sorry, Neoboot can be installed or upgraded only when booted from Flash')
self.session.open(MessageBox, mess, MessageBox.TYPE_INFO)
else:
self.checkinstall2()
def checkinstall2(self):
if fileExists('/media/usb/ImageBoot/') and fileExists('/media/hdd/ImageBoot/'):
mess = _('An error was encountered, you have neoboot installed on usb and hdd.\nUninstall one directories from one drive.')
self.session.open(MessageBox, mess, MessageBox.TYPE_INFO)
else:
self.checkinstall3()
def checkinstall3(self):
if checkInternet():
self.check_LabelDisck()
else:
mess = _('Geen internet')
self.session.open(MessageBox, mess, MessageBox.TYPE_INFO)
def check_LabelDisck(self):
system('blkid -c /dev/null /dev/sd* > ' + LinkNeoBoot + '/bin/reading_blkid; chmod 755 ' + LinkNeoBoot + '/bin/reading_blkid ')
if getLabelDisck() != 'LABEL=':
message = _('NeoBot - First use yellow button and Set Disk Label!\nWithout labeling disc neoboot may not work properly')
ybox = self.session.openWithCallback(self.goSetDiskLabel, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Install Confirmation'))
else:
self.check_fstabUUID()
def check_fstabUUID(self):
if getFSTAB2() != 'UUID':
message = (_('Disk UUID not found\n - Universally unique identifier (UUID) is not required.\nYou can proceed with further installation or give an ID to your disk.\nTo continue the installation neoboo, press OK or No to abort.'))
ybox = self.session.openWithCallback(self.SetMountPointFSTAB, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Install Confirmation'))
else:
self.first_installation()
def goSetDiskLabel(self, yesno):
if yesno:
from Plugins.Extensions.NeoBoot.files.devices import SetDiskLabel
self.session.open(SetDiskLabel)
else:
message = _('NeoBot - choose what you want to do, install or not !!!')
ybox = self.session.openWithCallback(self.goInstall, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Install Confirmation'))
def SetMountPointFSTAB(self, yesno):
if yesno:
message = _('Proceed with further installation without providing a unique identifier for the disks ?')
ybox = self.session.openWithCallback(self.goInstall, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Install Confirmation'))
else:
self.devices()
def goInstall(self, yesno):
if yesno:
self.first_installation()
else:
self.myclose2(_('NeoBoot has not been installed ! :(' ))
def first_installation(self):
check = False
if fileExists('/proc/mounts'):
with open('/proc/mounts', 'r') as f:
for line in f.readlines():
if line.startswith('/dev/sd') and line.find('/media/hdd') or line.find('/media/usb') == -1 and (line.find('ext4') != -1 or line.find('ext3') != -1 or line.find('ext2') != -1):
check = True
break
if check == False:
self.session.open(MessageBox, _('Sorry, there is not any connected devices in your STB.\nPlease connect HDD or USB to install NeoBoot!'), MessageBox.TYPE_INFO)
else:
self.mysel = self['config'].getCurrent()
if self.checkReadWriteDir(self.mysel):
message = _('Do You really want to install NeoBoot in:\n ') + self.mysel + ' ?'
ybox = self.session.openWithCallback(self.install2, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Install Confirmation'))
else:
self.close()
def install2(self, yesno):
print 'yesno:', yesno
if yesno:
self.first_installationNeoBoot()
else:
self.myclose2(_('NeoBoot has not been installed ! :(' ))
def first_installationNeoBoot(self):
self.mysel = self['config'].getCurrent()
system('cd ' + LinkNeoBoot + '/; chmod 0755 ./bin/neoini*; chmod 0755 ./ex_init.py; chmod 0755 ./tmpfiles/target/*.sh; chmod 0755 ./files/NeoBoot.sh; chmod 0755 ./files/userscript.sh; cp -rf ' + LinkNeoBoot + '/bin/neoini* /sbin cd;')
cmd1 = 'mkdir ' + self.mysel + 'ImageBoot;mkdir ' + self.mysel + 'ImagesUpload'
system(cmd1)
cmd2 = 'mkdir ' + self.mysel + 'ImageBoot;mkdir ' + self.mysel + 'ImagesUpload/.kernel'
system(cmd2)
if os.path.isfile('' + LinkNeoBoot + '/.location'):
os.system('rm -f ' + LinkNeoBoot + '/.location' )
out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location', 'w')
out.write(self.mysel)
out.close()
if os.path.isfile('%sImageBoot/.neonextboot' % getNeoLocation()):
os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; rm -f %sImageBoot/.imagedistro; rm -f %sImageBoot/.initneo.log; rm -f %sImageBoot/.updateversion' % ( getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation()) )
if os.path.isfile('%sImageBoot/.neonextboot' % getNeoLocation()):
os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; ' % (getNeoLocation(), getNeoLocation(), getNeoLocation()) )
if os.path.isfile('%sImagesUpload/.kernel/zImage*.ipk or %sImagesUpload/.kernel/zImage*.bin' % ( getNeoLocation(), getNeoLocation()) ):
os.system('rm -f %sImagesUpload/.kernel/zImage*.ipk; rm -f %sImagesUpload/.kernel/zImage*.bin' % ( getNeoLocation(),getNeoLocation()) )
if fileExists('/etc/issue.net'):
try:
lines = open('/etc/hostname', 'r').readlines()
imagename = lines[0][:-1]
image = imagename
open('%sImageBoot/.Flash' % getNeoLocation(), 'w').write(image)
except:
False
out1 = open('%sImageBoot/.version' % getNeoLocation(), 'w')
out1.write(PLUGINVERSION)
out1.close()
out2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w')
out2.write('Flash ')
out2.close()
out3 = open('' + LinkNeoBoot + '/.neo_info', 'w')
out3.write('Kernel\n')
out3.write('Kernel-Version: ' + about.getKernelVersionString() + '\n')
out3.write('NeoBoot\n')
out3.write('NeoBoot-Version: ' + PLUGINVERSION + '\n')
out3.close()
out = open('%sImageBoot/.updateversion' % getNeoLocation(), 'w')
out.write(UPDATEVERSION)
out.close()
if fileExists('/usr/lib/enigma2/python/boxbranding.so'):
from boxbranding import getImageDistro
imagedistro = getImageDistro()
writefile = open('%sImageBoot/.imagedistro' % getNeoLocation(), 'w')
writefile.write(imagedistro)
writefile.close()
elif fileExists('/usr/lib/enigma2/python/Plugins/PLi'):
obraz = open('/etc/issue.net', 'r').readlines()
imagetype = obraz[0][:-3]
image = imagetype
writefile = open('%sImageBoot/.imagedistro' % getNeoLocation(), 'w')
writefile.write(imagetype)
writefile.close()
elif fileExists('/etc/vtiversion.info'):
f = open("/etc/vtiversion.info",'r')
imagever = f.readline().strip().replace("Release ", " ")
f.close()
image = imagever
writefile = open('%sImageBoot/.imagedistro' % getNeoLocation(), 'w')
writefile.write(imagever)
writefile.close()
elif fileExists('/etc/bhversion'):
f = open("/etc/bhversion",'r')
imagever = f.readline().strip()
f.close()
image = imagever
writefile = open('%sImageBoot/.imagedistro' % getNeoLocation(), 'w')
writefile.write(imagever)
writefile.close()
if os.system('opkg update; opkg list-installed | grep python-subprocess') != 0:
os.system('opkg install python-subprocess')
if os.system('opkg list-installed | grep python-argparse') != 0:
os.system('opkg install python-argparse')
if os.system('opkg list-installed | grep curl') != 0:
os.system('opkg install curl')
if getCPUtype() == 'MIPS':
if os.system('opkg list-installed | grep kernel-module-nandsim') != 0:
os.system('opkg install kernel-module-nandsim')
if os.system('opkg list-installed | grep mtd-utils-jffs2') != 0:
os.system('opkg install mtd-utils-jffs2')
if os.system('opkg list-installed | grep lzo') != 0:
os.system('opkg install lzo')
if os.system('opkg list-installed | grep python-setuptools') != 0:
os.system('opkg install python-setuptools')
if os.system('opkg list-installed | grep util-linux-sfdisk') != 0:
os.system('opkg install util-linux-sfdisk')
if os.system('opkg list-installed | grep packagegroup-base-nfs') != 0:
os.system('opkg install packagegroup-base-nfs')
if os.system('opkg list-installed | grep ofgwrite') != 0:
os.system('opkg install ofgwrite')
if os.system('opkg list-installed | grep bzip2') != 0:
os.system('opkg install bzip2')
if os.system('opkg list-installed | grep mtd-utils') != 0:
os.system('opkg install mtd-utils')
if os.system('opkg list-installed | grep mtd-utils-ubifs') != 0:
os.system('opkg install mtd-utils-ubifs')
# ARM - OctagonSF4008 - DM900 - Zgemma h7S - Octagon sf 8008 - AX HD60 4K #gbquad4k arm , #osmio4k arm, #Zgemma h9 arm, #Zgemma h7S arm , #Octagon SF4008
if getBoxHostName() == 'ustym4kpro' or getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7' or getBoxHostName() == 'zgemmah7' or getBoxHostName() == 'ax51' or getBoxHostName() == 'tmtwin4k' or getBoxHostName() == 'anadol4k' or getBoxHostName() == 'protek4k' or getBoxHostName() == 'maxytecmulti' or getBoxHostName() == 'force3uhd' or getBoxHostName() == 'viper4k' or getBoxHostName() == 'dm920' or getBoxHostName() == 'et1x000' or getCPUSoC() == 'bcm7251' or getBoxHostName() == 'sf4008' or getCPUSoC() == 'bcm7252s' or getBoxHostName() == 'gbquad4k' or getBoxHostName == 'osmio4k' or getBoxHostName == 'osmio4kplus' or getBoxHostName() == 'zgemmah9s' or getBoxHostName() == 'h9combo' or getBoxHostName() == 'h10' or getBoxHostName() == 'ax60' or getBoxHostName() == 'sf8008' or getCPUSoC() == 'bcm7251' or getCPUSoC() == 'BCM97252SSFF' or getBoxHostName() == 'dm900' and getBoxHostName() != 'vuultimo4k' and getBoxHostName() != 'vuuno4k' and getBoxHostName() != 'vusolo4k' and getBoxHostName() != 'vuuno4kse' and getBoxHostName() != 'vuultimo4k' and getBoxHostName() != 'vuduo4k' and getBoxHostName() != 'duo4kse' and getBoxHostName() != 'vuzero4k':
os.system('cp -f ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; chmod 0755 /sbin/neoinitarm; ln -sfn /sbin/neoinitarm /sbin/init; mv ' + LinkNeoBoot + '/tmpfiles/runpy/arm_run.py ' + LinkNeoBoot + '/run.py; cd')
#VUPLUS ARM
elif getCPUtype() == 'ARMv7' and getBoxHostName() != 'ustym4kpro':
if getCPUSoC() == '7278' or getBoxHostName() == 'vuduo4k':
os.system('cd ' + LinkNeoBoot + '/' )
os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvuDuo4k /sbin/neoinitarmvu; mv ' + LinkNeoBoot + '/tmpfiles/runpy/duo4k_run.py ' + LinkNeoBoot + '/run.py; cd')
os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu')
os.system('dd if=/dev/mmcblk0p6 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()))
os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vuDuo4Kmmcblk0p6.sh ' + LinkNeoBoot + '/files/kernel.sh; cd')
elif getCPUtype() == 'ARMv7' and getBoxHostName() != 'ustym4kpro' and getBoxHostName() != 'vuultimo4k':
if getCPUSoC() == '7444s' or getBoxHostName() == 'vuduo4kse':
os.system('cd ' + LinkNeoBoot + '/' )
os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvuDuo4k /sbin/neoinitarmvu; mv ' + LinkNeoBoot + '/tmpfiles/runpy/duo4kse_run.py ' + LinkNeoBoot + '/run.py; cd')
os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu')
os.system('dd if=/dev/mmcblk0p6 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()))
os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vuDuo4Ksemmcblk0p6.sh ' + LinkNeoBoot + '/files/kernel.sh; cd')
elif getCPUSoC() == '72604' or getBoxHostName() == 'vuzero4k':
os.system('cd ' + LinkNeoBoot + '/' )
os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvu /sbin/neoinitarmvu; cd')
os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu')
os.system('dd if=/dev/mmcblk0p4 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()))
os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vuZero4Kmmcblk0p4.sh ' + LinkNeoBoot + '/files/kernel.sh; mv ' + LinkNeoBoot + '/tmpfiles/runpy/zero4k_run.py ' + LinkNeoBoot + '/run.py; cd')
elif getBoxHostName() != 'vuduo4kse' and getCPUSoC() or getBoxHostName() == ['7444s',
'7252s',
'7376',
'vuultimo4k',
'vuuno4k',
'vusolo4k',
'vuuno4kse'] :
os.system('cd ' + LinkNeoBoot + '/' )
os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvu /sbin/neoinitarmvu; cd')
os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu')
os.system('dd if=/dev/mmcblk0p1 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) )
os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vu_mmcblk0p1.sh ' + LinkNeoBoot + '/files/kernel.sh; mv ' + LinkNeoBoot + '/tmpfiles/runpy/vu4k_run.py ' + LinkNeoBoot + '/run.py; cd')
#Zgemma h7S arm - no testet
# elif getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7' or getBoxHostName() == 'zgemmah7':
# os.system('opkg install --force-maintainer --force-reinstall --force-overwrite --force-downgrade kernel-image;cp -f /tmp/findkerneldevice.py ' + LinkNeoBoot + '/files/findkerneldevice.py; dd if=/dev/kernel of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) )
# if fileExists('/tmp/findkerneldevice.py'):
# os.sytem('cp -fr /tmp/findkerneldevice.py ' + LinkNeoBoot + '/files/findkerneldevice.py; ')
# else:
# os.sytem('mv ' + LinkNeoBoot + '/tmpfiles/runpy/findkerneldevice.py ' + LinkNeoBoot + '/files/findkerneldevice.py')
# os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm')
# os.system('chmod 0755 /sbin/neoinitarm; ln -sfn /sbin/neoinitarm /sbin/init')
# os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cd')
# os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/h7s_kernel.sh ' + LinkNeoBoot + '/files/kernel.sh; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/tmpfiles/runpy/target/h7s_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd')
# ARM - ustym4kpro
# elif getBoxHostName() == 'ustym4kpro' and getCPUSoC() == '3798mv200':
# os.system('opkg install --force-maintainer --force-reinstall --force-overwrite --force-downgrade kernel-image;cp -f /tmp/findkerneldevice.py ' + LinkNeoBoot + '/files/findkerneldevice.py; dd if=/dev/kernel of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) )
# if fileExists('/tmp/findkerneldevice.py'):
# os.sytem('cp -fr /tmp/findkerneldevice.py ' + LinkNeoBoot + '/files/findkerneldevice.py; ')
# else:
# os.sytem('mv ' + LinkNeoBoot + '/tmpfiles/runpy/findustym.py ' + LinkNeoBoot + '/files/findkerneldevice.py')
# os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm')
# os.system('chmod 0755 /sbin/neoinitarm; ln -sfn /sbin/neoinitarm /sbin/init')
# os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cd')
# os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/ustym4kpro.sh ' + LinkNeoBoot + '/files/kernel.sh; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/tmpfiles/runpy/target/ustym4kpro.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd')
# MIPS
elif getCPUtype() == 'MIPS':
if getCPUSoC() or getBoxHostName() or getTunerModel() == ['7335',
'7413',
'7325',
'7356',
'bcm7356',
'7429',
'7424',
'7241',
'7405',
'7405(with 3D)',
'7362',
'bcm7362',
'BCM7362',
'bcm7358',
'bcm7424',
'bm750',
'bcm73625'
'vuduo',
'vusolo',
'vuuno',
'vuultimo',
'vusolo2',
'vuduo2',
'vusolose',
'vuzero',
'mbmini',
'mbultra',
'osmini',
'h3',
'ini-1000sv',
'ini-8000sv'
'formuler4turbo'
'formuler3']:
#vuplus stb mtd1
if getBoxHostName() == 'bm750' or getBoxHostName() == 'vuduo' or getBoxHostName() == 'vusolo' or getBoxHostName() == 'vuuno' or getBoxHostName() == 'vuultimo':
if fileExists ('/usr/sbin/nanddump'):
os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' )
elif not fileExists ('/usr/sbin/nanddump'):
os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; ' + LinkNeoBoot + '/bin/nanddump_mips /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' )
os.system('cd ' + LinkNeoBoot + '/; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv ' + LinkNeoBoot + '/tmpfiles/target/vu_dev_mtd1.sh ' + LinkNeoBoot + '/files/kernel.sh;mv ' + LinkNeoBoot + '/tmpfiles/runpy/vu_mtd1_run.py ' + LinkNeoBoot + '/run.py; cd')
#vuplus stb mtd2
elif getBoxHostName() == 'vusolo2' or getBoxHostName() == 'vuduo2' or getBoxHostName() == 'vusolose' or getBoxHostName() == 'vuzero':
if fileExists ('/usr/sbin/nanddump'):
os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' )
elif not fileExists ('/usr/sbin/nanddump'):
os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; ' + LinkNeoBoot + '/bin/nanddump_mips /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' )
os.system('cd ' + LinkNeoBoot + '/; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv ' + LinkNeoBoot + '/tmpfiles/target/vu_dev_mtd2.sh ' + LinkNeoBoot + '/files/kernel.sh;mv ' + LinkNeoBoot + '/tmpfiles/runpy/vu_mtd2_run.py ' + LinkNeoBoot + '/run.py; cd')
# mbultra
elif getCPUSoC() == 'bcm7424' or getBoxHostName == 'mbultra' or getTunerModel() == 'ini-8000sv':
os.system('cd; cd /media/neoboot/ImagesUpload/.kernel; /usr/sbin/nanddump /dev/mtd2 -o > vmlinux.gz; mv /home/root/vmlinux.gz /media/neoboot/ImagesUpload/.kernel/')
os.system('cd ' + LinkNeoBoot + '/; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv ' + LinkNeoBoot + '/tmpfiles/target/vu_dev_mtd2.sh ' + LinkNeoBoot + '/files/kernel.sh; mv ' + LinkNeoBoot + '/tmpfiles/runpy/vu_mtd2_run.py ' + LinkNeoBoot + '/run.py; cd')
#inne stb
elif getCPUSoC() == 'bcm73625' or getCPUSoC() == 'bcm7358' or getCPUSoC() == 'bcm7362' or getCPUSoC() == 'BCM7362' or getCPUSoC() == 'bcm7356' or getCPUSoC() == 'bcm7241' or getCPUSoC() == 'bcm7362' or getBoxHostName() == 'formuler3' or getBoxHostName() == 'formuler4turbo' or getBoxHostName() == 'mbmini' or getBoxHostName() == 'osmini' or getTunerModel() == 'ini-1000sv' or getTunerModel() == 'h3':
os.system('cd ' + LinkNeoBoot + '/; mv ./bin/fontforneoboot.ttf /usr/share/fonts; mv ./bin/libpngneo /usr/lib; cp -f ./bin/neoinitmips /sbin/neoinitmips; cp -f ./bin/neoinitmipsvu /sbin/neoinitmipsvu; chmod 0755 /sbin/neoinit*; chmod 0755 ./bin/neobm; chmod 0755 /usr/lib/libpngneo; cd; chmod 0755 /sbin/neoinitmips; ln -sf /media/neoboot/ImageBoot/.neonextboot /etc/neoimage; mv ' + LinkNeoBoot + '/tmpfiles/runpy/mips_run.py ' + LinkNeoBoot + '/run.py; cd')
os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitmips /sbin/neoinitmips; cp -Rf ' + LinkNeoBoot + '/bin/neoinitmipsvu /sbin/neoinitmipsvu')
os.system('chmod 755 ' + LinkNeoBoot + '/bin/nfidump; chmod 0755 ' + LinkNeoBoot + '/bin/nanddump_mips; rm -r ' + LinkNeoBoot + '/bin/neoinitar*; cd')
os.system('chmod 755 /sbin/neoinitmips; chmod 0755 /sbin/neoinitmipsvu; cd ' + LinkNeoBoot + '/;mv ./bin/fontforneoboot.ttf /usr/share/fonts;mv ./bin/libpngneo /usr/lib; cp -f ./bin/neoinitmips /sbin/neoinitmips; chmod 0755 ./bin/neobm;chmod 0755 /usr/lib/libpngneo; cd; chmod 0755 /sbin/neoinitmips ')
if fileExists('/home/root/vmlinux.gz'):
os.system('mv -f /home/root/vmlinux.gz %sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName()) )
if getCPUtype() == 'ARMv7':
os.system('cd ' + LinkNeoBoot + '/; mv ./bin/fbcleararm ./bin/fbclear; rm -f ./bin/fbclearmips; mv ./ubi_reader_arm ./ubi_reader; rm -r ./ubi_reader_arm; rm -r ./ubi_reader_mips; rm ./bin/neoinitmips; rm ./bin/neoinitmipsvu; rm -r ./bin/nanddump_mips; rm ./bin/nfidump; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; cd')
elif getCPUtype() == 'MIPS':
os.system('cd ' + LinkNeoBoot + '/; mv ./bin/fbclearmips ./bin/fbclear; rm -f ./bin/fbcleararm; mv ./ubi_reader_mips ./ubi_reader; rm -r ./ubi_reader_mips; rm -r ./ubi_reader_arm; rm -f /bin/neoinitarm; rm -f /bin/neoinitarmvu; rm -r ./bin/nanddump_arm')
os.system(' ln -sfn ' + getNeoLocation() + 'ImageBoot/.neonextboot /etc/neoimage; chmod 644 ' + getNeoLocation() + 'ImagesUpload/.kernel/*; ln -sfn ' + getNeoLocation() + 'ImageBoot /etc/imageboot; rm -r ' + LinkNeoBoot + '/tmpfiles; chmod 0755 ' + LinkNeoBoot + '/files/kernel.sh ')
if os.path.isfile('' + LinkNeoBoot + '/.location'):
if getLabelDisck() != 'LABEL=':
cmd = "echo -e '\n%s '" % _('NeoBoot has been installed succesfully!\nNeoBoot has detected that the disks do not have a label.\nFor correct neo boot operation, please give the disks the name LABEL\nRecommended total restart of the tuner.\n')
elif getLabelDisck() == 'LABEL=':
cmd = "echo -e '\n%s '" % _('Installed succesfully NEOBOOT!\nNeoBoot has detected that the disks have been marked.\nRecommended total restart of the tuner\n')
else:
self.myclose2(_('NeoBoot has not been installed ! :(' ))
closereboot = self.rebootSTBE2()
self.session.open(Console, _('NeoBoot Install....'), [cmd])
self.close(closereboot)
def myclose2(self, message):
self.session.open(MessageBox, message, MessageBox.TYPE_INFO)
def rebootSTBE2(self):
restartbox = self.session.openWithCallback(self.RebootSTB, MessageBox, _('Reboot stb now ?'), MessageBox.TYPE_YESNO)
restartbox.setTitle(_('Reboot'))
def RebootSTB(self, answer):
if answer is True:
os.system('sync && echo 3 > /proc/sys/vm/drop_caches; reboot -d -f')
else:
self.close()
class NeoBootImageChoose(Screen):
if isFHD():
from usedskin import ImageChooseFULLHD
skin=ImageChooseFULLHD
elif isUHD():
from Plugins.Extensions.NeoBoot.neoskins.default import ImageChooseULTRAHD
skin=ImageChooseULTRAHD
else:
from Plugins.Extensions.NeoBoot.neoskins.default import ImageChooseHD
skin=ImageChooseHD
def __init__(self, session):
Screen.__init__(self, session)
if not fileExists('' + LinkNeoBoot + '/files/mountpoint.sh'):
os.system('touch ' + LinkNeoBoot + '/files/mountpoint.sh; echo "#!/bin/sh\n#DESCRIPTION=This script by gutosie\n" >> ' + LinkNeoBoot + '/files/mountpoint.sh; chmod 0755 ' + LinkNeoBoot + '/files/mountpoint.sh')
if getNeoMount() == 'hdd_install_/dev/sda1':
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/hdd\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount() == 'hdd_install_/dev/sdb1':
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/hdd\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount() == 'hdd_install_/dev/sda2':
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sda2\n/bin/mount /dev/sda2 /media/hdd\n/bin/mount /dev/sda2 /media/sda2" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount() == 'hdd_install_/dev/sdb2':
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sdb2\n/bin/mount /dev/sdb2 /media/hdd\n/bin/mount /dev/sdb2 /media/sdb2" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
if getNeoMount2() == 'usb_install_/dev/sdb1':
os.system('echo "\numount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/usb\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount2() == 'usb_install_/dev/sda1':
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/sda1\n/bin/mount /dev/sda1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount2() == 'usb_install_/dev/sdb2':
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdb2\n/bin/mount /dev/sdb2 /media/sdb2\n/bin/mount /dev/sdb2 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount2() == 'usb_install_/dev/sdc1':
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdc1\n/bin/mount /dev/sdc1 /media/sdb2\n/bin/mount /dev/sdc1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount2() == 'usb_install_/dev/sdd1':
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdd1\n/bin/mount /dev/sdd1 /media/sdd1\n/bin/mount /dev/sdd1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount2() == 'usb_install_/dev/sde1':
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sde1\n/bin/mount /dev/sde1 /media/sde1\n/bin/mount /dev/sde1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount2() == 'usb_install_/dev/sdf1':
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdf1\n/bin/mount /dev/sdf1 /media/sdf1\n/bin/mount /dev/sdf1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount3() == 'cf_install_/dev/sda1':
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\nmkdir -p /media/sdb1\n/bin/mount /dev/sda1 /media/cf\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount3() == 'cf_install_/dev/sdb1':
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/cf\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount4() == 'card_install_/dev/sda1':
os.system('echo "umount -l /media/card\nmkdir -p /media/card\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/card\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount4() == 'card_install_/dev/sdb1':
os.system('echo "umount -l /media/card\nmkdir -p /media/card\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/card\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount5() == 'mmc_install_/dev/sda1':
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/mmc\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
elif getNeoMount5() == 'mmc_install_/dev/sdb1':
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/mmc\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
if not fileExists('' + LinkNeoBoot + '/files/neo.sh'):
system('' + LinkNeoBoot + '/files/mountpoint.sh')
system('echo ' + getLocationMultiboot() + ' > ' + LinkNeoBoot + '/bin/install; chmod 0755 ' + LinkNeoBoot + '/bin/install')
if getLocationMultiboot() == '/dev/sda1':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sda1 ' + getNeoLocation() + ' \n')
out.close()
elif getLocationMultiboot() == '/dev/sdb1':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdb1 ' + getNeoLocation() + ' \n')
out.close()
elif getLocationMultiboot() == '/dev/sda2':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sda2 ' + getNeoLocation() + ' \n')
out.close()
elif getLocationMultiboot() == '/dev/sdb2':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdb2 ' + getNeoLocation() + ' \n')
out.close()
elif getLocationMultiboot() == '/dev/sdc1':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdc1 ' + getNeoLocation() + ' \n')
out.close()
elif getLocationMultiboot() == '/dev/sdd1':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdd1 ' + getNeoLocation() + ' \n')
out.close()
elif getLocationMultiboot() == '/dev/sde1':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sde1 ' + getNeoLocation() + ' \n')
out.close()
elif getLocationMultiboot() == '/dev/sdf1':
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdf1 ' + getNeoLocation() + ' \n')
out.close()
system('chmod 755 ' + LinkNeoBoot + '/files/neo.sh')
if fileExists('/tmp/.init_reboot'):
system('rm /tmp/.init_reboot')
if fileExists('/.multinfo'):
if checkInternet():
pass
else:
os.system('/etc/init.d/networking stop; sync; /etc/init.d/networking start;')
if not fileExists('/.control_ok'):
if fileExists('/.control_boot_new_image'):
os.system('rm -f /.control_boot_new_image; echo "Image uruchomione OK\nNie kasuj tego pliku. \n\nImage started OK\nDo not delete this file." > /.control_ok ')
if not fileExists('/.control_boot_new_image'):
os.system('echo "Image uruchomione OK\nNie kasuj tego pliku. \n\nImage started OK\nDo not delete this file." > /.control_ok')
self.list = []
self.setTitle(' NeoBoot %s - Menu' % PLUGINVERSION + ' ' + 'Ver. update: %s' % UPDATEVERSION)
self['device_icon'] = Pixmap()
self['progreso'] = ProgressBar()
self['linea'] = ProgressBar()
self['config'] = MenuList(self.list)
self['key_red'] = Label(_('Download Image'))
self['key_green'] = Label(_('Installation'))
self['key_yellow'] = Label(_('Remove Image '))
self['key_blue'] = Label(_('Info'))
self['key_menu'] = Label(_('More options'))
self['key_1'] = Label(_('Update NeoBot'))
self['key_2'] = Label(_('Reinstall NeoBoot'))
self['key_3'] = Label(_('Reinstall kernel'))
self['label1'] = Label(_('Please choose an image to boot'))
self['label2'] = Label(_('NeoBoot is running from:'))
self['label3'] = Label('')
self['label4'] = Label(_('NeoBoot is running image:'))
self['label5'] = Label('')
self['label6'] = Label('')
self['label7'] = Label('')
self['label8'] = Label(_('Number of images installed:'))
self['label9'] = Label('')
self['label10'] = Label('')
self['label11'] = Label('')
self['label12'] = Label('')
self['label13'] = Label(_('Version update: '))
self['label14'] = Label(_('NeoBoot version: '))
self['label15'] = Label(_('Memory disc:'))
self['label16'] = Label(_('Kernel'))
self['label17'] = Label('')
self['label18'] = Label('')
self['label19'] = Label('')
self['label20'] = Label('')
self['label21'] = Label('NEO VIP')
self['actions'] = ActionMap(['WizardActions',
'ColorActions',
'MenuActions',
'NumberActionMap',
'SetupActions',
'number'], {'ok': self.bootIMG,
'red': self.DownloadImageOnline,
'green': self.ImageInstall,
'yellow': self.removeIMG,
'blue': self.pomoc,
'menu': self.mytools,
'1': self.neoboot_update,
'2': self.ReinstallNeoBoot,
'3': self.ReinstallKernel,
'4': self.ReinstallKernel,
'5': self.bootIMG, #hidden option
'9': self.bootIMG, #hidden option
'back': self.close_exit})
if not fileExists('/etc/name'):
os.system('touch /etc/name')
self.onShow.append(self.updateList)
def DownloadImageOnline(self):
if not os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/ImageDownloader/download.py'):
message = _('Plugin ImageDownloader not installed!\nInstall plugin to download new image? \and---Continue ?---' )
ybox = self.session.openWithCallback(self.InstallImageDownloader, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Installation'))
else:
from Plugins.Extensions.ImageDownloader.main import STBmodelsScreen
self.session.open(STBmodelsScreen)
def InstallImageDownloader(self, yesno):
if yesno:
cmd = 'mkdir /tmp/install; touch /tmp/install/plugin.txt; rm -rf /tmp/*.ipk'
system(cmd)
cmd1 = 'cd /tmp; wget http://read.cba.pl/panel_extra/enigma2-plugin-extensions-imagedownloader_2.6_all.ipk'
system(cmd1)
cmd2 = 'opkg install --force-overwrite --force-reinstall --force-downgrade /tmp/enigma2-plugin-extensions-imagedownloader_2.6_all.ipk'
system(cmd2)
self.session.open(MessageBox, _('The plug-in has been successfully installed.'), MessageBox.TYPE_INFO, 5)
self.close()
else:
mess = _('Upload image files in zip formats to the ImagesUpload location.' )
self.session.open(MessageBox, mess, MessageBox.TYPE_INFO)
def chackkernel(self):
message = _('NeoBoot detected a kernel mismatch in flash, \nInstall a kernel for flash image??')
ybox = self.session.openWithCallback(self.updatekernel, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Updating ... '))
def pomoc(self):
from Plugins.Extensions.NeoBoot.files.tools import Opis
self.session.open(Opis)
def ReinstallNeoBoot(self):
INSTALLbox = self.session.openWithCallback(self.reinstallboot, MessageBox, _('Select Yes to reinstall the neoboot.\n NEOBOOT.'), MessageBox.TYPE_YESNO)
INSTALLbox.setTitle(_('Reinstall neoboot'))
def reinstallboot(self, answer):
if answer is True:
try:
cmd = "echo -e '\n\n%s '" % _('NEOBOOT - Please reinstall NeoBoot....\nPlease wait, done...\nrestart systemu...')
cmd1 = 'cd ' + LinkNeoBoot + '/; rm ./bin/install; rm ./.location; rm ./files/mountpoint.sh; rm ./files/neo.sh; sleep 5; PATH=/sbin:/bin:/usr/sbin:/usr/bin; echo -n "Restarting E2... "; init 4; sleep 1; init 3 '
except:
False
self.session.open(Console, _('NeoBoot ARM....'), [cmd, cmd1])
self.close()
else:
try:
self.session.open(MessageBox, _('Resignation.'), MessageBox.TYPE_INFO, 4)
self.close()
except:
False
def close_exit(self):
system('touch /tmp/.init_reboot')
if not fileExists('/.multinfo'):
out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w' )
out.write('Flash')
out.close()
self.close()
elif fileExists('/.multinfo'):
with open('/.multinfo', 'r' ) as f:
imagefile = f.readline().strip()
f.close()
out = open('%sImageBoot/.neonextboot'% getNeoLocation(), 'w' )
out.write(imagefile)
out.close()
else:
system('touch /tmp/.init_reboot')
out = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'w')
out.write('Flash')
out.close()
self.close()
def ReinstallKernel(self):
from Plugins.Extensions.NeoBoot.files.tools import ReinstallKernel
self.session.open(ReinstallKernel)
def neoboot_update(self):
if fileExists('/.multinfo'):
mess = _('Downloading available only from the image Flash.')
self.session.open(MessageBox, mess, MessageBox.TYPE_INFO)
else:
out = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'w')
out.write('Flash')
out.close()
message = _('\n\n\n')
message += _('WARNING !: The update brings with it the risk of errors.\n')
message += _('Before upgrading it is recommended that you make a backup NeoBoot.\n')
message += _('Do you want to run the update now ?\n')
message += _('\n')
ybox = self.session.openWithCallback(self.chackupdate2, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('The download neoboot update.'))
def chackupdate2(self, yesno):
if yesno:
self.chackupdate3()
else:
self.session.open(MessageBox, _('Canceled update.'), MessageBox.TYPE_INFO, 7)
def chackupdate3(self):
os.system('cd ' + LinkNeoBoot + ';curl -O --ftp-ssl https://raw.githubusercontent.com/gutosie/NeoBoot-9/master/ver.txt;sleep 3;cd /')
if not fileExists('' + LinkNeoBoot + '/ver.txt'):
os.system('cd ' + LinkNeoBoot + ';fullwget --no-check-certificate https://raw.githubusercontent.com/gutosie/NeoBoot-9/master/ver.txt; sleep 3;cd /')
if fileExists('' + LinkNeoBoot + '/ver.txt'):
mypath = ''
version = open('' + LinkNeoBoot + '/ver.txt', 'r')
mypath = float(version.read().strip())
version.close()
if float(UPDATEVERSION) != mypath:
message = _('NeoBoot has detected update.\nDo you want to update NeoBoota now ?')
ybox = self.session.openWithCallback(self.aktualizacjamboot, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Updating ... '))
elif fileExists('' + LinkNeoBoot + '/ver.txt'):
os.system('rm ' + LinkNeoBoot + '/ver.txt')
if fileExists('' + LinkNeoBoot + '/wget-log'):
os.system('rm ' + LinkNeoBoot + '/wget-log')
self.session.open(MessageBox, _('Updated unnecessary, you have the latest version. Please try again later.'), MessageBox.TYPE_INFO)
else:
self.session.open(MessageBox, _('Unfortunately, at the moment not found an update, try again later.'), MessageBox.TYPE_INFO, 10)
else:
if not fileExists('' + LinkNeoBoot + '/ver.txt'):
self.session.open(MessageBox, _('Unfortunately, at the moment not found an update, try again later.'), MessageBox.TYPE_INFO, 10)
def aktualizacjamboot(self, yesno):
if yesno:
if fileExists('/tmp/*.zip'):
os.system('rm /tmp/*.zip')
os.system('sync; cd /tmp; curl -O --ftp-ssl https://codeload.github.com/gutosie/NeoBoot-9/zip/master; mv /tmp/master /tmp/neoboot.zip; cd /')
if not fileExists('/tmp/neoboot.zip'):
os.system('cd /tmp;fullwget --no-check-certificate https://codeload.github.com/gutosie/NeoBoot-9/zip/master; mv /tmp/master /tmp/neoboot.zip; sleep 3;cd ')
if not fileExists('/tmp/neoboot.zip'):
self.session.open(MessageBox, _('Unfortunately, at the moment not found an update, try again later.'), MessageBox.TYPE_INFO, 8)
else:
self.goUpdateNEO()
else:
self.goUpdateNEO()
else:
os.system('rm -f ' + LinkNeoBoot + '/ver.txt')
self.session.open(MessageBox, _('The update has been canceled.'), MessageBox.TYPE_INFO, 8)
def goUpdateNEO(self):
if fileExists('' + LinkNeoBoot + '/wget-log'):
os.system('rm ' + LinkNeoBoot + '/wget-log')
os.system('cd /tmp/; unzip -qn ./neoboot.zip; rm -f ./neoboot.zip; cp -rf ./NeoBoot-9-master/NeoBoot /usr/lib/enigma2/python/Plugins/Extensions; rm -rf /tmp/NeoBoot-9-master; rm ' + LinkNeoBoot + '/ver.txt; cd ' + LinkNeoBoot + '/; chmod 0755 ./bin/neoini*; chmod 0755 ./ex_init.py; chmod 0755 ./tmpfiles/target/*; chmod 0755 ./files/NeoBoot.sh; chmod 0755 ./files/userscript.sh; cd')
if getCPUtype() == 'MIPS':
os.system('cd ' + LinkNeoBoot + '/; cp -rf ./bin/neoinitmipsvu /sbin; chmod 755 /sbin/neoinitmipsvu; cp -rf ./bin/neoinitmips /sbin; chmod 755 /sbin/neoinitmips; cd')
os.system('cd ' + LinkNeoBoot + '/; rm ./bin/install; rm ./files/mountpoint.sh; rm ./files/neo.sh')
restartbox = self.session.openWithCallback(self.restartGUI, MessageBox, _('Completed update NeoBoot. You need to restart the E2 !!!\nRestart now ?'), MessageBox.TYPE_YESNO)
restartbox.setTitle(_('Restart GUI now ?'))
def restartGUI(self, answer):
if answer is True:
os.system('rm -f ' + LinkNeoBoot + '/.location')
self.session.open(TryQuitMainloop, 3)
else:
self.close()
def MBBackup(self):
from Plugins.Extensions.NeoBoot.files.tools import MBBackup
self.session.open(MBBackup)
def MBRestore(self):
from Plugins.Extensions.NeoBoot.files.tools import MBRestore
self.session.open(MBRestore)
def updateList(self):
self.list = []
pluginpath = '' + LinkNeoBoot + ''
f = open(pluginpath + '/.location', 'r')
mypath = f.readline().strip()
f.close()
icon = 'dev_usb.png'
if 'card' in mypath or 'sd' in mypath:
icon = 'dev_sd.png'
elif 'ntfs' in mypath:
icon = 'dev_sd.png'
elif 'hdd' in mypath:
icon = 'dev_hdd.png'
elif 'cf' in mypath:
icon = 'dev_cf.png'
elif 'ssd' in mypath:
icon = 'dev_ssd.png'
icon = pluginpath + '/images/' + icon
png = LoadPixmap(icon)
self['device_icon'].instance.setPixmap(png)
linesdevice = open('' + LinkNeoBoot + '/.location', 'r').readlines()
deviceneo = linesdevice[0][0:-1]
device = deviceneo
ustot = usfree = usperc = ''
rc = system('df > /tmp/memoryinfo.tmp')
if fileExists('/tmp/memoryinfo.tmp'):
f = open('/tmp/memoryinfo.tmp', 'r')
for line in f.readlines():
line = line.replace('part1', ' ')
parts = line.strip().split()
totsp = len(parts) - 1
if parts[totsp] == device:
if totsp == 5:
ustot = parts[1]
usfree = parts[3]
usperc = parts[4]
else:
ustot = 'N/A '
usfree = parts[2]
usperc = parts[3]
break
f.close()
os.remove('/tmp/memoryinfo.tmp')
perc = int(usperc[0:-1])
self['progreso'].setValue(perc)
green = '#00389416'
red = '#00ff2525'
yellow = '#00ffe875'
orange = '#00ff7f50'
if perc < 30:
color = green
elif perc < 60:
color = yellow
elif perc < 80:
color = orange
else:
color = red
try:
from skin import parseColor
self['label13'].instance.setForegroundColor(parseColor(color))
self['label15'].instance.setForegroundColor(parseColor(color))
self['progreso'].instance.setForegroundColor(parseColor(color))
except:
pass
self.availablespace = usfree[0:-3]
strview = _('Used: ') + usperc + _(' \n Available: ') + usfree[0:-3] + ' MB'
self['label3'].setText(strview)
strview2 = _('Free Space : ') + usfree[0:-3] + ' MB'
self['label11'].setText(strview2)
strview1 = _('Capacity : ') + usperc + _(' Full')
self['label18'].setText(strview1)
try:
f2 = open('%sImageBoot/.neonextboot', 'r' % getNeoLocation())
mypath2 = f2.readline().strip()
f2.close()
except:
mypath2 = 'Flash'
if mypath2 == 'Flash':
image = getImageDistroN()
writefile = open('%sImageBoot/.Flash' % getNeoLocation(), 'w')
writefile.write(image)
writefile.close()
elif fileExists('%sImageBoot/.Flash' % getNeoLocation()):
f = open('%sImageBoot/.Flash', 'r' % getNeoLocation())
image = f.readline().strip()
f.close()
image = ' [' + image + ']'
self.list.append('Flash' + image)
self['label5'].setText(mypath)
if fileExists('/.multinfo'):
f2 = open('/.multinfo', 'r')
mypath3 = f2.readline().strip()
f2.close()
self['label6'].setText(mypath3)
else:
f2 = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'r' )
mypath3 = f2.readline().strip()
f2.close()
self['label6'].setText(mypath3)
mypath = ('%sImageBoot' % getNeoLocation())
myimages = listdir(mypath)
for fil in myimages:
if os.path.isdir(os.path.join(mypath, fil)):
self.list.append(fil)
self['label7'].setText(str(len(self.list) - 1))
self['config'].setList(self.list)
strview = PLUGINVERSION
self['label9'].setText(strview)
KERNELVERSION = getKernelImageVersion()
strview = KERNELVERSION
self['label20'].setText(strview)
self['label17'].setText(readline('/etc/hostname'))
self['label19'].setText(readline('%sImagesUpload/.kernel/used_flash_kernel' % getNeoLocation() ))
strview = UPDATEVERSION
self['label10'].setText(strview)
def mytools(self):
from Plugins.Extensions.NeoBoot.files.tools import MBTools
self.session.open(MBTools)
def removeIMG(self):
self.mysel = self['config'].getCurrent()
if 'Flash' in self.mysel:
self.mysel = 'Flash'
if self.mysel:
f = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r')
mypath = f.readline().strip()
f.close()
try:
if fileExists('/.multinfo'):
self.session.open(MessageBox, _('Sorry you can delete only from the image Flash.'), MessageBox.TYPE_INFO, 5)
elif self.mysel == 'Flash':
self.session.open(MessageBox, _('Sorry you cannot delete Flash image'), MessageBox.TYPE_INFO, 5)
elif mypath == self.mysel:
self.session.open(MessageBox, _('Sorry you cannot delete the image currently booted from.'), MessageBox.TYPE_INFO, 5)
else:
out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w' )
out.write('Flash')
out.close()
message = _('Delete the selected image - ') + self.mysel + _('\nDelete ?')
ybox = self.session.openWithCallback(self.RemoveIMAGE, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Delete Confirmation'))
except:
print 'no image to remove'
else:
self.mysel
def up(self):
self.list = []
self['config'].setList(self.list)
self.updateList()
def up2(self):
try:
self.list = []
self['config'].setList(self.list)
self.updateList()
except:
print ' '
def RemoveIMAGE(self, yesno):
if yesno:
cmd = _("echo -e 'Deleting in progress...\n'")
cmd1 = 'chattr -i %sImageBoot/' % getNeoLocation() + self.mysel
cmd2 = 'rm -r %sImageBoot/' % getNeoLocation() + self.mysel
self.session.openWithCallback(self.up, Console, _('NeoBoot: Deleting Image'), [cmd, cmd1, cmd2])
else:
self.session.open(MessageBox, _('Removing canceled!'), MessageBox.TYPE_INFO)
def ImageInstall(self):
if fileExists('/.multinfo'):
message = _('Installing new neoboot software, only recommended from Flash!!!\n---Continue ?---')
ybox = self.session.openWithCallback(self.installation_image, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Installation'))
else:
message = _('Installation from Flash!!!\n---Continue ?---')
ybox = self.session.openWithCallback(self.installation_image, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Installation new image. '))
def installation_image(self, yesno):
if yesno:
if getCPUSoC() or getBoxHostName() or getTunerModel() == ['zgemmah9s',
'h9combo',
'h10',
'osmio4k',
'osmio4kplus',
'bcm7252s',
'gbquad4k',
'ax60',
'sf8008',
'bcm7251',
'sf4008',
'et1x000',
'ax51',
'dm920',
'bcm7251s',
'7241',
'h7',
'dm900',
'BCM97252SSFF',
'7444s',
'7252s',
'7376',
'72604',
'7278',
'7335',
'7413',
'7325',
'7356',
'bcm7356',
'7429',
'7424',
'7362',
'bcm7362',
'BCM7362',
'bcm7358',
'bcm73625'
'7405',
'7405(with 3D)',
'bcm7424',
'vuultimo',
'mbmini',
'osmini',
'mbultra',
'ustym4kpro'
'h3'
'formuler4turbo'
'formuler3',
'tmtwin4k',
'anadol4k',
'protek4k',
'maxytecmulti',
'force3uhd',
'viper4k ']:
self.extractImage()
else:
self.messagebox = self.session.open(MessageBox, _('The tuner is not supported by NeoBoot.\nContact the author.\nNo proper STB for installation !!!!'), MessageBox.TYPE_INFO, 8)
self.close()
else:
self.messagebox = self.session.open(MessageBox, _('It is recommended to install new software only from a flash system.\n---NEOBOOT EXIT---'), MessageBox.TYPE_INFO, 10)
self.close()
def extractImage(self):
images = False
if fileExists('%sImageBoot/.without_copying' % getNeoLocation() ):
system('rm %sImageBoot/.without_copying' % getNeoLocation() )
if not os.path.exists('%sImagesUpload' % getNeoLocation()):
system('mkdir %sImagesUpload' % getNeoLocation())
myimages = listdir('%sImagesUpload' % getNeoLocation())
print myimages
for fil in myimages:
if fil.endswith('.zip'):
images = True
break
if fil.endswith('.tar.xz'):
images = True
break
if fil.endswith('.nfi'):
images = True
break
else:
images = False
if images == True and self.check_free_space():
from Plugins.Extensions.NeoBoot.unpack import InstallImage
self.session.open(InstallImage)
else:
self.DownloaderImage()
def check_free_space(self):
if Freespace('%s' % getNeoLocation()) < 300000:
self.session.open(MessageBox, _('Not enough free space on /media/ !!\nYou need at least 300Mb free space.\n\nExit plugin.'), type=MessageBox.TYPE_ERROR)
return False
return True
def DownloaderImage(self):
if not os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/ImageDownloader/download.py'):
message = (_('The %sImagesUpload directory is EMPTY!!!\nInstall the plugin to download new image online ?\n --- Continue? ---') % getNeoLocation() )
ybox = self.session.openWithCallback(self.ImageDownloader, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('Installation'))
else:
message = (_('Catalog %sImagesUpload directory is empty\nPlease upload the image files in zip or nfi formats to install') % getNeoLocation() )
self.session.open(MessageBox, message, MessageBox.TYPE_INFO)
def ImageDownloader(self, yesno):
if yesno:
cmd = 'mkdir /tmp/install; touch /tmp/install/plugin.txt; rm -rf /tmp/*.ipk'
system(cmd)
cmd1 = 'cd /tmp; wget http://read.cba.pl/panel_extra/enigma2-plugin-extensions-imagedownloader_2.6_all.ipk'
system(cmd1)
cmd2 = 'opkg install --force-overwrite --force-reinstall --force-downgrade /tmp/enigma2-plugin-extensions-imagedownloader_2.6_all.ipk'
system(cmd2)
self.session.open(MessageBox, _('The plug-in has been successfully installed.'), MessageBox.TYPE_INFO, 5)
self.close()
else:
mess = (_('Directory %sImagesUpload is empty\nPlease upload the image files in zip or nfi formats to install') % getNeoLocation() )
self.session.open(MessageBox, mess, MessageBox.TYPE_INFO)
def bootIMG(self):
self.mysel = self['config'].getCurrent()
if 'Flash' in self.mysel:
self.mysel = 'Flash'
if self.mysel:
out = open('' + getNeoLocation() + 'ImageBoot/.neonextboot', 'w' )
out.write(self.mysel)
out.close()
if getImageNeoBoot() != 'Flash':
if not fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())):
message = _('After successful launch of the selected software\nyou must run the neoboot plugin\nif the software does not start or neoboot is not confirmed\nthe system will return to the internal flash memory\n\nPress OK or exit on the remote control to continue...' )
ybox = self.session.openWithCallback(self.StartReboot, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_('First start of software'))
else:
from run import StartImage
self.session.open(StartImage)
else:
from run import StartImage
self.session.open(StartImage)
def StartReboot(self, yesno):
if yesno:
from run import StartImage
self.session.open(StartImage)
else:
self.close()
def myClose(self, message):
self.session.open(MessageBox, message, MessageBox.TYPE_INFO)
self.close()
def readline(filename, iferror = ''):
if iferror[:3] == 'or:':
data = iferror[3:]
else:
data = iferror
try:
if os.path.exists(filename):
with open(filename) as f:
data = f.readline().strip()
f.close()
except Exception:
PrintException()
return data
def checkInternet():
try:
response = urllib2.urlopen("http://google.com", None, 5)
response.close()
except urllib2.HTTPError:
return False
except urllib2.URLError:
return False
except socket.timeout:
return False
else:
return True
def checkimage():
mycheck = False
if not fileExists('/proc/stb/info') or not fileExists('' + LinkNeoBoot + '/neoskins/neo/neo_skin.py') or not fileExists('' + LinkNeoBoot + '/bin/utilsbh') or not fileExists('' + LinkNeoBoot + '/stbinfo'):
mycheck = False
else:
mycheck = True
return mycheck
def main(session, **kwargs):
vip = checkimage()
if vip == 1:
if not fileExists('' + LinkNeoBoot + '/.location'):
pass
else:
if not fileExists('%sImageBoot/.version' % getNeoLocation()):
if fileExists('' + LinkNeoBoot + '/files/mountpoint.sh'):
os.system('chmod 0755 ' + LinkNeoBoot + '/files/mountpoint.sh; ' + LinkNeoBoot + '/files/mountpoint.sh')
version = 0
if fileExists('%sImageBoot/.version' % getNeoLocation()):
f = open('%sImageBoot/.version' % getNeoLocation())
version = float(f.read())
f.close()
if fileExists('%sImageBoot/.neonextboot' % getNeoLocation()):
f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r' )
mypath2 = f2.readline().strip()
f2.close()
if mypath2 != 'Flash' or mypath2 == 'Flash' and checkimage():
if float(PLUGINVERSION) != version:
session.open(MyUpgrade)
else:
session.open(NeoBootImageChoose)
else:
session.open(MessageBox, _('Sorry, Unable to install, bad satellite receiver or you do not have the full plug-in version\n The full version of the NEO VIP plugin is on the forum address:\nhttp://all-forum.cba.pl in the VIP section.'), MessageBox.TYPE_INFO, 20)
else:
session.open(NeoBootInstallation)
else:
session.open(MessageBox, (_('Sorry, Unable to install, bad satellite receiver or you do not have the full plug-in version\n\nThe full version of the NEO VIP plugin is on the forum address:\nhttp://all-forum.cba.pl in the VIP section.')), MessageBox.TYPE_INFO, 25)
def menu(menuid, **kwargs):
if menuid == 'mainmenu':
return [(_('NeoBOOT'),
main,
'neo_boot',
1)]
return []
from Plugins.Plugin import PluginDescriptor
def Plugins(**kwargs):
return [PluginDescriptor(name='NeoBoot', description='NeoBoot', where=PluginDescriptor.WHERE_MENU, fnc=menu), PluginDescriptor(name='NeoBoot', description=_('Installing multiple images'), icon='neo.png', where=PluginDescriptor.WHERE_PLUGINMENU, fnc=main)]
####################### _(-_-)_ gutosie _(-_-)_ #######################