More adaptation for Novaler4k Pro

** apply aggressive autopep8 on all files
** add condition for novaler4kpro in extract.py
** add receiver icon for novaler4kpro
** fix mounting internal storage for novaler4k pro
** other minor fixes
This commit is contained in:
ahmedmoselhi
2025-10-30 02:18:32 -04:00
parent 26c23c98aa
commit 7d9c6406e4
73 changed files with 15183 additions and 8565 deletions

View File

@@ -1,27 +1,28 @@
# -*- coding: utf-8 -*-
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
import os
import gettext
PluginLanguageDomain = 'NeoBoot'
PluginLanguagePath = 'Extensions/NeoBoot/locale'
PluginLanguageDomain = "NeoBoot"
PluginLanguagePath = "Extensions/NeoBoot/locale"
def localeInit():
lang = language.getLanguage()[:2]
os.environ['LANGUAGE'] = lang
os.environ["LANGUAGE"] = lang
print("[NeoBoot] set language to "), lang
gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(
SCOPE_PLUGINS, PluginLanguagePath))
gettext.bindtextdomain(
PluginLanguageDomain,
resolveFilename(
SCOPE_PLUGINS,
PluginLanguagePath))
def _(txt):
t = gettext.dgettext(PluginLanguageDomain, txt)
if t == txt:
print("[NeoBoot] fallback to default translation for"), txt
t = gettext.dgettext('enigma2', txt)
t = gettext.dgettext("enigma2", txt)
return t

View File

@@ -1,9 +1,33 @@
#!/usr/bin/python
import sys
from . import extract
if len(sys.argv) < 17:
pass
import extract
if len(sys.argv) < 18:
print(
f"Error: Incorrect number of arguments. Expected 17, got {
len(
sys.argv) -
1}",
file=sys.stderr,
)
print(f"Usage: {sys.argv[0]} <arg1> <arg2> ... <arg17>", file=sys.stderr)
sys.exit(1)
else:
extract.NEOBootMainEx(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6], sys.argv[7], sys.argv[8],
sys.argv[9], sys.argv[10], sys.argv[11], sys.argv[12], sys.argv[13], sys.argv[14], sys.argv[15], sys.argv[16], sys.argv[17])
extract.NEOBootMainEx(
sys.argv[1],
sys.argv[2],
sys.argv[3],
sys.argv[4],
sys.argv[5],
sys.argv[6],
sys.argv[7],
sys.argv[8],
sys.argv[9],
sys.argv[10],
sys.argv[11],
sys.argv[12],
sys.argv[13],
sys.argv[14],
sys.argv[15],
sys.argv[16],
sys.argv[17],
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from Tools.CList import CList
@@ -9,7 +7,7 @@ class Job(object):
def __init__(self, name):
self.tasks = []
self.resident_tasks = []
self.workspace = '/tmp'
self.workspace = "/tmp"
self.current_task = 0
self.callback = None
self.name = name
@@ -33,18 +31,20 @@ class Job(object):
if self.current_task == len(self.tasks):
return self.end
t = self.tasks[self.current_task]
jobprogress = t.weighting * t.progress / \
float(t.end) + \
sum([task.weighting for task in self.tasks[:self.current_task]])
jobprogress = t.weighting * t.progress / float(t.end) + sum(
[task.weighting for task in self.tasks[: self.current_task]]
)
return int(jobprogress * self.weightScale)
progress = property(getProgress)
def getStatustext(self):
return {self.NOT_STARTED: _('Waiting'),
self.IN_PROGRESS: _('In progress'),
self.FINISHED: _('Finished'),
self.FAILED: _('Failed')}[self.status]
return {
self.NOT_STARTED: _("Waiting"),
self.IN_PROGRESS: _("In progress"),
self.FINISHED: _("Finished"),
self.FAILED: _("Failed"),
}[self.status]
def task_progress_changed_CB(self):
self.state_changed()
@@ -73,8 +73,10 @@ class Job(object):
self.callback(self, None, [])
self.callback = None
else:
print(("still waiting for %d resident task(s) %s to finish") %
(len(self.resident_tasks), str(self.resident_tasks)))
print(
("still waiting for %d resident task(s) %s to finish")
% (len(self.resident_tasks), str(self.resident_tasks))
)
else:
self.tasks[self.current_task].run(self.taskCallback)
self.state_changed()
@@ -116,7 +118,8 @@ class Job(object):
self.abort()
def __str__(self):
return 'Components.Task.Job name=%s #tasks=%s' % (self.name, len(self.tasks))
return "Components.Task.Job name=%s #tasks=%s" % (
self.name, len(self.tasks))
class Task(object):
@@ -133,11 +136,11 @@ class Task(object):
self.weighting = 100
self.__progress = 0
self.cmd = None
self.cwd = '/tmp'
self.cwd = "/tmp"
self.args = []
self.cmdline = None
self.task_progress_changed = None
self.output_line = ''
self.output_line = ""
job.addTask(self)
self.container = None
return
@@ -173,6 +176,7 @@ class Task(object):
return
else:
from enigma import eConsoleAppContainer
self.container = eConsoleAppContainer()
self.container.appClosed.append(self.processFinished)
self.container.stdoutAvail.append(self.processStdout)
@@ -180,11 +184,17 @@ class Task(object):
if self.cwd is not None:
self.container.setCWD(self.cwd)
if not self.cmd and self.cmdline:
print(("execute:"), self.container.execute(
self.cmdline), self.cmdline)
print(
("execute:"),
self.container.execute(
self.cmdline),
self.cmdline)
else:
print(("execute:"), self.container.execute(
self.cmd, *self.args), ' '.join(self.args))
print(
("execute:"),
self.container.execute(self.cmd, *self.args),
" ".join(self.args),
)
if self.initial_input:
self.writeInput(self.initial_input)
return
@@ -221,10 +231,10 @@ class Task(object):
def processOutput(self, data):
self.output_line += data
while True:
i = self.output_line.find('\n')
i = self.output_line.find("\n")
if i == -1:
break
self.processOutputLine(self.output_line[:i + 1])
self.processOutputLine(self.output_line[: i + 1])
self.output_line = self.output_line[i + 1:]
def processOutputLine(self, line):
@@ -273,7 +283,7 @@ class Task(object):
progress = property(getProgress, setProgress)
def __str__(self):
return 'Components.Task.Task name=%s' % self.name
return "Components.Task.Task name=%s" % self.name
class LoggingTask(Task):
@@ -283,7 +293,7 @@ class LoggingTask(Task):
self.log = []
def processOutput(self, data):
print(("[%s]") % self.name, data, end=' ')
print(("[%s]") % self.name, data, end=" ")
self.log.append(data)
@@ -292,6 +302,7 @@ class PythonTask(Task):
def _run(self):
from twisted.internet import threads
from enigma import eTimer
self.aborted = False
self.pos = 0
threads.deferToThread(self.work).addBoth(self.onComplete)
@@ -329,12 +340,13 @@ class ConditionTask(Task):
def prepare(self):
from enigma import eTimer
self.timer = eTimer()
self.timer.callback.append(self.trigger)
self.timer.start(1000)
def cleanup(self, failed):
if hasattr(self, 'timer'):
if hasattr(self, "timer"):
self.timer.stop()
del self.timer
@@ -387,13 +399,23 @@ class JobManager:
def notifyFailed(self, job, task, problems):
from Tools import Notifications
from Screens.MessageBox import MessageBox
if problems[0].RECOVERABLE:
Notifications.AddNotificationWithCallback(self.errorCB, MessageBox, _(
'Error: %s\nRetry?') % problems[0].getErrorMessage(task))
Notifications.AddNotificationWithCallback(
self.errorCB,
MessageBox,
_("Error: %s\nRetry?") % problems[0].getErrorMessage(task),
)
return True
else:
Notifications.AddNotification(MessageBox, job.name + '\n' + _(
'Error') + ': %s' % problems[0].getErrorMessage(task), type=MessageBox.TYPE_ERROR)
Notifications.AddNotification(
MessageBox,
job.name
+ "\n"
+ _("Error")
+ ": %s" % problems[0].getErrorMessage(task),
type=MessageBox.TYPE_ERROR,
)
return False
def jobDone(self, job, task, problems):
@@ -412,6 +434,7 @@ class JobManager:
if not self.visible:
from Tools import Notifications
from Screens.TaskView import JobView
self.visible = True
Notifications.AddNotification(JobView, job)
@@ -438,7 +461,10 @@ class Condition:
RECOVERABLE = False
def getErrorMessage(self, task):
return _('An unknown error occurred!') + ' (%s @ task %s)' % (self.__class__.__name__, task.__class__.__name__)
return _("An unknown error occurred!") + " (%s @ task %s)" % (
self.__class__.__name__,
task.__class__.__name__,
)
class WorkspaceExistsPrecondition(Condition):
@@ -455,6 +481,7 @@ class DiskspacePrecondition(Condition):
def check(self, task):
import os
try:
s = os.statvfs(task.job.workspace)
self.diskspace_available = s.f_bsize * s.f_bavail
@@ -463,36 +490,50 @@ class DiskspacePrecondition(Condition):
return False
def getErrorMessage(self, task):
return _('Not enough disk space. Please free up some disk space and try again. (%d MB required, %d MB available)') % (self.diskspace_required / 1024 / 1024, self.diskspace_available / 1024 / 1024)
return _(
"Not enough disk space. Please free up some disk space and try again. (%d MB required, %d MB available)"
) % (
self.diskspace_required / 1024 / 1024,
self.diskspace_available / 1024 / 1024,
)
class ToolExistsPrecondition(Condition):
def check(self, task):
import os
if task.cmd[0] == '/':
if task.cmd[0] == "/":
self.realpath = task.cmd
print(
"[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!")
"[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!"
)
return os.access(self.realpath, os.X_OK)
self.realpath = task.cmd
path = os.environ.get('PATH', '').split(os.pathsep)
path.append(task.cwd + '/')
absolutes = [file for file in map(lambda directory, file=task.cmd: os.path.join(
directory, file), path) if os.access(file, os.X_OK)]
path = os.environ.get("PATH", "").split(os.pathsep)
path.append(task.cwd + "/")
absolutes = [
file for file in map(
lambda directory,
file=task.cmd: os.path.join(
directory,
file),
path) if os.access(
file,
os.X_OK)]
if absolutes:
self.realpath = absolutes[0]
return True
return False
def getErrorMessage(self, task):
return _('A required tool (%s) was not found.') % self.realpath
return _("A required tool (%s) was not found.") % self.realpath
class AbortedPostcondition(Condition):
def getErrorMessage(self, task):
return 'Cancelled upon user request'
return "Cancelled upon user request"
class ReturncodePostcondition(Condition):
@@ -501,13 +542,13 @@ class ReturncodePostcondition(Condition):
return task.returncode == 0
def getErrorMessage(self, task):
if hasattr(task, 'log') and task.log:
log = ''.join(task.log).strip()
log = log.split('\n')[-3:]
log = '\n'.join(log)
if hasattr(task, "log") and task.log:
log = "".join(task.log).strip()
log = log.split("\n")[-3:]
log = "\n".join(log)
return log
else:
return _('Error code') + ': %s' % task.returncode
return _("Error code") + ": %s" % task.returncode
class FailedPostcondition(Condition):
@@ -517,13 +558,13 @@ class FailedPostcondition(Condition):
def getErrorMessage(self, task):
if isinstance(self.exception, int):
if hasattr(task, 'log'):
log = ''.join(task.log).strip()
log = log.split('\n')[-4:]
log = '\n'.join(log)
if hasattr(task, "log"):
log = "".join(task.log).strip()
log = log.split("\n")[-4:]
log = "\n".join(log)
return log
else:
return _('Error code') + ' %s' % self.exception
return _("Error code") + " %s" % self.exception
return str(self.exception)
def check(self, task):

View File

@@ -1,27 +1,28 @@
# -*- coding: utf-8 -*-
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
import os
import gettext
PluginLanguageDomain = 'NeoBoot'
PluginLanguagePath = 'Extensions/NeoBoot/locale'
PluginLanguageDomain = "NeoBoot"
PluginLanguagePath = "Extensions/NeoBoot/locale"
def localeInit():
lang = language.getLanguage()[:2]
os.environ['LANGUAGE'] = lang
os.environ["LANGUAGE"] = lang
print("[NeoBoot] set language to "), lang
gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(
SCOPE_PLUGINS, PluginLanguagePath))
gettext.bindtextdomain(
PluginLanguageDomain,
resolveFilename(
SCOPE_PLUGINS,
PluginLanguagePath))
def _(txt):
t = gettext.dgettext(PluginLanguageDomain, txt)
if t == txt:
print("[NeoBoot] fallback to default translation for"), txt
t = gettext.dgettext('enigma2', txt)
t = gettext.dgettext("enigma2", txt)
return t

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
from Plugins.Extensions.NeoBoot.__init__ import _
# from __future__ import print_function
from enigma import eConsoleAppContainer
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
@@ -16,29 +13,39 @@ class Console(Screen):
<widget name="text" position="-2,-1" size="1015,230" font="Console;14" />
</screen>"""
# def __init__(self, session, title = 'Console', cmdlist = None, finishedCallback = None, closeOnSuccess = False):
# Screen.__init__(self, session)
def __init__(self, session, title=_('Console'), cmdlist=None, finishedCallback=None, closeOnSuccess=False):
def __init__(
self,
session,
title=_("Console"),
cmdlist=None,
finishedCallback=None,
closeOnSuccess=False,
):
Screen.__init__(self, session)
self.finishedCallback = finishedCallback
self.closeOnSuccess = closeOnSuccess
self.errorOcurred = False
self['key_red'] = Label(_('Stop action'))
self['key_green'] = Label(_('Hide Console'))
self['text'] = ScrollLabel('')
self['summary_description'] = StaticText('')
self['actions'] = ActionMap(['WizardActions', 'DirectionActions', 'ColorActions'], {'ok': self.cancel,
'back': self.cancel,
'up': self.key_up,
'down': self.key_down,
'green': self.key_green,
'red': self.key_red}, -1)
self["key_red"] = Label(_("Stop action"))
self["key_green"] = Label(_("Hide Console"))
self["text"] = ScrollLabel("")
self["summary_description"] = StaticText("")
self["actions"] = ActionMap(
["WizardActions", "DirectionActions", "ColorActions"],
{
"ok": self.cancel,
"back": self.cancel,
"up": self.key_up,
"down": self.key_down,
"green": self.key_green,
"red": self.key_red,
},
-1,
)
self.cmdlist = cmdlist
self.newtitle = title
self.screen_hide = False
self.cancel_msg = None
self.output_file = ''
self.output_file = ""
self.onShown.append(self.updateTitle)
self.container = eConsoleAppContainer()
self.run = 0
@@ -57,10 +64,14 @@ class Console(Screen):
return self.container.execute(cmd)
def startRun(self):
self['text'].setText(_('Execution progress:') + '\n\n')
self['summary_description'].setText(_('Execution progress:'))
print(("[Console] executing in run"), self.run,
(" the command:"), self.cmdlist[self.run])
self["text"].setText(_("Execution progress:") + "\n\n")
self["summary_description"].setText(_("Execution progress:"))
print(
("[Console] executing in run"),
self.run,
(" the command:"),
self.cmdlist[self.run],
)
if self.doExec(self.cmdlist[self.run]):
self.runFinished(-1)
@@ -73,21 +84,20 @@ class Console(Screen):
if self.doExec(self.cmdlist[self.run]):
self.runFinished(-1)
else:
# self['key_red'].setText(_('Close'))
# self['key_green'].setText(_('Save'))
self.toggleScreenHide(True)
if self.cancel_msg:
self.cancel_msg.close()
from Tools.Directories import fileExists
if not fileExists('/etc/vtiversion.info'):
lastpage = self['text'].isAtLastPage()
self['text'].appendText('\n' + _('Execution finished!!'))
self['summary_description'].setText(
'\n' + _('Execution finished!!'))
if not fileExists("/etc/vtiversion.info"):
lastpage = self["text"].isAtLastPage()
self["text"].appendText("\n" + _("Execution finished!!"))
self["summary_description"].setText(
"\n" + _("Execution finished!!"))
if self.finishedCallback is not None:
self.finishedCallback()
if not self.errorOcurred and self.closeOnSuccess:
self.output_file = 'end'
self.output_file = "end"
self.cancel()
return
@@ -95,27 +105,26 @@ class Console(Screen):
if self.screen_hide:
self.toggleScreenHide()
return
self['text'].pageUp()
self["text"].pageUp()
def key_down(self):
if self.screen_hide:
self.toggleScreenHide()
return
self['text'].pageDown()
self["text"].pageDown()
def key_green(self):
if self.screen_hide:
self.toggleScreenHide()
return
if self.output_file == 'end':
if self.output_file == "end":
pass
elif self.output_file.startswith('/tmp/'):
self['text'].setText(self.readFile(self.output_file))
self['key_green'].setText(_(' '))
self.output_file = 'end'
elif self.output_file.startswith("/tmp/"):
self["text"].setText(self.readFile(self.output_file))
self["key_green"].setText(_(" "))
self.output_file = "end"
elif self.run == len(self.cmdlist):
self.saveOutputText()
# self.toggleScreenHide()
else:
self.toggleScreenHide()
@@ -126,8 +135,13 @@ class Console(Screen):
if self.run == len(self.cmdlist):
self.cancel()
else:
self.cancel_msg = self.session.openWithCallback(self.cancelCB, MessageBox, _(
'Cancel execution?'), type=MessageBox.TYPE_YESNO, default=False)
self.cancel_msg = self.session.openWithCallback(
self.cancelCB,
MessageBox,
_("Cancel execution?"),
type=MessageBox.TYPE_YESNO,
default=False,
)
def cancelCB(self, ret=None):
self.cancel_msg = None
@@ -137,11 +151,18 @@ class Console(Screen):
def saveOutputText(self):
from time import time, localtime
lt = localtime(time())
self.output_file = '/tmp/%02d%02d%02d_console.txt' % (
self.output_file = "/tmp/%02d%02d%02d_console.txt" % (
lt[3], lt[4], lt[5])
self.session.openWithCallback(self.saveOutputTextCB, MessageBox, _(
"Save the commands and the output to a file?\n('%s')") % self.output_file, type=MessageBox.TYPE_YESNO, default=True)
self.session.openWithCallback(
self.saveOutputTextCB,
MessageBox,
_("Save the commands and the output to a file?\n('%s')") %
self.output_file,
type=MessageBox.TYPE_YESNO,
default=True,
)
def formatCmdList(self, source):
if isinstance(source, (list, tuple)):
@@ -155,44 +176,47 @@ class Console(Screen):
def saveOutputTextCB(self, ret=None):
if ret:
from os import path
failtext = _("Path to save not exist: '/tmp/'")
if path.exists('/tmp/'):
text = 'commands ...\n\n'
if path.exists("/tmp/"):
text = "commands ...\n\n"
try:
cmdlist = list(self.formatCmdList(self.cmdlist))
text += 'command line: %s\n\n' % cmdlist[0]
script = ''
text += "command line: %s\n\n" % cmdlist[0]
script = ""
for cmd in cmdlist[0].split():
if '.' in cmd:
if cmd[-3:] in ('.py', '.sh'):
if "." in cmd:
if cmd[-3:] in (".py", ".sh"):
script = cmd
break
if script and path.isfile(script):
text += 'script listing: %s\n\n%s\n\n' % (
script, self.readFile(script))
text += "script listing: %s\n\n%s\n\n" % (
script,
self.readFile(script),
)
if len(cmdlist) > 1:
text += 'next commands:\n\n' + \
'\n'.join(cmdlist[1:]) + '\n\n'
except:
text += 'error read commands!!!\n\n'
text += "next commands:\n\n" + \
"\n".join(cmdlist[1:]) + "\n\n"
except BaseException:
text += "error read commands!!!\n\n"
text += '-' * 50 + \
'\n\noutputs ...\n\n%s' % self['text'].getText()
text += "-" * 50 + \
"\n\noutputs ...\n\n%s" % self["text"].getText()
try:
f = open(self.output_file, 'w')
f = open(self.output_file, "w")
f.write(text)
f.close()
self['key_green'].setText(_('Load'))
self["key_green"].setText(_("Load"))
return
except:
except BaseException:
failtext = _("File write error: '%s'") % self.output_file
self.output_file = 'end'
self['key_green'].setText(_(' '))
self.output_file = "end"
self["key_green"].setText(_(" "))
self.session.open(MessageBox, failtext, type=MessageBox.TYPE_ERROR)
else:
self.output_file = ''
self.output_file = ""
def toggleScreenHide(self, setshow=False):
if self.screen_hide or setshow:
@@ -203,12 +227,12 @@ class Console(Screen):
def readFile(self, file):
try:
with open(file, 'r') as rdfile:
with open(file, "r") as rdfile:
rd = rdfile.read()
rdfile.close()
except:
except BaseException:
if file == self.output_file:
rd = self['text'].getText()
rd = self["text"].getText()
else:
rd = "File read error: '%s'\n" % file
@@ -226,4 +250,4 @@ class Console(Screen):
self.container.kill()
def dataAvail(self, str):
self['text'].appendText(str)
self["text"].appendText(str)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

BIN
NeoBoot/images/novaler4kpro.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -1,22 +1,19 @@
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# biko73 = ./neoskins/biko/skin_biko73.py
# ImageChooseFULLHD - biko73
ImageChooseFULLHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<widget name="progreso" position="627,590" size="452,10" borderWidth="1" zPosition="3" />
<ePixmap position="center,0" size="1920,1078" zPosition="-2" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/background.png" />
<widget name="progreso" position="627,590" size="452,10" borderWidth="1" zPosition="3" />
<ePixmap position="center,0" size="1920,1078" zPosition="-2" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/background.png" />
<widget name="config" position="1289,266" size="620,688" selectionPixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/selektor.png" itemHeight="43" zPosition="3" font="baslk;32" scrollbarMode="showOnDemand" foregroundColor="#99FFFF" backgroundColor="#1A0F0F0F" foregroundColorSelected="yellow" backgroundColorSelected="#1A27408B" scrollbarSliderBorderWidth="1" scrollbarWidth="8" scrollbarSliderForegroundColor="#99FFFF" scrollbarSliderBorderColor="#0027408B" enableWrapAround="1" transparent="1" />
<ePixmap position="1865,190" size="556,122" zPosition="4" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/updown.png" alphatest="on" />
<ePixmap position="1304,43" zPosition="4" size="556,122" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/logo.png" alphatest="on" />
<ePixmap position="1304,43" zPosition="5" scale="1" size="556,122" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/bg.png" alphatest="on" />
<ePixmap position="1022,166" zPosition="5" size="258,106" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/box.png" alphatest="on" />
<eLabel position="60,615" size="1040,2" backgroundColor="#C0C0C0" foregroundColor="#C0C0C0" name="linia" />
<ePixmap position="1022,166" zPosition="5" size="258,106" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/box.png" alphatest="on" />
<eLabel position="60,615" size="1040,2" backgroundColor="#C0C0C0" foregroundColor="#C0C0C0" name="linia" />
<widget name="device_icon" position="123,476" size="146,136" alphatest="on" zPosition="2" />
<widget source="global.CurrentTime" render="Label" position="864,46" size="430,40" font="Console; 30" valign="center" halign="center" backgroundColor="skincolor" transparent="1">
<convert type="ClockToText">Format:%A, %d %B %Y</convert>
</widget>
@@ -26,46 +23,46 @@ ImageChooseFULLHD = """
<widget source="global.CurrentTime" render="Label" position="1205,96" size="55,34" font="Console; 28" valign="top" halign="left" backgroundColor="black" foregroundColor="white" transparent="1">
<convert type="ClockToText">Format::%S</convert>
</widget>
<widget name="key_red" position="80,1000" zPosition="1" size="567,40" font="Regular;34" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
<widget name="key_green" position="692,1000" zPosition="1" size="325,40" font="Regular;34" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="key_yellow" position="1310,1000" zPosition="1" size="260,40" font="Regular;34" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<widget name="key_blue" position="1625,1000" zPosition="1" size="260,40" font="Regular;34" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="blue" />
<eLabel backgroundColor="black" font="Regular; 44" foregroundColor="red" position="35,45" size="298,50" text=" NeoMultiBoot " valign="center" transparent="1" />
<ePixmap position="50,424" size="73,42" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/menu_setup.png" alphatest="on" zPosition="6" />
<widget name="key_menu" position="140,420" size="269,45" font="Regular;30" zPosition="1" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#808080" position="90,719" size="80,43" text="1 &gt;" valign="center" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 44" foregroundColor="red" position="35,45" size="298,50" text=" NeoMultiBoot " valign="center" transparent="1" />
<ePixmap position="50,424" size="73,42" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/menu_setup.png" alphatest="on" zPosition="6" />
<widget name="key_menu" position="140,420" size="269,45" font="Regular;30" zPosition="1" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#808080" position="90,719" size="80,43" text="1 &gt;" valign="center" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#808080" position="90,787" size="80,43" text="2 &gt;" valign="center" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#808080" position="90,851" size="80,43" text="3 &gt;" valign="center" transparent="1" />
<widget name="key_1" position="178,720" zPosition="1" size="397,46" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
<widget name="key_2" position="177,787" zPosition="1" size="403,46" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="key_3" position="176,851" zPosition="1" size="403,46" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<widget name="label1" position="1288,215" size="601,99" zPosition="4" halign="center" font="Regular;38" foregroundColor="red" backgroundColor="black" transparent="1" />
<widget name="label2" position="49,149" zPosition="1" size="543,66" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="white" />
<widget name="label3" position="637,475" zPosition="1" size="426,97" font="Regular;28" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<widget name="label1" position="1288,215" size="601,99" zPosition="4" halign="center" font="Regular;38" foregroundColor="red" backgroundColor="black" transparent="1" />
<widget name="label2" position="49,149" zPosition="1" size="543,66" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="white" />
<widget name="label3" position="637,475" zPosition="1" size="426,97" font="Regular;28" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<widget name="label4" position="50,235" zPosition="1" size="481,66" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="white" />
<widget name="label5" position="615,148" zPosition="1" size="305,66" font="Regular;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="blue" />
<widget name="label7" position="854,324" zPosition="1" size="70,66" font="Regular;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="label8" position="47,324" zPosition="1" size="498,66" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="white" />
<widget name="label5" position="615,148" zPosition="1" size="305,66" font="Regular;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="blue" />
<widget name="label7" position="854,324" zPosition="1" size="70,66" font="Regular;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="label8" position="47,324" zPosition="1" size="498,66" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="white" />
<widget name="label9" position="638,45" zPosition="1" size="292,50" font="Regular;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
<widget name="label10" position="800,420" zPosition="1" size="125,55" font="Regular;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
<widget name="label10" position="800,420" zPosition="1" size="125,55" font="Regular;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
<widget name="label13" position="414,420" zPosition="1" size="374,55" font="Regular;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="label15" position="322,573" zPosition="1" size="265,40" font="Regular;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="label15" position="322,573" zPosition="1" size="265,40" font="Regular;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget source="session.VideoPicture" render="Pig" position="650,665" size="398,223" zPosition="3" backgroundColor="transparent" />
<ePixmap position="625,645" size="450,330" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/video.png" alphatest="on" zPosition="4" />
<ePixmap position="625,645" size="450,330" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/video.png" alphatest="on" zPosition="4" />
<widget name="label14" position="335,45" zPosition="1" size="350,50" font="Regular;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="label19" position="184,641" size="393,43" font="Regular;22" halign="left" valign="left" zPosition="1" backgroundColor="black" transparent="1" foregroundColor="orange" />
<widget name="label19" position="184,641" size="393,43" font="Regular;22" halign="left" valign="left" zPosition="1" backgroundColor="black" transparent="1" foregroundColor="orange" />
<ePixmap position="55,639" size="105,64" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko/arrowright.png" alphatest="on" />
<widget name="label6" position="567,235" zPosition="1" size="357,84" font="Regular;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<widget name="label17" position="1049,281" size="213,66" font="Regular;30" halign="center" valign="center" zPosition="1" backgroundColor="black" transparent="1" foregroundColor="#00ff7f50" />
<widget name="label16" position="76,924" zPosition="1" size="142,50" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
@@ -73,5 +70,3 @@ ImageChooseFULLHD = """
</screen>
"""
###

View File

@@ -1,10 +1,7 @@
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# biko73 = ./neoskins/biko/skin_biko73.py
# ImageChooseFULLHD - biko73
ImageChooseFULLHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<widget name="progreso" position="560,525" size="450,10" borderWidth="1" zPosition="3" />
@@ -32,8 +29,8 @@ ImageChooseFULLHD = """
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/button_blue.png" position="1475,1030" size="317,27" zPosition="1" alphatest="blend" />
<ePixmap position="30,650" size="60,40" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/key_Menu.png" alphatest="on" zPosition="2" />
<ePixmap position="30,1020" size="60,40" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/key_Exit.png" alphatest="on" zPosition="2" />
<ePixmap position="635,625" size="450,330" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/video1.png" alphatest="on" zPosition="3" />
<ePixmap position="center,0" size="1920,1078" zPosition="-2" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/background.png" />
<ePixmap position="635,625" size="450,330" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/video1.png" alphatest="on" zPosition="3" />
<ePixmap position="center,0" size="1920,1078" zPosition="-2" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/background.png" />
<ePixmap position="45,130" size="30,30" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/icon_1.png" alphatest="on" />
<ePixmap position="45,210" size="30,30" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/icon_1.png" alphatest="on" />
<ePixmap position="45,300" size="30,30" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/icon_1.png" alphatest="on" />
@@ -46,7 +43,7 @@ ImageChooseFULLHD = """
<ePixmap position="1178,835" zPosition="5" size="562,113" scale="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/box.png" alphatest="on" />
<ePixmap position="45,725" size="40,40" scale="1" zPosition="3" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/key_1.png" alphatest="blend" />
<ePixmap position="45,785" size="40,40" scale="1" zPosition="3" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/key_2.png" alphatest="blend" />
<ePixmap position="45,850" size="40,40" scale="1" zPosition="3" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/key_3.png" alphatest="blend" />
<ePixmap position="45,850" size="40,40" scale="1" zPosition="3" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/biko2/key_3.png" alphatest="blend" />
<widget name="key_1" position="135,720" zPosition="1" size="405,45" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#036dc1" />
<widget name="key_2" position="135,787" zPosition="1" size="405,45" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#fb353d" />
<widget name="key_3" position="135,851" zPosition="1" size="405,45" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#fdba2b" />
@@ -72,5 +69,3 @@ ImageChooseFULLHD = """
</screen>
"""
###

View File

@@ -1,32 +1,29 @@
# skin = ./neoskins/cobaltfhd_skin - mod. gutosie
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# ImageChooseFULLHD
ImageChooseFULLHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1920,1080" title="NeoBoot" flags="wfNoBorder" backgroundColor="background" transparent="0">
<ePixmap position="0,0" zPosition="-10" size="1920,1080" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/channel.png" transparent="1" />
<widget source="global.CurrentTime" render="Label" position="980,60" size="920,50" font="Regular;32" valign="center" halign="right" backgroundColor="transpBlack" foregroundColor="#58bcff" transparent="1">
<screen name="NeoBootImageChoose" position="center,center" size="1920,1080" title="NeoBoot" flags="wfNoBorder" backgroundColor="background" transparent="0">
<ePixmap position="0,0" zPosition="-10" size="1920,1080" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/channel.png" transparent="1" />
<widget source="global.CurrentTime" render="Label" position="980,60" size="920,50" font="Regular;32" valign="center" halign="right" backgroundColor="transpBlack" foregroundColor="#58bcff" transparent="1">
<convert type="ClockToText">Format:%A %e %B %Y </convert>
</widget>
<widget source="global.CurrentTime" render="Label" position="980,20" size="920,50" font="Regular;32" valign="center" halign="right" backgroundColor="transpBlack" transparent="1" foregroundColor="#58bcff">
</widget>
<widget source="global.CurrentTime" render="Label" position="980,20" size="920,50" font="Regular;32" valign="center" halign="right" backgroundColor="transpBlack" transparent="1" foregroundColor="#58bcff">
<convert type="ClockToText">Format:%H:%M:%S </convert>
</widget>
<ePixmap position="76,133" size="622,364" zPosition="4" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/ramka622x364.png" alphatest="blend" />
<widget source="session.VideoPicture" render="Pig" position=" 78,135" size="620,362" zPosition="3" backgroundColor="#ff000000"/>
<ePixmap position="76,133" size="622,364" zPosition="4" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/ramka622x364.png" alphatest="blend" />
<widget source="session.VideoPicture" render="Pig" position=" 78,135" size="620,362" zPosition="3" backgroundColor="#ff000000"/>
<eLabel position="20,20" size="720,50" font="Regular;44" halign="center" foregroundColor="#58bcff" backgroundColor="transpBlack" text=" NeoMultiBoot " transparent="1" />
<widget source="session.CurrentService" render="Label" position="130,90" size="520,38" zPosition="2" font="Regular;34" halign="center" noWrap="1" transparent="1" foregroundColor="white" backgroundColor="background">
<convert type="ServiceName">Name</convert>
</widget>
<widget source="session.Event_Now" render="Label" position="160,570" size="450,60" zPosition="2" halign="center" font="Regular;28" foregroundColor="#58bcff" backgroundColor="transpBlack" transparent="1" >
<convert type="EventName">Name</convert>
</widget>
<widget source="session.Event_Now" render="Progress" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/chan_p_bar.png" position="185,545" zPosition="1" size="400,10" borderWidth="1" borderColor="#606060" transparent="1"> <convert type="EventTime">Progress</convert>
<widget source="session.CurrentService" render="Label" position="130,90" size="520,38" zPosition="2" font="Regular;34" halign="center" noWrap="1" transparent="1" foregroundColor="white" backgroundColor="background">
<convert type="ServiceName">Name</convert>
</widget>
<widget source="session.Event_Now" render="Label" position="160,570" size="450,60" zPosition="2" halign="center" font="Regular;28" foregroundColor="#58bcff" backgroundColor="transpBlack" transparent="1" >
<convert type="EventName">Name</convert>
</widget>
<widget source="session.Event_Now" render="Progress" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/chan_p_bar.png" position="185,545" zPosition="1" size="400,10" borderWidth="1" borderColor="#606060" transparent="1"> <convert type="EventTime">Progress</convert>
</widget>
<widget source="session.Event_Now" render="Label" position="60,535" size="105,33" halign="right" font="Regular; 28" foregroundColor="ciel" backgroundColor="black" transparent="1" valign="center" zPosition="10">
<widget source="session.Event_Now" render="Label" position="60,535" size="105,33" halign="right" font="Regular; 28" foregroundColor="ciel" backgroundColor="black" transparent="1" valign="center" zPosition="10">
<convert type="EventTime">StartTime</convert>
<convert type="ClockToText">Format:%H:%M</convert>
</widget>
@@ -34,41 +31,40 @@ ImageChooseFULLHD = """
<convert type="EventTime">EndTime</convert>
<convert type="ClockToText">Format:%H:%M</convert>
</widget>
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/red.png" position="800,1040" size="250,20" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/red.png" position="800,1040" size="250,20" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/green.png" position="1060,1040" size="250,20" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/yellow.png" position="1320,1040" size="250,20" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/blue.png" position="1580,1040" size="250,20" alphatest="blend" />
<widget name="key_red" position="800,1000" size="250,30" zPosition="1" font="Regular;26" halign="center" backgroundColor="black" transparent="1" />
<widget name="key_green" position="1060,1000" size="250,30" zPosition="1" font="Regular;26" halign="center" backgroundColor="black" transparent="1" />
<widget name="key_yellow" position="1320,1000" size="250,30" zPosition="1" font="Regular;26" halign="center" backgroundColor="black" transparent="1" />
<widget name="key_blue" position="1580,1000" size="250,30" zPosition="1" font="Regular;26" halign="center" backgroundColor="black" transparent="1" />
<widget name="key_blue" position="1580,1000" size="250,30" zPosition="1" font="Regular;26" halign="center" backgroundColor="black" transparent="1" />
<widget name="config" position="80,640" size="600,330" font="Regular;28" selectionPixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/button600x40.png" itemHeight="40" scrollbarMode="showOnDemand" backgroundColor="background" foregroundColor="#bbbbbb" transparent="1" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/menu.png" position="300,1025" size="100,40" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/exit.png" position="450,1025" size="100,40" alphatest="blend" />
<widget name="label9" position="1200,60" zPosition="1" size="292,50" font="Regular;32" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58bcff" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/menu.png" position="300,1025" size="100,40" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/exit.png" position="450,1025" size="100,40" alphatest="blend" />
<widget name="label9" position="1200,60" zPosition="1" size="292,50" font="Regular;32" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58bcff" />
<widget name="label14" position="770,60" zPosition="1" size="350,50" font="Regular;32" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58bcff" />
<widget name="device_icon" position="1200,200" size="146,136" alphatest="on" zPosition="2" />
<widget name="progreso" position="970,330" size="530,15" borderWidth="1" zPosition="3" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/progressmovie7.png" />
<widget name="device_icon" position="1200,200" size="146,136" alphatest="on" zPosition="2" />
<widget name="progreso" position="970,330" size="530,15" borderWidth="1" zPosition="3" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/cobaltfhd/progressmovie7.png" />
<eLabel text="Pamięć Dysku:" position="1100,370" zPosition="1" size="265,42" font="Regular;32" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="label3" position="870,400" zPosition="1" size="799,124" font="Regular;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label3" position="870,400" zPosition="1" size="799,124" font="Regular;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<ePixmap position="900,520" zPosition="4" size="700,5" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/separator2.png" alphatest="blend" transparent="1" />
<widget name="label5" position="1300,548" zPosition="1" size="340,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label6" position="1300,580" zPosition="1" size="516,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label7" position="1300,630" zPosition="1" size="308,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label5" position="1300,548" zPosition="1" size="340,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label6" position="1300,580" zPosition="1" size="516,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label7" position="1300,630" zPosition="1" size="308,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label8" position="800,630" zPosition="1" size="500,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="label4" position="800,590" zPosition="1" size="500,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="label2" position="800,550" zPosition="1" size="500,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,700" size="80,46" text="1 &gt;" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,740" size="80,43" text="2 &gt;" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,780" size="80,42" text="3 &gt;" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,820" size="80,39" text="4 &gt;" transparent="1" />
<widget name="key_1" position="940,700" zPosition="1" size="363,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="key_2" position="940,740" zPosition="1" size="431,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="key_3" position="940,780" zPosition="1" size="367,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="label19" position="940,820" zPosition="1" size="713,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<ePixmap position="1440,700" zPosition="4" size="400,225" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrixhd.png" />
</screen>
<widget name="label4" position="800,590" zPosition="1" size="500,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="label2" position="800,550" zPosition="1" size="500,35" font="Regular;28" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,700" size="80,46" text="1 &gt;" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,740" size="80,43" text="2 &gt;" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,780" size="80,42" text="3 &gt;" transparent="1" />
<eLabel backgroundColor="black" font="Regular; 30" foregroundColor="#58ccff" position="890,820" size="80,39" text="4 &gt;" transparent="1" />
<widget name="key_1" position="940,700" zPosition="1" size="363,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="key_2" position="940,740" zPosition="1" size="431,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="key_3" position="940,780" zPosition="1" size="367,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<widget name="label19" position="940,820" zPosition="1" size="713,40" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#bbbbbb" />
<ePixmap position="1440,700" zPosition="4" size="400,225" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrixhd.png" />
</screen>
"""
###

View File

@@ -1,10 +1,7 @@
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# darog69 = ./neoskins/darog69/skin_darog69.py
# ImageChooseFULLHD - darog69
ImageChooseFULLHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<widget name="progreso" position="594,590" size="530,10" borderWidth="1" zPosition="3" />
@@ -55,5 +52,3 @@ ImageChooseFULLHD = """
</screen>
"""
###

View File

@@ -1,10 +1,7 @@
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# darog69 = ./neoskins/darog69_Ustym4kpro/skin_darog69_Ustym4kpro.py
# ImageChooseFULLHD - darog69_Ustym4kpro
ImageChooseFULLHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<widget name="progreso" position="595,590" size="530,15" borderWidth="1" zPosition="3" />
@@ -55,5 +52,3 @@ ImageChooseFULLHD = """
</screen>
"""
###

View File

@@ -1,36 +1,8 @@
# skin = ./meoskins/defaul_skin - gutosie
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# Colors (#AARRGGBB)
# ____Recommended colors - Zalecane kolory :
# color name="white" value="#ffffff"
# color name="darkwhite" value="#00dddddd"
# color name="red" value="#f23d21"
# color name="green" value="#389416"
# color name="blue" value="#0064c7"
# color name="yellow" value="#bab329"
# color name="orange" value="#00ffa500"
# color name="gray" value="#808080"
# color name="lightgrey" value="#009b9b9b"
# green = '#00389416' lub #00389416
# red = '#00ff2525'
# yellow = '#00ffe875'
# orange = '#00ff7f50'
# seledynowy = #00FF00
# jasny-blue = #99FFFF
# Zamiast font=Regular ktory nie rozpoznaje polskich znakow np. na VTi, mozesz zmienic na ponizsze font="*:
# font - genel
# font - baslk
# font - tasat
# font - dugme
# <widget name="config" position="1177,256" size="703,717" itemHeight="43" font="genel;30" scrollbarMode="showOnDemand" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" foregroundColorSelected="#00FFFFF" backgroundColorSelected="#1A27408B" scrollbarSliderBorderWidth="1" scrollbarWidth="8" scrollbarSliderForegroundColor="#00FFFFFF" scrollbarSliderBorderColor="#0027408B" enableWrapAround="1" transparent="1" />
# ____ Skin Ultra HD - ImageChooseFULLHD ___ mod. gutosie___
ImageChooseFULLHD = """
<screen name="ImageChooseFULLHD" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<eLabel backgroundColor="black" font="dugme; 30" foregroundColor="#99FFFF" position="70,50" size="298,55" valign="center" text="NEOBoot Multi-image" transparent="1" />
@@ -88,7 +60,6 @@ ImageChooseFULLHD = """
"""
# ____ Skin Ultra HD - ImageChooseULTRAHD ___ mod. gutosie___
ImageChooseULTRAHD = """
<screen name="NeoBootImageChoose" position="0,0" size="3840,2160" flags="wfNoBorder" backgroundColor="#ff111111">
<widget source="Title" render="Label" position="174,108" size="1575,150" font="baslk;102" valign="bottom" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" noWrap="1" transparent="1" />
@@ -137,7 +108,6 @@ ImageChooseULTRAHD = """
</screen>"""
# ____ Skin HD - ImageChoose ___mod. gutosie ___
ImageChooseHD = """
<screen name="NeoBootImageChoose" position="0,0" size="1280,720" flags="wfNoBorder" backgroundColor="#ff111111">\n
<widget source="Title" render="Label" position="58,36" size="712,50" font="baslk;28" valign="bottom" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" noWrap="1" transparent="1" />\n
@@ -189,7 +159,6 @@ ImageChooseHD = """
"""
# ____ Skin FULLHD - MyUpgradeFULLHD ___mod. gutosie ___
MyUpgradeFULLHD = """
<screen name="MyUpgradeFULLHD" position="center,center" size="1380,570" title="Tools Neoboot">
<ePixmap position="594,255" zPosition="-2" size="623,313" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrix.png" />
@@ -208,7 +177,6 @@ MyUpgradeFULLHD = """
</screen>"""
# ____ Skin UltraHD - MyUpgradeUltraHD ___mod. gutosie ___
MyUpgradeUltraHD = """
<screen name="MyUpgradeUltraHD" position="center,center" size="2100,1020" flags="wfNoBorder" backgroundColor="#ff111111">
<widget name="label1" position="180,210" size="1740,78" font="genel;60" halign="center" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" zPosition="1" transparent="1" />
@@ -225,7 +193,6 @@ MyUpgradeUltraHD = """
</screen>"""
# ____ Skin MyUpgradeHD - MyUpgradeHD ___mod. gutosie ___
MyUpgradeHD = """
<screen name="MyUpgradeHD" position="center,center" size="1127,569" title="Tools NeoBoot">
<ePixmap position="492,223" zPosition="-2" size="589,298" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrix.png" />
@@ -244,7 +211,6 @@ MyUpgradeHD = """
</screen>"""
# ____ Skin NeoBootInstallationFULLHD - NeoBootInstallationFULLHD ___mod. gutosie ___
NeoBootInstallationFULLHD = """
<screen name="NeoBootInstallationFULLHD" position="410,138" size="1200,850" title="NeoBoot">
<ePixmap position="643,282" zPosition="-2" size="531,331" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrix.png" />
@@ -269,7 +235,6 @@ NeoBootInstallationFULLHD = """
<widget name="key_blue" position="856,761" zPosition="1" size="326,52" font="dugme; 28" halign="center" valign="center" backgroundColor="blue" transparent="1" foregroundColor="blue" />
</screen>"""
# ____ Skin NeoBootInstallationUltraHD - NeoBootInstallationUltraHD ___mod. gutosie ___
NeoBootInstallationUltraHD = """
<screen name="NeoBootInstallationUltraHD" position="0,0" size="3840,2160" flags="wfNoBorder" backgroundColor="#ff111111">
<widget source="Title" render="Label" position="174,108" size="1575,150" font="baslk;102" valign="bottom" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" noWrap="1" transparent="1" />
@@ -278,7 +243,7 @@ NeoBootInstallationUltraHD = """
<widget name="label4" position="13,632" size="298,55" zPosition="1" halign="center" font="dugme;28" backgroundColor="black" transparent="1" foregroundColor="#ffffff" />
<widget name="label5" position="13,686" size="298,48" zPosition="1" halign="center" font="dugme;28" backgroundColor="black" transparent="1" foregroundColor="#ffffff" />
<widget name="config" position="210,690" size="2100,540" itemHeight="108" font="genel;60" zPosition="2" scrollbarMode="showOnDemand" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" foregroundColorSelected="#00FFFFF" backgroundColorSelected="#1A27408B" scrollbarSliderBorderWidth="1" scrollbarWidth="8" scrollbarSliderForegroundColor="#00FFFFFF" scrollbarSliderBorderColor="#0027408B" enableWrapAround="1" transparent="1" />
<eLabel position="210,1470" size="2100,3" backgroundColor="#0027408B" />
<widget name="label3" position="150,1500" size="2100,90" font="genel;60" halign="center" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" zPosition="1" transparent="1" />
@@ -305,7 +270,6 @@ NeoBootInstallationUltraHD = """
</screen>"""
# ____ Skin NeoBootInstallationHD - NeoBootInstallationHD ___mod. gutosie ___
NeoBootInstallationHD = """
<screen position="center, center" size="835, 500" title="NeoBoot">
<ePixmap position="0,0" zPosition="-1" size="835,500" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/frame835x500.png" />
@@ -323,5 +287,5 @@ NeoBootInstallationHD = """
<widget name="label3" position="20,339" size="816,61" zPosition="1" halign="center" font="Regular;24" backgroundColor="black" transparent="1" foregroundColor="#58ccff" />
<widget name="label4" position="49,451" size="288,32" zPosition="1" halign="center" font="dugme;22" backgroundColor="black" transparent="1" foregroundColor="#ffffff" />
<widget name="label5" position="376,452" size="293,32" zPosition="1" halign="center" font="dugme;22" backgroundColor="black" transparent="1" foregroundColor="#ffffff" />
<widget name="label6" position="540,54" size="293,32" zPosition="1" halign="center" font="dugme;22" backgroundColor="black" transparent="1" foregroundColor="#ffffff" />
<widget name="label6" position="540,54" size="293,32" zPosition="1" halign="center" font="dugme;22" backgroundColor="black" transparent="1" foregroundColor="#ffffff" />
</screen>"""

View File

@@ -1,11 +1,8 @@
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# mercus = /neoskins/mercus/mercus_skin.py
# ImageChooseFULLHD - mercus
ImageChooseFULLHD = """
<screen name="ImageChooseFULLHD" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/test1.png" alphatest="blend" position="15,center" size="1920,1080" zPosition="-2" />

View File

@@ -1,11 +1,8 @@
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# skin /neoskins/matrix/matrix_skin.py - mod.gutosie
# ImageChooseFULLHD
ImageChooseFULLHD = """
<screen name="NeoBootImageChoose" position="0,0" size="1920,1080" flags="wfNoBorder" backgroundColor="#ff111111">
<widget source="Title" render="Label" position="97,50" size="1067,72" font="baslk;41" valign="bottom" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" noWrap="1" transparent="1" />

View File

@@ -1,31 +1,8 @@
# neo = /neoskins/neo/neo_skin.py - gutosie
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# Colors (#AARRGGBB)
# ____Recommended colors - Zalecane kolory :
# color name="white" value="#ffffff"
# color name="darkwhite" value="#00dddddd"
# color name="red" value="#f23d21"
# color name="green" value="#389416"
# color name="blue" value="#0064c7"
# color name="yellow" value="#bab329"
# color name="orange" value="#00ffa500"
# color name="gray" value="#808080"
# color name="lightgrey" value="#009b9b9b"
# font genel
# font baslk
# font tasat
# font dugme
# jak by chcial ktos wlasny selektor, to przyklad:
# <widget name="label19" position="73,422" size="596,25" font="tasat;22" halign="left" valign="center" zPosition="1" backgroundColor="black" transparent="1" foregroundColor="orange" />
# ImageChooseFULLHD
ImageChooseFULLHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<eLabel backgroundColor="black" font="tasat;30" foregroundColor="red" position="75,50" size="309,45" valign="center" text="NEOBoot Multi-image" transparent="1" />
@@ -55,18 +32,14 @@ ImageChooseFULLHD = """
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/yellow.png" position="1035,990" size="34,38" zPosition="1" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/blue.png" position="1570,990" size="34,38" zPosition="1" alphatest="blend" />
#Window image selection - Okno wyboru image
<widget name="config" selectionPixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/selektor.png" position="1175,256" size="680,689" itemHeight="45" font="dugme;30" scrollbarMode="showOnDemand" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" foregroundColorSelected="#00FFFFF" backgroundColorSelected="#1A27408B" scrollbarSliderBorderWidth="1" scrollbarWidth="8" scrollbarSliderForegroundColor="#99FFFF" scrollbarSliderBorderColor="#0027408B" enableWrapAround="1" transparent="1" />
#Used Kernel:
<widget name="label19" position="73,422" size="596,25" font="tasat;22" halign="left" valign="center" zPosition="1" backgroundColor="black" transparent="1" foregroundColor="orange" />
#More options - Menu
<ePixmap position="70,898" size="55,40" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/key_menu.png" alphatest="blend" zPosition="3" />
<ePixmap position="150,902" size="66,35" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/arrowleft.png" alphatest="blend" zPosition="3" />
<widget name="key_menu" position="232,895" zPosition="1" size="343,40" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="blue" />
#key 1&gt; 2&gt; 3&gt;
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/key_1.png" alphatest="blend" position="65,657" size="55,40" zPosition="3" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/key_2.png" alphatest="blend" position="65,732" size="55,40" zPosition="3" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/key_3.png" alphatest="blend" position="65,807" size="55,40" zPosition="3" />
@@ -74,51 +47,34 @@ ImageChooseFULLHD = """
<widget name="key_2" position="130,732" zPosition="1" size="445,45" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="key_3" position="130,807" zPosition="1" size="445,45" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
#Please choose an image to boot
<widget name="label1" position="1177,150" size="703,105" zPosition="1" halign="left" font="tasat;30" foregroundColor="red" backgroundColor="black" transparent="1" />
#NeoBoot is running from:
<widget name="label2" position="70,164" zPosition="1" size="538,66" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00dddddd" />
<widget name="label5" position="837,164" zPosition="1" size="305,66" font="tasat;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00ffa500" />
#NeoBoot is running image:
<widget name="label4" position="70,245" zPosition="1" size="505,65" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00dddddd" />
<widget name="label6" position="580,235" zPosition="1" size="565,82" font="tasat;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00f23d21" />
#Memory disc: - Pamiec dysku
<widget name="label15" position="345,585" zPosition="1" size="240,40" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00ffa500" />
<widget name="progreso" position="587,600" size="552,10" borderWidth="1" zPosition="3" foregroundColor="#00ffa500" />
#Number of images installed:
<widget name="label8" position="70,324" zPosition="1" size="987,66" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00dddddd" />
<widget name="label7" position="1060,324" zPosition="1" size="85,66" font="tasat;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00ff7f50" />
#Version update:
<widget name="label13" position="675,415" zPosition="1" size="345,40" font="tasat;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
#UPDATEVERSION
<widget name="label10" position="1030,415" zPosition="1" size="100,40" font="tasat;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
#NeoBoot version:
<widget name="label14" position="532,50" zPosition="1" size="302,45" font="tasat;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="#009b9b9b" />
#PLUGINVERSION
<widget name="label9" position="847,50" zPosition="1" size="315,45" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#808080" />
#Kernel Version
<widget name="label16" position="1171,50" zPosition="1" size="114,45" font="tasat;30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="#009b9b9b" />
#KERNELVERSION
<widget name="label20" position="1302,50" zPosition="1" size="608,45" font="tasat;30" halign="left" valign="center" backgroundColor="black" transparent="1" foregroundColor="#808080" />
#hostname
<widget name="label17" position="619,164" size="213,66" font="tasat;30" halign="right" valign="center" zPosition="1" backgroundColor="black" transparent="1" foregroundColor="#00ff7f50" />
#Memory - Used: Available:
<widget name="label3" position="533,465" zPosition="1" size="612,120" font="tasat;30" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
#VIP
<widget name="label21" position="384,49" size="148,45" font="dugme;30" halign="center" valign="center" zPosition="1" backgroundColor="black" transparent="1" foregroundColor="#00ff7f50" />
</screen>
"""
# ImageChoose-HD

View File

@@ -1,10 +1,7 @@
# skin = ./neoskins/nitro_skin - mod. gutosie
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# ImageChooseFULLHD
ImageChooseFULLHD = """
<screen name="ImageChooseFULLHD" position="center,center" size="1920,1080" title=" " flags="wfBorder" backgroundColor="background" >
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/nitro/skin/background.png" position="center,0" size="1920,1080" alphatest="blend" />
@@ -20,7 +17,7 @@ ImageChooseFULLHD = """
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/nitro/skin/yellow.png" position="615,950" size="255,45" alphatest="blend" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/neoskins/nitro/skin/blue.png" position="900,950" size="255,45" alphatest="blend" />
<widget name="key_1" position="140,660" zPosition="1" size="390,45" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" />
<widget name="key_2" position="140,728" zPosition="1" size="390,45" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" />
<widget name="key_2" position="140,728" zPosition="1" size="390,45" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" />
<widget name="key_3" position="140,791" zPosition="1" size="390,45" font="Regular;30" halign="left" valign="center" backgroundColor="black" transparent="1" />
<widget name="label1" position="1194,127" size="720,48" zPosition="1" halign="left" font="Regular; 34" foregroundColor="#00FF00" backgroundColor="black" transparent="1" />
<widget name="label2" position="75,145" zPosition="1" size="652,46" font="Regular; 30" halign="left" valign="center" backgroundColor="black" transparent="1" />
@@ -30,7 +27,7 @@ ImageChooseFULLHD = """
<widget name="label6" position="628,210" zPosition="1" size="521,46" font="Regular; 30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="yellow" />
<widget name="label7" position="842,273" zPosition="1" size="308,46" font="Regular; 30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="label8" position="75,273" zPosition="1" size="666,46" font="Regular; 30" halign="left" valign="center" backgroundColor="black" transparent="1" />
<widget name="label9" position="433,77" zPosition="1" size="720,46" font="Regular; 30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
<widget name="label9" position="433,77" zPosition="1" size="720,46" font="Regular; 30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" />
<widget name="label10" position="964,336" zPosition="1" size="185,46" font="Regular; 30" halign="right" valign="center" backgroundColor="black" transparent="1" foregroundColor="green" />
<widget name="label13" position="75,336" zPosition="1" size="415,46" font="Regular; 30" halign="left" valign="center" backgroundColor="black" transparent="1" />
<widget name="label14" position="73,77" zPosition="1" size="350,46" font="Regular; 30" halign="left" valign="center" backgroundColor="black" transparent="1" />

View File

@@ -1,10 +1,8 @@
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# ____ Skin HD - ImageChoose ___mod. gutosie ___
ImageChooseHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1280, 720" backgroundColor="transpBlack">
<ePixmap position="0,0" zPosition="-1" size="1274,720" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/1frame_base-fs8.png" />

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +1,84 @@
# -*- coding: utf-8 -*-
# from __init__ import _
from Plugins.Extensions.NeoBoot.__init__ import _
from Plugins.Extensions.NeoBoot.files.stbbranding import getSupportedTuners, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxHostName, getTunerModel, getNeoLocation, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getMountPointNeo2
from Plugins.Extensions.NeoBoot.files.stbbranding import (
getSupportedTuners,
getCPUtype,
getCPUSoC,
getImageNeoBoot,
getBoxHostName,
getNeoLocation,
getMountPointNeo2,
)
from enigma import getDesktop
from enigma import eTimer
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 Screens.Console import Console
from Components.Sources.List import List
from Components.Button import Button
from Components.ActionMap import ActionMap, NumberActionMap
from Components.ActionMap import ActionMap
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.Pixmap import Pixmap
from Components.config import *
from Components.ConfigList import ConfigListScreen
from Tools.LoadPixmap import LoadPixmap
from Tools.Directories import fileExists, 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
from Tools.Directories import fileExists
import os
import time
LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
import subprocess
def run_shell_command(cmd):
"""
Modern replacement for os.system(cmd) using subprocess.run.
Returns the exit code, mimicking os.system's behavior.
"""
try:
result = subprocess.run(cmd, shell=True, check=False)
return result.returncode
except Exception as e:
print(f"[run_shell_command] Failed to run '{cmd}'. Error: {e}")
return -1 # Return a non-zero code to indicate failure
def _is_device_mounted(
device="/dev/mmcblk0p23",
mount_point="/media/InternalFlash"):
"""
Checks if the specified device is currently mounted on the given mount point.
"""
try:
with open("/proc/mounts", "r") as f:
for line in f:
parts = line.split()
if len(
parts) >= 2 and parts[0] == device and parts[1] == mount_point:
return True
return False
except FileNotFoundError:
return False
def _append_fstab_entry(device, mount_point, fstab_file="/etc/fstab"):
"""
Appends the required fstab line if it's not already present.
"""
FSTAB_LINE = f"{device}\t\t{mount_point}\t\tauto\t\tdefaults\t\t\t\t\t\t0\t0\n"
try:
with open(fstab_file, "r") as f:
if any(line.strip().startswith(device) for line in f):
print(
f"Fstab entry for {device} already exists or device is in use.")
return False
except OSError as e:
print(f"Error reading {fstab_file}: {e}")
return False
try:
with open(fstab_file, "a") as f:
f.write(FSTAB_LINE)
return True
except OSError as e:
print(f"Error writing to {fstab_file}. Check permissions. Error: {e}")
return False
LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
class StartImage(Screen):
@@ -67,141 +115,217 @@ class StartImage(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self.list = []
self['list'] = List(self.list)
self["list"] = List(self.list)
self.select()
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
'back': self.close})
self['label1'] = Label(_('Start the chosen system now ?'))
self['label2'] = Label(_('Select OK to run the image.'))
self["actions"] = ActionMap(["WizardActions", "ColorActions"], {
"ok": self.KeyOk, "back": self.close})
self["label1"] = Label(_("Start the chosen system now ?"))
self["label2"] = Label(_("Select OK to run the image."))
def select(self):
self.list = []
mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
if not fileExists(mypath + 'icons'):
mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png'
mypath = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
if not fileExists(mypath + "icons"):
mypixmap = (
"/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png"
)
png = LoadPixmap(mypixmap)
res = (_('OK Start image...'), png, 0)
res = (_("OK Start image..."), png, 0)
self.list.append(res)
self['list'].list = self.list
self["list"].list = self.list
def KeyOk(self):
if getImageNeoBoot() != 'Flash':
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
self.StartImageInNeoBoot()
else:
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
self.StartImageInNeoBoot()
image = getImageNeoBoot()
neo_location = getNeoLocation()
cmd = f"rm -rf {neo_location}ImageBoot/{image}/usr/bin/enigma2_pre_start.sh"
run_shell_command(cmd)
# ---------------------------------------------
self.StartImageInNeoBoot()
getMountPointNeo2()
system('touch /tmp/.init_reboot')
# ---------------------------------------------
run_shell_command("touch /tmp/.init_reboot")
def novalerReboot(self, result):
"""Callback to reboot after the fstab edit message."""
self.session.open(TryQuitMainloop, 2)
def StartImageInNeoBoot(self):
if getImageNeoBoot() != 'Flash':
if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())):
system('touch /tmp/.control_ok ')
else:
system('touch %sImageBoot/%s/.control_boot_new_image ' %
(getNeoLocation(), getImageNeoBoot()))
if fileExists('/.multinfo') and getCPUtype() == 'ARMv7':
os.system(' ' + LinkNeoBoot +
'/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash; sleep 1')
DEVICE = "/dev/mmcblk0p23"
MOUNT_POINT = "/media/InternalFlash"
self.sel = self['list'].getCurrent()
if getBoxHostName() == "novaler4kpro":
if not _is_device_mounted(DEVICE, MOUNT_POINT):
print(
f"Novaler4kpro: {DEVICE} not mounted on {MOUNT_POINT}. Checking fstab...")
if not os.path.isdir(MOUNT_POINT):
try:
os.mkdir(MOUNT_POINT)
print(f"Created mount point {MOUNT_POINT}")
except OSError as e:
print(f"Error creating mount point: {e}")
if _append_fstab_entry(DEVICE, MOUNT_POINT):
print("fstab file edited. rebooting your novaler4kpro")
self.session.open(
MessageBox,
_("fstab file edited. rebooting your novaler4kpro"),
MessageBox.TYPE_INFO,
5, # <--- TIMEOUT PASSED POSITIONALLY
self.novalerReboot,
)
return # Exit the function after scheduling the reboot
else:
print(
"Novaler4kpro: fstab entry already present or write failed. Proceeding."
)
if getImageNeoBoot() != "Flash":
if fileExists(
"%sImageBoot/%s/.control_ok" %
(getNeoLocation(), getImageNeoBoot())):
run_shell_command("touch /tmp/.control_ok ")
else:
run_shell_command(
"touch %sImageBoot/%s/.control_boot_new_image "
% (getNeoLocation(), getImageNeoBoot())
)
if fileExists("/.multinfo") and getCPUtype() == "ARMv7":
run_shell_command(
f"{LinkNeoBoot}/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash; sleep 1")
self.sel = self["list"].getCurrent()
if self.sel:
self.sel = self.sel[2]
if self.sel == 0:
if not fileExists('/bin/busybox.nosuid'):
os.system('ln -sf "busybox" "/bin/busybox.nosuid" ')
if fileExists('/media/InternalFlash/etc/init.d/neomountboot.sh'):
os.system(
'rm -f /media/InternalFlash/etc/init.d/neomountboot.sh;')
if fileExists('/media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh'):
os.system(
'rm -f /media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh;')
if fileExists('/media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh'):
os.system(
'rm -f /media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh;')
if fileExists('/media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh'):
os.system(
'rm -f /media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh;')
if fileExists('/media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh'):
os.system(
'rm -f /media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh;')
# else:
# pass
# _____ARM procesor____
if (getSupportedTuners()):
if getImageNeoBoot() == 'Flash':
if fileExists('/.multinfo'):
if fileExists('/media/InternalFlash/linuxrootfs1/sbin/neoinitarm'):
os.system(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs1/sbin/init"')
if fileExists('/media/InternalFlash/linuxrootfs2/sbin/neoinitarm'):
os.system(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs2/sbin/init"')
if fileExists('/media/InternalFlash/linuxrootfs3/sbin/neoinitarm'):
os.system(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs3/sbin/init"')
if fileExists('/media/InternalFlash/linuxrootfs4/sbin/neoinitarm'):
os.system(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs4/sbin/init"')
if fileExists('/media/InternalFlash/sbin/init'):
os.system(
'ln -sfn "init.sysvinit" "/media/InternalFlash/sbin/init"')
if fileExists('/media/InternalFlash'):
if not fileExists("/bin/busybox.nosuid"):
run_shell_command('ln -sf "busybox" "/bin/busybox.nosuid" ')
if fileExists("/media/InternalFlash/etc/init.d/neomountboot.sh"):
run_shell_command(
"rm -f /media/InternalFlash/etc/init.d/neomountboot.sh;"
)
if fileExists(
"/media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh"
):
run_shell_command(
"rm -f /media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh;"
)
if fileExists(
"/media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh"
):
run_shell_command(
"rm -f /media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh;"
)
if fileExists(
"/media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh"
):
run_shell_command(
"rm -f /media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh;"
)
if fileExists(
"/media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh"
):
run_shell_command(
"rm -f /media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh;"
)
if getSupportedTuners():
if getImageNeoBoot() == "Flash":
if fileExists("/.multinfo"):
if fileExists(
"/media/InternalFlash/linuxrootfs1/sbin/neoinitarm"
):
run_shell_command(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs1/sbin/init"'
)
if fileExists(
"/media/InternalFlash/linuxrootfs2/sbin/neoinitarm"
):
run_shell_command(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs2/sbin/init"'
)
if fileExists(
"/media/InternalFlash/linuxrootfs3/sbin/neoinitarm"
):
run_shell_command(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs3/sbin/init"'
)
if fileExists(
"/media/InternalFlash/linuxrootfs4/sbin/neoinitarm"
):
run_shell_command(
'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs4/sbin/init"'
)
if fileExists("/media/InternalFlash/sbin/init"):
run_shell_command(
'ln -sfn "init.sysvinit" "/media/InternalFlash/sbin/init"'
)
self.session.open(TryQuitMainloop, 2)
else:
cmd = "ln -sfn /sbin/init.sysvinit /sbin/init"
run_shell_command(cmd) # Removed unused 'rc'
self.session.open(TryQuitMainloop, 2)
elif getImageNeoBoot() != "Flash":
if fileExists("/.multinfo"):
if fileExists(
"/media/InternalFlash/linuxrootfs1/sbin/neoinitarm"
):
cmd = "cd /media/InternalFlash/linuxrootfs1; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs1/sbin/init"
run_shell_command(cmd) # Removed unused 'rc'
self.session.open(TryQuitMainloop, 2)
elif fileExists(
"/media/InternalFlash/linuxrootfs2/sbin/neoinitarm"
):
cmd = "cd /media/InternalFlash/linuxrootfs2; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs2/sbin/init"
run_shell_command(cmd) # Removed unused 'rc'
self.session.open(TryQuitMainloop, 2)
elif fileExists(
"/media/InternalFlash/linuxrootfs3/sbin/neoinitarm"
):
cmd = "cd /media/InternalFlash/linuxrootfs3; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs3/sbin/init"
run_shell_command(cmd) # Removed unused 'rc'
self.session.open(TryQuitMainloop, 2)
elif fileExists(
"/media/InternalFlash/linuxrootfs4/sbin/neoinitarm"
):
cmd = "cd /media/InternalFlash/linuxrootfs4; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs4/sbin/init"
run_shell_command(cmd) # Removed unused 'rc'
self.session.open(TryQuitMainloop, 2)
else:
self.session.open(TryQuitMainloop, 2)
elif not fileExists('/.multinfo'):
cmd = 'ln -sfn /sbin/init.sysvinit /sbin/init'
rc = os.system(cmd)
elif not fileExists("/.multinfo"):
cmd = "ln -sfn /sbin/neoinitarm /sbin/init"
run_shell_command(cmd) # Removed unused 'rc'
self.session.open(TryQuitMainloop, 2)
else:
cmd = 'ln -sfn /sbin/init.sysvinit /sbin/init'
rc = os.system(cmd)
self.session.open(TryQuitMainloop, 2)
elif getImageNeoBoot() != 'Flash':
if fileExists('/.multinfo'):
if fileExists('/media/InternalFlash/linuxrootfs1/sbin/neoinitarm'):
cmd = 'cd /media/InternalFlash/linuxrootfs1; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs1/sbin/init'
rc = os.system(cmd)
self.session.open(TryQuitMainloop, 2)
elif fileExists('/media/InternalFlash/linuxrootfs2/sbin/neoinitarm'):
cmd = 'cd /media/InternalFlash/linuxrootfs2; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs2/sbin/init'
rc = os.system(cmd)
self.session.open(TryQuitMainloop, 2)
elif fileExists('/media/InternalFlash/linuxrootfs3/sbin/neoinitarm'):
cmd = 'cd /media/InternalFlash/linuxrootfs3; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs3/sbin/init'
rc = os.system(cmd)
self.session.open(TryQuitMainloop, 2)
elif fileExists('/media/InternalFlash/linuxrootfs4/sbin/neoinitarm'):
cmd = 'cd /media/InternalFlash/linuxrootfs4; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs4/sbin/init'
rc = os.system(cmd)
self.session.open(TryQuitMainloop, 2)
else:
self.session.open(TryQuitMainloop, 2)
elif not fileExists('/.multinfo'):
cmd = 'ln -sfn /sbin/neoinitarm /sbin/init'
rc = os.system(cmd)
self.session.open(TryQuitMainloop, 2)
else:
cmd = 'ln -sfn /sbin/init.sysvinit /sbin/init'
rc = os.system(cmd)
cmd = "ln -sfn /sbin/init.sysvinit /sbin/init"
run_shell_command(cmd) # Removed unused 'rc'
self.session.open(TryQuitMainloop, 2)
else:
os.system('echo "Flash " >> ' +
getNeoLocation() + 'ImageBoot/.neonextboot')
self.messagebox = self.session.open(MessageBox, _(
'It looks like it that multiboot does not support this STB.'), MessageBox.TYPE_INFO, 8)
run_shell_command(
'echo "Flash " >> '
+ getNeoLocation()
+ "ImageBoot/.neonextboot"
)
self.messagebox = self.session.open(
MessageBox,
_("It looks like it that multiboot does not support this STB."),
MessageBox.TYPE_INFO,
8,
)
self.close()
else:
os.system('echo "Flash " >> ' + getNeoLocation() +
'ImageBoot/.neonextboot')
self.messagebox = self.session.open(MessageBox, _(
'It looks like it that multiboot does not support this STB.'), MessageBox.TYPE_INFO, 8)
run_shell_command(
'echo "Flash " >> ' +
getNeoLocation() +
"ImageBoot/.neonextboot")
self.messagebox = self.session.open(
MessageBox,
_("It looks like it that multiboot does not support this STB."),
MessageBox.TYPE_INFO,
8,
)
self.close()

View File

@@ -1,7 +1,19 @@
# -*- coding: utf-8 -*-
from Plugins.Extensions.NeoBoot.__init__ import _
from Plugins.Extensions.NeoBoot.files.stbbranding import getSupportedTuners, getNeoLocation, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getMountPointNeo2
from Plugins.Extensions.NeoBoot.files.stbbranding import (
getSupportedTuners,
getNeoLocation,
getCPUtype,
getCPUSoC,
getImageNeoBoot,
getBoxVuModel,
getBoxHostName,
getNeoMount,
getNeoMount2,
getNeoMount3,
getNeoMount4,
getNeoMount5,
getMountPointNeo2,
)
from enigma import getDesktop
from enigma import eTimer
from Screens.Screen import Screen
@@ -24,12 +36,28 @@ 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, pathExists, createDir, resolveFilename, SCOPE_PLUGINS
from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen
from Tools.Directories import (
fileExists,
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
LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
class StartImage(Screen):
@@ -66,89 +94,122 @@ class StartImage(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self.list = []
self['list'] = List(self.list)
self["list"] = List(self.list)
self.select()
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
'back': self.close})
self['label1'] = Label(_('Start the chosen system now ?'))
self['label2'] = Label(_('Select OK to run the image.'))
self["actions"] = ActionMap(["WizardActions", "ColorActions"], {
"ok": self.KeyOk, "back": self.close})
self["label1"] = Label(_("Start the chosen system now ?"))
self["label2"] = Label(_("Select OK to run the image."))
def select(self):
self.list = []
mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
if not fileExists(mypath + 'icons'):
mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png'
mypath = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
if not fileExists(mypath + "icons"):
mypixmap = (
"/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png"
)
png = LoadPixmap(mypixmap)
res = (_('OK Start image...'), png, 0)
res = (_("OK Start image..."), png, 0)
self.list.append(res)
self['list'].list = self.list
self["list"].list = self.list
def KeyOk(self):
if getImageNeoBoot() != 'Flash':
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
if getImageNeoBoot() != "Flash":
os.system(
"rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh"
% (getNeoLocation(), getImageNeoBoot())
)
self.StartImageInNeoBoot()
else:
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
os.system(
"rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh"
% (getNeoLocation(), getImageNeoBoot())
)
self.StartImageInNeoBoot()
# ---------------------------------------------
getMountPointNeo2()
system('touch /tmp/.init_reboot')
# ---------------------------------------------
system("touch /tmp/.init_reboot")
def StartImageInNeoBoot(self):
if getImageNeoBoot() != 'Flash':
if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())):
system('touch /tmp/.control_ok ')
if getImageNeoBoot() != "Flash":
if fileExists(
"%sImageBoot/%s/.control_ok" %
(getNeoLocation(), getImageNeoBoot())):
system("touch /tmp/.control_ok ")
else:
system('touch %sImageBoot/%s/.control_boot_new_image ' %
(getNeoLocation(), getImageNeoBoot()))
system(
"touch %sImageBoot/%s/.control_boot_new_image "
% (getNeoLocation(), getImageNeoBoot())
)
# system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh')
self.sel = self['list'].getCurrent()
self.sel = self["list"].getCurrent()
if self.sel:
self.sel = self.sel[2]
if self.sel == 0:
if fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'):
if fileExists("/media/InternalFlash/etc/init.d/neobootmount.sh"):
os.system(
'rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;')
if (getSupportedTuners()):
if getImageNeoBoot() == 'Flash':
cmd = 'ln -sfn /sbin/init.sysvinit /sbin/init'
"rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;")
if getSupportedTuners():
if getImageNeoBoot() == "Flash":
cmd = "ln -sfn /sbin/init.sysvinit /sbin/init"
rc = os.system(cmd)
getTurnOffOnSystem()
elif getImageNeoBoot() != 'Flash':
if fileExists('/.multinfo'):
elif getImageNeoBoot() != "Flash":
if fileExists("/.multinfo"):
getTurnOffOnSystem()
elif not fileExists('/.multinfo'):
cmd = 'ln -sfn /sbin/neoinitmips /sbin/init'
elif not fileExists("/.multinfo"):
cmd = "ln -sfn /sbin/neoinitmips /sbin/init"
rc = os.system(cmd)
getTurnOffOnSystem()
else:
os.system('echo "Flash " >> ' +
getNeoLocation() + 'ImageBoot/.neonextboot')
os.system(
'echo "Flash " >> '
+ getNeoLocation()
+ "ImageBoot/.neonextboot"
)
getTurnOffOnSystem()
else:
os.system('echo "Flash " >> ' +
getNeoLocation() + 'ImageBoot/.neonextboot')
self.messagebox = self.session.open(MessageBox, _(
'It looks like it that multiboot does not support this STB.'), MessageBox.TYPE_INFO, 8)
os.system(
'echo "Flash " >> '
+ getNeoLocation()
+ "ImageBoot/.neonextboot"
)
self.messagebox = self.session.open(
MessageBox,
_("It looks like it that multiboot does not support this STB."),
MessageBox.TYPE_INFO,
8,
)
self.close()
else:
os.system('echo "Flash " >> ' + getNeoLocation() +
'ImageBoot/.neonextboot')
self.messagebox = self.session.open(MessageBox, _(
'It looks like it that multiboot does not support this STB.'), MessageBox.TYPE_INFO, 8)
os.system(
'echo "Flash " >> ' +
getNeoLocation() +
"ImageBoot/.neonextboot")
self.messagebox = self.session.open(
MessageBox,
_("It looks like it that multiboot does not support this STB."),
MessageBox.TYPE_INFO,
8,
)
self.close()
def getTurnOffOnSystem():
for line in open("/etc/hostname"):
if "dm500hd" in line or "dm800se" in line or "dm800" in line or "dm800se" in line or "dm8000" in line:
if fileExists('%sImageBoot/%s/squashfs-images' % (getNeoLocation(), getImageNeoBoot())):
os.system('ln -sf "%sImageBoot/%s/squashfs-images" "//squashfs-images"' %
(getNeoLocation(), getImageNeoBoot()))
if (
"dm500hd" in line
or "dm800se" in line
or "dm800" in line
or "dm800se" in line
or "dm8000" in line
):
if fileExists(
"%sImageBoot/%s/squashfs-images" %
(getNeoLocation(), getImageNeoBoot())):
os.system(
'ln -sf "%sImageBoot/%s/squashfs-images" "//squashfs-images"' %
(getNeoLocation(), getImageNeoBoot()))
os.system(
'echo 3 > /proc/sys/vm/drop_caches; shutdown now -r; reboot -f -d -h -i')
"echo 3 > /proc/sys/vm/drop_caches; shutdown now -r; reboot -f -d -h -i"
)

View File

@@ -1,9 +1,18 @@
# -*- coding: utf-8 -*-
# from __init__ import _
from Plugins.Extensions.NeoBoot.__init__ import _
# from __future__ import print_function
from Plugins.Extensions.NeoBoot.files.stbbranding import getNeoLocation, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getMountPointNeo2
from Plugins.Extensions.NeoBoot.files.stbbranding import (
getNeoLocation,
getCPUtype,
getCPUSoC,
getImageNeoBoot,
getBoxVuModel,
getBoxHostName,
getNeoMount,
getNeoMount2,
getNeoMount3,
getNeoMount4,
getNeoMount5,
getMountPointNeo2,
)
from enigma import getDesktop
from enigma import eTimer
from Screens.Screen import Screen
@@ -26,22 +35,46 @@ 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, pathExists, createDir, resolveFilename, SCOPE_PLUGINS
from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen
from Tools.Directories import (
fileExists,
pathExists,
createDir,
resolveFilename,
SCOPE_PLUGINS,
)
import subprocess
from os import listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove
from os.path import dirname, isdir, isdir as os_isdir
import os
import time
LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
def getMmcBlockDevice():
mmcblockdevice = 'UNKNOWN'
if getBoxHostName() == 'vuultimo4k' or getBoxHostName() == 'vusolo4k' or getBoxHostName() == 'vuuno4kse' or getBoxHostName() == 'vuuno4k' and getBoxHostName() != "ustym4kpro":
mmcblockdevice = 'mmcblk0p1'
elif getBoxHostName() == 'vuzero4k' and getBoxVuModel() == 'zero4k' and getCPUSoC() == '72604' and getBoxHostName() != "ustym4kpro":
mmcblockdevice = 'mmcblk0p4'
elif getBoxHostName() == 'vuduo4k' or getBoxHostName() == 'vuduo4kse' and getBoxHostName() != "vuultimo4k" and getBoxHostName() != "ustym4kpro":
mmcblockdevice = 'mmcblk0p6'
mmcblockdevice = "UNKNOWN"
if (
getBoxHostName() == "vuultimo4k"
or getBoxHostName() == "vusolo4k"
or getBoxHostName() == "vuuno4kse"
or getBoxHostName() == "vuuno4k"
and getBoxHostName() != "ustym4kpro"
):
mmcblockdevice = "mmcblk0p1"
elif (
getBoxHostName() == "vuzero4k"
and getBoxVuModel() == "zero4k"
and getCPUSoC() == "72604"
and getBoxHostName() != "ustym4kpro"
):
mmcblockdevice = "mmcblk0p4"
elif (
getBoxHostName() == "vuduo4k"
or getBoxHostName() == "vuduo4kse"
and getBoxHostName() != "vuultimo4k"
and getBoxHostName() != "ustym4kpro"
):
mmcblockdevice = "mmcblk0p6"
return mmcblockdevice
@@ -79,158 +112,358 @@ class StartImage(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self.list = []
self['list'] = List(self.list)
self["list"] = List(self.list)
self.select()
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
'back': self.close})
self['label1'] = Label(_('Start the chosen system now ?'))
self['label2'] = Label(_('Select OK to run the image.'))
self["actions"] = ActionMap(["WizardActions", "ColorActions"], {
"ok": self.KeyOk, "back": self.close})
self["label1"] = Label(_("Start the chosen system now ?"))
self["label2"] = Label(_("Select OK to run the image."))
def select(self):
self.list = []
mypath = '' + LinkNeoBoot + ''
if not fileExists(mypath + 'icons'):
mypixmap = '' + LinkNeoBoot + '/images/ok.png'
mypath = "" + LinkNeoBoot + ""
if not fileExists(mypath + "icons"):
mypixmap = "" + LinkNeoBoot + "/images/ok.png"
png = LoadPixmap(mypixmap)
res = (_('OK Start image...'), png, 0)
res = (_("OK Start image..."), png, 0)
self.list.append(res)
self['list'].list = self.list
self["list"].list = self.list
def KeyOk(self):
if getImageNeoBoot() != "Flash":
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
subprocess.run(
"rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh"
% (getNeoLocation(), getImageNeoBoot()),
shell=True,
)
self.StartImageInNeoBoot()
else:
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
subprocess.run(
"rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh"
% (getNeoLocation(), getImageNeoBoot()),
shell=True,
)
self.StartImageInNeoBoot()
# ---------------------------------------------
getMountPointNeo2()
system('touch /tmp/.init_reboot')
# ---------------------------------------------
subprocess.run("touch /tmp/.init_reboot", shell=True)
def StartImageInNeoBoot(self):
if getImageNeoBoot() != "Flash":
if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())):
system('touch /tmp/.control_ok ')
if fileExists(
"%sImageBoot/%s/.control_ok" %
(getNeoLocation(), getImageNeoBoot())):
subprocess.run("touch /tmp/.control_ok ", shell=True)
else:
system('touch %sImageBoot/%s/.control_boot_new_image ' %
(getNeoLocation(), getImageNeoBoot()))
subprocess.run(
"touch %sImageBoot/%s/.control_boot_new_image "
% (getNeoLocation(), getImageNeoBoot()),
shell=True,
)
if fileExists('/.multinfo') and getCPUtype() == "ARMv7":
if getBoxVuModel() == "uno4kse" or getBoxVuModel() == "uno4k" or getBoxVuModel() == "ultimo4k" or getBoxVuModel() == "solo4k":
os.system(
'mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash')
elif getBoxVuModel() == 'duo4kse' or getBoxVuModel() == 'duo4k':
os.system(
'mkdir -p /media/InternalFlash; mount /dev/mmcblk0p9 /media/InternalFlash')
elif getBoxVuModel() == 'zero4k':
os.system(
'mkdir -p /media/InternalFlash; mount /dev/mmcblk0p7 /media/InternalFlash')
if fileExists("/.multinfo") and getCPUtype() == "ARMv7":
if (
getBoxVuModel() == "uno4kse"
or getBoxVuModel() == "uno4k"
or getBoxVuModel() == "ultimo4k"
or getBoxVuModel() == "solo4k"
):
subprocess.run(
"mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash",
shell=True,
)
elif getBoxVuModel() == "duo4kse" or getBoxVuModel() == "duo4k":
subprocess.run(
"mkdir -p /media/InternalFlash; mount /dev/mmcblk0p9 /media/InternalFlash",
shell=True,
)
elif getBoxVuModel() == "zero4k":
subprocess.run(
"mkdir -p /media/InternalFlash; mount /dev/mmcblk0p7 /media/InternalFlash",
shell=True,
)
else:
os.system(
' ' + LinkNeoBoot + '/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash')
# elif fileExists('/boot/STARTUP') and getCPUtype() == "ARMv7":
# os.system('ln -sf "neoinitarmvu" "/boot/sbin/init"')
subprocess.run(
" " +
LinkNeoBoot +
"/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash",
shell=True,
)
self.sel = self['list'].getCurrent()
self.sel = self["list"].getCurrent()
if self.sel:
self.sel = self.sel[2]
if self.sel == 0:
if fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'):
os.system(
'rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;')
if not fileExists('/bin/busybox.nosuid'):
os.system('ln -sf "busybox" "/bin/busybox.nosuid" ')
if fileExists("/media/InternalFlash/etc/init.d/neobootmount.sh"):
subprocess.run(
"rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;",
shell=True)
if not fileExists("/bin/busybox.nosuid"):
subprocess.run(
'ln -sf "busybox" "/bin/busybox.nosuid" ',
shell=True)
# VUPLUS Arm mmc block device
if getCPUtype() == "ARMv7" and "vu" + getBoxVuModel() == getBoxHostName():
if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())):
mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') %
(getNeoLocation(), getBoxHostName()))
if not fileExists(
"%sImagesUpload/.kernel/flash-kernel-%s.bin"
% (getNeoLocation(), getBoxHostName())
):
mess = _(
"Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin"
) % (getNeoLocation(), getBoxHostName())
self.session.open(MessageBox, mess, MessageBox.TYPE_INFO)
else:
if getImageNeoBoot() == "Flash":
if fileExists("/.multinfo"):
cmd = "echo -e '\n\n%s '" % _(
'...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
"...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = 'cd /media/InternalFlash; ln -sf "init.sysvinit" "/media/InternalFlash/sbin/init"'
# Vu+ Real Multiboot
if fileExists('/media/InternalFlash/STARTUP') and fileExists('/media/InternalFlash/zImage'):
cmd2 = 'dd if=/media/InternalFlash/zImage of=/dev/' + getMmcBlockDevice() + ''
if fileExists(
"/media/InternalFlash/STARTUP"
) and fileExists("/media/InternalFlash/zImage"):
cmd2 = (
"dd if=/media/InternalFlash/zImage of=/dev/" +
getMmcBlockDevice() +
"")
else:
cmd2 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + \
getBoxHostName() + '.bin of=/dev/' + getMmcBlockDevice() + ''
# cmd2 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + getBoxHostName() + '.bin of=/dev/' + getMmcBlockDevice() + ''
cmd3 = "echo -e '\n%s '" % _('Start image FLASH - kernel flash !\nSTB NAME: ' + getBoxHostName() + '\nMODEL: ' + getBoxVuModel() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------')
cmd4 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; cat /dev/' + getMmcBlockDevice() + ' | grep "kernel"; echo "Used Kernel: " ' + \
getImageNeoBoot() + ' > ' + getNeoLocation() + \
'ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f'
cmd2 = (
"dd if="
+ getNeoLocation()
+ "ImagesUpload/.kernel/flash-kernel-"
+ getBoxHostName()
+ ".bin of=/dev/"
+ getMmcBlockDevice()
+ ""
)
cmd3 = "echo -e '\n%s '" % _(
"Start image FLASH - kernel flash !\nSTB NAME: "
+ getBoxHostName()
+ "\nMODEL: "
+ getBoxVuModel()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------"
)
cmd4 = (
"update-alternatives --remove vmlinux vmlinux-`uname -r` || true; cat /dev/" +
getMmcBlockDevice() +
' | grep "kernel"; echo "Used Kernel: " ' +
getImageNeoBoot() +
" > " +
getNeoLocation() +
"ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f")
elif not fileExists("/.multinfo"):
cmd = "echo -e '\n\n%s '" % _(
'...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
"...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = 'sleep 5; ln -sf "init.sysvinit" "/sbin/init"'
cmd2 = 'echo "Used Kernel: " ' + getImageNeoBoot() + ' > ' + getNeoLocation() + \
'ImagesUpload/.kernel/used_flash_kernel'
cmd3 = "echo -e '\n%s '" % _('Start image FLASH - kernel flash !\nSTB NAME: ' + getBoxHostName() + '\nMODEL: ' + getBoxVuModel() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------')
cmd4 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sleep 8; reboot -d -f'
cmd2 = (
'echo "Used Kernel: " '
+ getImageNeoBoot()
+ " > "
+ getNeoLocation()
+ "ImagesUpload/.kernel/used_flash_kernel"
)
cmd3 = "echo -e '\n%s '" % _(
"Start image FLASH - kernel flash !\nSTB NAME: "
+ getBoxHostName()
+ "\nMODEL: "
+ getBoxVuModel()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------"
)
cmd4 = "update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sleep 8; reboot -d -f"
elif getImageNeoBoot() != "Flash":
if not fileExists("/.multinfo"):
if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
if not fileExists(
"%sImageBoot/%s/boot/zImage.%s"
% (
getNeoLocation(),
getImageNeoBoot(),
getBoxHostName(),
)
):
cmd = "echo -e '\n\n%s '" % _(
'...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'sleep 5; ln -sfn /sbin/neoinitarm /sbin/init'
cmd2 = 'echo "Used Kernel: " ' + getImageNeoBoot() + ' > ' + getNeoLocation() + \
'ImagesUpload/.kernel/used_flash_kernel'
cmd3 = "echo -e '\n%s '" % _('Reboot system E2 now !\nSTB NAME: ' + getBoxHostName() + '\nMODEL: ' + getBoxVuModel() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will REBOOT in 5 seconds !____\n\n ------------ N E O B O O T ------------')
cmd4 = 'sleep 8; reboot -d -f '
elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
"...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = "sleep 5; ln -sfn /sbin/neoinitarm /sbin/init"
cmd2 = (
'echo "Used Kernel: " '
+ getImageNeoBoot()
+ " > "
+ getNeoLocation()
+ "ImagesUpload/.kernel/used_flash_kernel"
)
cmd3 = "echo -e '\n%s '" % _(
"Reboot system E2 now !\nSTB NAME: "
+ getBoxHostName()
+ "\nMODEL: "
+ getBoxVuModel()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUtype()
+ " "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will REBOOT in 5 seconds !____\n\n ------------ N E O B O O T ------------"
)
cmd4 = "sleep 8; reboot -d -f "
elif fileExists(
"%sImageBoot/%s/boot/zImage.%s"
% (
getNeoLocation(),
getImageNeoBoot(),
getBoxHostName(),
)
):
cmd = "echo -e '\n\n%s '" % _(
'...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'ln -sfn /sbin/neoinitarmvu /sbin/init'
cmd2 = 'dd if=' + getNeoLocation() + 'ImageBoot/' + getImageNeoBoot() + \
'/boot/zImage.' + getBoxHostName() + ' of=/dev/' + getMmcBlockDevice() + ''
cmd3 = "echo -e '\n%s '" % _('Changed kernel COMPLETE !\nSTB NAME: ' + getBoxHostName() + '\nMODEL: ' + getBoxVuModel() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUtype() + ' ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------')
cmd4 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; echo "Used Kernel: " ' + \
getImageNeoBoot() + ' > ' + getNeoLocation() + \
'ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f'
"...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = "ln -sfn /sbin/neoinitarmvu /sbin/init"
cmd2 = (
"dd if="
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/boot/zImage."
+ getBoxHostName()
+ " of=/dev/"
+ getMmcBlockDevice()
+ ""
)
cmd3 = "echo -e '\n%s '" % _(
"Changed kernel COMPLETE !\nSTB NAME: "
+ getBoxHostName()
+ "\nMODEL: "
+ getBoxVuModel()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUtype()
+ " "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------"
)
cmd4 = (
'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; echo "Used Kernel: " ' +
getImageNeoBoot() +
" > " +
getNeoLocation() +
"ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f")
elif fileExists("/.multinfo"):
if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
if not fileExists(
"%sImageBoot/%s/boot/zImage.%s"
% (
getNeoLocation(),
getImageNeoBoot(),
getBoxHostName(),
)
):
cmd = "echo -e '\n\n%s '" % _(
'...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + \
getBoxHostName() + '.bin of=/dev/' + getMmcBlockDevice() + ''
"...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = (
"dd if="
+ getNeoLocation()
+ "ImagesUpload/.kernel/flash-kernel-"
+ getBoxHostName()
+ ".bin of=/dev/"
+ getMmcBlockDevice()
+ ""
)
cmd2 = 'cd /media/InternalFlash; ln -sf "neoinitarm" "/media/InternalFlash/sbin/init"'
cmd3 = "echo -e '\n%s '" % _('Start image without changing the kernel!\nSTB NAME: ' + getBoxHostName() + '\nMODEL: ' + getBoxVuModel() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------')
cmd4 = 'echo "Used Kernel: " ' + getImageNeoBoot() + ' > ' + getNeoLocation() + \
'ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f'
elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
cmd3 = "echo -e '\n%s '" % _(
"Start image without changing the kernel!\nSTB NAME: "
+ getBoxHostName()
+ "\nMODEL: "
+ getBoxVuModel()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------"
)
cmd4 = (
'echo "Used Kernel: " ' +
getImageNeoBoot() +
" > " +
getNeoLocation() +
"ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f")
elif fileExists(
"%sImageBoot/%s/boot/zImage.%s"
% (
getNeoLocation(),
getImageNeoBoot(),
getBoxHostName(),
)
):
cmd = "echo -e '\n\n%s '" % _(
'...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
"...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = 'cd /media/InternalFlash; ln -sf "neoinitarmvu" "/media/InternalFlash/sbin/init"'
cmd2 = 'dd if=' + getNeoLocation() + 'ImageBoot/' + getImageNeoBoot() + \
'/boot/zImage.' + getBoxHostName() + ' of=/dev/' + getMmcBlockDevice() + ''
cmd3 = "echo -e '\n%s '" % _('Changed kernel COMPLETE !\nSTB NAME: ' + getBoxHostName() + '\nMODEL: ' + getBoxVuModel() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____ \n\n ------------ N E O B O O T ------------')
cmd4 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; echo "Used Kernel: " ' + \
getImageNeoBoot() + ' > ' + getNeoLocation() + \
'ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f'
cmd2 = (
"dd if="
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/boot/zImage."
+ getBoxHostName()
+ " of=/dev/"
+ getMmcBlockDevice()
+ ""
)
cmd3 = "echo -e '\n%s '" % _(
"Changed kernel COMPLETE !\nSTB NAME: "
+ getBoxHostName()
+ "\nMODEL: "
+ getBoxVuModel()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____ \n\n ------------ N E O B O O T ------------"
)
cmd4 = (
'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; echo "Used Kernel: " ' +
getImageNeoBoot() +
" > " +
getNeoLocation() +
"ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f")
self.session.open(Console, _(
'NeoBoot ARM VU+....'), [cmd, cmd1, cmd2, cmd3, cmd4])
"NeoBoot ARM VU+...."), [cmd, cmd1, cmd2, cmd3, cmd4])
self.close()
else:
os.system('echo "Flash " >> ' + getNeoLocation() +
'ImageBoot/.neonextboot')
self.messagebox = self.session.open(MessageBox, _(
'It looks like it that multiboot does not support this STB.'), MessageBox.TYPE_INFO, 8)
subprocess.run(
'echo "Flash " >> ' +
getNeoLocation() +
"ImageBoot/.neonextboot",
shell=True,
)
self.messagebox = self.session.open(
MessageBox,
_("It looks like it that multiboot does not support this STB."),
MessageBox.TYPE_INFO,
8,
)
self.close()
def myclose2(self, message):

View File

@@ -1,7 +1,21 @@
# -*- coding: utf-8 -*-
from Plugins.Extensions.NeoBoot.__init__ import _
from Plugins.Extensions.NeoBoot.files.stbbranding import getNeoLocation, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getMountPointNeo2, getNandWrite, getExtCheckHddUsb, getImageBootNow
from Plugins.Extensions.NeoBoot.files.stbbranding import (
getNeoLocation,
getCPUtype,
getCPUSoC,
getImageNeoBoot,
getBoxVuModel,
getBoxHostName,
getNeoMount,
getNeoMount2,
getNeoMount3,
getNeoMount4,
getNeoMount5,
getMountPointNeo2,
getNandWrite,
getExtCheckHddUsb,
getImageBootNow,
)
from enigma import getDesktop
from enigma import eTimer
from Screens.Screen import Screen
@@ -24,23 +38,65 @@ 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, pathExists, createDir, resolveFilename, SCOPE_PLUGINS
from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen
from Tools.Directories import (
fileExists,
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
LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
def getMmcBlockDevice():
if getBoxHostName() == 'vuultimo' or getBoxHostName() == 'bm750' or getBoxHostName() == 'vuduo' or getBoxHostName() == 'vuuno' or getBoxHostName() == 'vusolo' or getBoxHostName() == 'vuduo':
mmcblockdevice = 'mtd1'
if fileExists('' + getNeoLocation() + 'ImageBoot/' + getImageNeoBoot() + '/etc/vtiversion.info') and getExtCheckHddUsb() == 'ext4':
if fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
os.system('rm -r %sImageBoot/%s/boot/%s.vmlinux.gz' %
(getNeoLocation(), getImageNeoBoot(), getBoxHostName()))
elif getBoxHostName() == 'vusolo2' or getBoxHostName() == 'vusolose' or getBoxHostName() == 'vuduo2' or getBoxHostName() == 'vuzero':
mmcblockdevice = 'mtd2'
if (
getBoxHostName() == "vuultimo"
or getBoxHostName() == "bm750"
or getBoxHostName() == "vuduo"
or getBoxHostName() == "vuuno"
or getBoxHostName() == "vusolo"
or getBoxHostName() == "vuduo"
):
mmcblockdevice = "mtd1"
if (
fileExists(
""
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/etc/vtiversion.info"
)
and getExtCheckHddUsb() == "ext4"
):
if fileExists(
"%sImageBoot/%s/boot/%s.vmlinux.gz"
% (getNeoLocation(), getImageNeoBoot(), getBoxHostName())
):
os.system(
"rm -r %sImageBoot/%s/boot/%s.vmlinux.gz"
% (getNeoLocation(), getImageNeoBoot(), getBoxHostName())
)
elif (
getBoxHostName() == "vusolo2"
or getBoxHostName() == "vusolose"
or getBoxHostName() == "vuduo2"
or getBoxHostName() == "vuzero"
):
mmcblockdevice = "mtd2"
return mmcblockdevice
@@ -78,170 +134,386 @@ class StartImage(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self.list = []
self['list'] = List(self.list)
self["list"] = List(self.list)
self.select()
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
'back': self.close})
self['label1'] = Label(_('Start the chosen system now ?'))
self['label2'] = Label(_('Select OK to run the image.'))
self["actions"] = ActionMap(["WizardActions", "ColorActions"], {
"ok": self.KeyOk, "back": self.close})
self["label1"] = Label(_("Start the chosen system now ?"))
self["label2"] = Label(_("Select OK to run the image."))
def select(self):
self.list = []
mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
if not fileExists(mypath + 'icons'):
mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png'
mypath = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
if not fileExists(mypath + "icons"):
mypixmap = (
"/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png"
)
png = LoadPixmap(mypixmap)
res = (_('OK Start image...'), png, 0)
res = (_("OK Start image..."), png, 0)
self.list.append(res)
self['list'].list = self.list
self["list"].list = self.list
def KeyOk(self):
if getImageNeoBoot() != 'Flash':
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
if getImageNeoBoot() != "Flash":
os.system(
"rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh"
% (getNeoLocation(), getImageNeoBoot())
)
self.StartImageInNeoBoot()
else:
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
(getNeoLocation(), getImageNeoBoot()))
os.system(
"rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh"
% (getNeoLocation(), getImageNeoBoot())
)
self.StartImageInNeoBoot()
if getNandWrite() == 'nandwrite':
if getNandWrite() == "nandwrite":
os.system('echo "nandwrite" > /tmp/check_nandwrite')
# ---------------------------------------------
getMountPointNeo2()
system('touch /tmp/.init_reboot')
# ---------------------------------------------
system("touch /tmp/.init_reboot")
def StartImageInNeoBoot(self):
if getImageNeoBoot() != 'Flash':
if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())):
system('touch /tmp/.control_ok ')
if getImageNeoBoot() != "Flash":
if fileExists(
"%sImageBoot/%s/.control_ok" %
(getNeoLocation(), getImageNeoBoot())):
system("touch /tmp/.control_ok ")
else:
system('touch %sImageBoot/%s/.control_boot_new_image ' %
(getNeoLocation(), getImageNeoBoot()))
system(
"touch %sImageBoot/%s/.control_boot_new_image "
% (getNeoLocation(), getImageNeoBoot())
)
system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/*')
system("chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/*")
self.sel = self['list'].getCurrent()
self.sel = self["list"].getCurrent()
if self.sel:
self.sel = self.sel[2]
if self.sel == 0:
if fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'):
if fileExists("/media/InternalFlash/etc/init.d/neobootmount.sh"):
os.system(
'rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;')
if not fileExists('/bin/busybox.nosuid'):
"rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;")
if not fileExists("/bin/busybox.nosuid"):
os.system('ln -sf "busybox" "/bin/busybox.nosuid" ')
################# _____mips___##########################
# VUPLUS MIPS vu_dev_mtd1.sh
if "vu" + getBoxVuModel() == getBoxHostName():
getMmcBlockDevice()
if not fileExists('%sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName())):
if not fileExists(
"%sImagesUpload/.kernel/%s.vmlinux.gz"
% (getNeoLocation(), getBoxHostName())
):
self.myclose2(
_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash kernel vmlinux.gz ' % getNeoLocation()))
_(
"Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash kernel vmlinux.gz " %
getNeoLocation()))
else:
if getImageNeoBoot() == 'Flash':
if fileExists('/.multinfo'):
if getImageNeoBoot() == "Flash":
if fileExists("/.multinfo"):
cmd = "echo -e '\n%s '" % _(
'...............NeoBoot REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'flash_erase /dev/' + getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1 ; flash_eraseall /dev/' + \
getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1'
if getNandWrite() == 'nandwrite':
cmd2 = 'nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + \
'ImagesUpload/.kernel/' + getBoxHostName() + '.vmlinux.gz > /dev/null 2>&1'
"...............NeoBoot REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = (
"flash_erase /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1 ; flash_eraseall /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1")
if getNandWrite() == "nandwrite":
cmd2 = (
"nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImagesUpload/.kernel/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
else:
cmd2 = '' + LinkNeoBoot + '/bin/nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + \
'ImagesUpload/.kernel/' + getBoxHostName() + '.vmlinux.gz > /dev/null 2>&1'
cmd3 = "echo -e '\n%s '" % _('Start image FLASH - kernel flash !\n' + getNandWrite() + '\nSTB NAME: ' + getBoxHostName() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____ ')
cmd4 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f'
cmd2 = (
""
+ LinkNeoBoot
+ "/bin/nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImagesUpload/.kernel/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
cmd3 = "echo -e '\n%s '" % _(
"Start image FLASH - kernel flash !\n"
+ getNandWrite()
+ "\nSTB NAME: "
+ getBoxHostName()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____ "
)
cmd4 = "update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f"
elif not fileExists('/.multinfo'):
elif not fileExists("/.multinfo"):
cmd = "echo -e '\n%s '" % _(
'...............NEOBOOT >> Reboot...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'ln -sfn /sbin/init.sysvinit /sbin/init'
cmd2 = 'sync'
cmd3 = "echo -e '\n%s '" % _('Start image flash !\nSTB NAME: ' + getBoxHostName() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____ ')
cmd4 = 'sleep 8; reboot -d -f'
"...............NEOBOOT >> Reboot...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = "ln -sfn /sbin/init.sysvinit /sbin/init"
cmd2 = "sync"
cmd3 = "echo -e '\n%s '" % _(
"Start image flash !\nSTB NAME: "
+ getBoxHostName()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____ "
)
cmd4 = "sleep 8; reboot -d -f"
elif getImageNeoBoot() != 'Flash':
if fileExists('/.multinfo') and getImageNeoBoot() == getImageBootNow():
elif getImageNeoBoot() != "Flash":
if (
fileExists("/.multinfo")
and getImageNeoBoot() == getImageBootNow()
):
cmd = "echo -e '\n%s '" % _(
'...............NEOBOOT > REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'ln -sfn /sbin/init.sysvinit /sbin/init'
cmd2 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true'
cmd3 = "echo -e '\n%s '" % _('Reboot system E2 now !\nSTB NAME: ' + getBoxHostName() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will REBOOT in 5 seconds !____ ')
cmd4 = 'sync; sleep 8; reboot -d -f '
"...............NEOBOOT > REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = "ln -sfn /sbin/init.sysvinit /sbin/init"
cmd2 = "update-alternatives --remove vmlinux vmlinux-`uname -r` || true"
cmd3 = "echo -e '\n%s '" % _(
"Reboot system E2 now !\nSTB NAME: "
+ getBoxHostName()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will REBOOT in 5 seconds !____ "
)
cmd4 = "sync; sleep 8; reboot -d -f "
elif not fileExists('/.multinfo'):
if fileExists('' + getNeoLocation() + 'ImageBoot/' + getImageNeoBoot() + '/boot/' + getBoxHostName() + '.vmlinux.gz'):
elif not fileExists("/.multinfo"):
if fileExists(
""
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/boot/"
+ getBoxHostName()
+ ".vmlinux.gz"
):
cmd = "echo -e '\n%s '" % _(
'...............NEOBOOT-REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'flash_erase /dev/' + getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1; flash_eraseall /dev/' + \
getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1'
if getNandWrite() == 'nandwrite':
cmd2 = 'nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + 'ImageBoot/' + \
getImageNeoBoot() + '/boot/' + getBoxHostName() + '.vmlinux.gz > /dev/null 2>&1'
"...............NEOBOOT-REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = (
"flash_erase /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1; flash_eraseall /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1")
if getNandWrite() == "nandwrite":
cmd2 = (
"nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/boot/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
else:
cmd2 = '' + LinkNeoBoot + '/bin/nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + \
'ImageBoot/' + getImageNeoBoot() + '/boot/' + getBoxHostName() + \
'.vmlinux.gz > /dev/null 2>&1'
cmd3 = "echo -e '\n%s '" % _('Changed kernel COMPLETE ! ' + getNandWrite() + '\nSTB NAME: ' + getBoxHostName() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUtype() + ' ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____ ')
cmd4 = 'ln -sfn /sbin/neoinitmipsvu /sbin/init; update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f'
cmd2 = (
""
+ LinkNeoBoot
+ "/bin/nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/boot/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
cmd3 = "echo -e '\n%s '" % _(
"Changed kernel COMPLETE ! "
+ getNandWrite()
+ "\nSTB NAME: "
+ getBoxHostName()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUtype()
+ " "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____ "
)
cmd4 = "ln -sfn /sbin/neoinitmipsvu /sbin/init; update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f"
elif not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
elif not fileExists(
"%sImageBoot/%s/boot/%s.vmlinux.gz"
% (
getNeoLocation(),
getImageNeoBoot(),
getBoxHostName(),
)
):
cmd = "echo -e '\n%s '" % _(
'...............NEOBOOT > REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'ln -sfn /sbin/neoinitmipsvu /sbin/init'
cmd2 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true'
cmd3 = "echo -e '\n%s '" % _('Start image without changing the kernel!\nSTB NAME: ' + getBoxHostName() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____ ')
cmd4 = 'sync; sleep 8; reboot -d -f'
"...............NEOBOOT > REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = "ln -sfn /sbin/neoinitmipsvu /sbin/init"
cmd2 = "update-alternatives --remove vmlinux vmlinux-`uname -r` || true"
cmd3 = "echo -e '\n%s '" % _(
"Start image without changing the kernel!\nSTB NAME: "
+ getBoxHostName()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____ "
)
cmd4 = "sync; sleep 8; reboot -d -f"
elif fileExists('/.multinfo'):
if not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
elif fileExists("/.multinfo"):
if not fileExists(
"%sImageBoot/%s/boot/%s.vmlinux.gz"
% (
getNeoLocation(),
getImageNeoBoot(),
getBoxHostName(),
)
):
cmd = "echo -e '\n%s '" % _(
'...............NeoBoot REBOOT...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'flash_erase /dev/' + getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1 ; flash_eraseall /dev/' + \
getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1'
if getNandWrite() == 'nandwrite':
cmd2 = 'nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + \
'ImagesUpload/.kernel/' + getBoxHostName() + '.vmlinux.gz > /dev/null 2>&1'
"...............NeoBoot REBOOT...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = (
"flash_erase /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1 ; flash_eraseall /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1")
if getNandWrite() == "nandwrite":
cmd2 = (
"nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImagesUpload/.kernel/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
else:
cmd2 = '' + LinkNeoBoot + '/bin/nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + \
'ImagesUpload/.kernel/' + getBoxHostName() + '.vmlinux.gz > /dev/null 2>&1'
cmd3 = "echo -e '\n%s '" % _('Changed kernel COMPLETE ! ' + getNandWrite() + '\nSTB NAME: ' + getBoxHostName() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____ ')
cmd4 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f'
cmd2 = (
""
+ LinkNeoBoot
+ "/bin/nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImagesUpload/.kernel/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
cmd3 = "echo -e '\n%s '" % _(
"Changed kernel COMPLETE ! "
+ getNandWrite()
+ "\nSTB NAME: "
+ getBoxHostName()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____ "
)
cmd4 = "update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f"
elif fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())):
elif fileExists(
"%sImageBoot/%s/boot/%s.vmlinux.gz"
% (
getNeoLocation(),
getImageNeoBoot(),
getBoxHostName(),
)
):
cmd = "echo -e '\n%s '" % _(
'...............REBOOT now...............\nPlease wait, in a moment the decoder will be restarted...')
cmd1 = 'flash_erase /dev/' + getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1 ; flash_eraseall /dev/' + \
getMmcBlockDevice() + ' 0 0 > /dev/null 2>&1 '
if getNandWrite() == 'nandwrite':
cmd2 = 'nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + 'ImageBoot/' + \
getImageNeoBoot() + '/boot/' + getBoxHostName() + '.vmlinux.gz > /dev/null 2>&1'
"...............REBOOT now...............\nPlease wait, in a moment the decoder will be restarted..."
)
cmd1 = (
"flash_erase /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1 ; flash_eraseall /dev/" +
getMmcBlockDevice() +
" 0 0 > /dev/null 2>&1 ")
if getNandWrite() == "nandwrite":
cmd2 = (
"nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/boot/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
else:
cmd2 = '' + LinkNeoBoot + '/bin/nandwrite -p /dev/' + getMmcBlockDevice() + ' ' + getNeoLocation() + \
'ImageBoot/' + getImageNeoBoot() + '/boot/' + getBoxHostName() + \
'.vmlinux.gz > /dev/null 2>&1'
cmd3 = "echo -e '\n%s '" % _('Changed kernel COMPLETE ! ' + getNandWrite() + '\nSTB NAME: ' + getBoxHostName() + '\nNeoBoot location:' + getNeoLocation(
) + '\nCPU: ' + getCPUSoC() + '\nImage boot: ' + getImageNeoBoot() + '\n____Your device will reboot in 5 seconds !____ ')
cmd4 = 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f'
cmd2 = (
""
+ LinkNeoBoot
+ "/bin/nandwrite -p /dev/"
+ getMmcBlockDevice()
+ " "
+ getNeoLocation()
+ "ImageBoot/"
+ getImageNeoBoot()
+ "/boot/"
+ getBoxHostName()
+ ".vmlinux.gz > /dev/null 2>&1"
)
cmd3 = "echo -e '\n%s '" % _(
"Changed kernel COMPLETE ! "
+ getNandWrite()
+ "\nSTB NAME: "
+ getBoxHostName()
+ "\nNeoBoot location:"
+ getNeoLocation()
+ "\nCPU: "
+ getCPUSoC()
+ "\nImage boot: "
+ getImageNeoBoot()
+ "\n____Your device will reboot in 5 seconds !____ "
)
cmd4 = "update-alternatives --remove vmlinux vmlinux-`uname -r` || true; sync; sleep 8; reboot -d -f"
self.session.open(Console, _('NeoBoot MIPS....'), [
cmd, cmd1, cmd2, cmd3, cmd4])
self.session.open(
Console, _("NeoBoot MIPS...."), [
cmd, cmd1, cmd2, cmd3, cmd4])
self.close()
else:
os.system('echo "Flash " >> ' + getNeoLocation() +
'ImageBoot/.neonextboot')
self.messagebox = self.session.open(MessageBox, _(
'It looks like it that multiboot does not support this STB.'), MessageBox.TYPE_INFO, 8)
os.system(
'echo "Flash " >> ' +
getNeoLocation() +
"ImageBoot/.neonextboot")
self.messagebox = self.session.open(
MessageBox,
_("It looks like it that multiboot does not support this STB."),
MessageBox.TYPE_INFO,
8,
)
self.close()
def myclose2(self, message):

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import re
from ubi.volume import get_volumes
from ubi.block import sort, get_blocks_in_list, extract_blocks
@@ -16,7 +15,7 @@ class ubi:
self._blocks = extract_blocks(self)
self._block_count = len(self.blocks)
if self._block_count <= 0:
raise Exception('No blocks found.')
raise Exception("No blocks found.")
layout_list, data_list, int_vol_list, unknown_list = sort.by_type(
self.blocks)
self._layout_blocks_list = layout_list
@@ -28,7 +27,8 @@ class ubi:
self._leb_size = self.file.block_size - arbitrary_block.ec_hdr.data_offset
layout_pairs = layout.group_pairs(self.blocks, self.layout_blocks_list)
layout_infos = layout.associate_blocks(
self.blocks, layout_pairs, self.first_peb_num)
self.blocks, layout_pairs, self.first_peb_num
)
self._images = []
for i in range(0, len(layout_infos)):
self._images.append(image(self.blocks, layout_infos[i]))
@@ -96,14 +96,14 @@ class ubi:
blocks = property(_get_blocks)
def display(self, tab=''):
def display(self, tab=""):
display.ubi(self, tab)
def get_peb_size(path):
file_offset = 0
offsets = []
f = open(path, 'rb')
f = open(path, "rb")
f.seek(0, 2)
file_size = f.tell() + 1
f.seek(0)
@@ -125,7 +125,7 @@ def get_peb_size(path):
for i in range(0, len(offsets)):
try:
diff = offsets[i] - offsets[i - 1]
except:
except BaseException:
diff = offsets[i]
if diff not in occurances:

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import re
from ubi import display
from ubi.defines import *
@@ -18,7 +17,11 @@ class description(object):
self.ec_hdr = extract_ec_hdr(block_buf[0:UBI_EC_HDR_SZ])
if not self.ec_hdr.errors:
self.vid_hdr = extract_vid_hdr(
block_buf[self.ec_hdr.vid_hdr_offset:self.ec_hdr.vid_hdr_offset + UBI_VID_HDR_SZ])
block_buf[
self.ec_hdr.vid_hdr_offset: self.ec_hdr.vid_hdr_offset
+ UBI_VID_HDR_SZ
]
)
self.is_internal_vol = self.vid_hdr.vol_id >= UBI_INTERNAL_VOL_START
if self.vid_hdr.vol_id >= UBI_INTERNAL_VOL_START:
self.vtbl_recs = extract_vtbl_rec(
@@ -29,9 +32,9 @@ class description(object):
return
def __repr__(self):
return 'Block: PEB# %s: LEB# %s' % (self.peb_num, self.leb_num)
return "Block: PEB# %s: LEB# %s" % (self.peb_num, self.leb_num)
def display(self, tab=''):
def display(self, tab=""):
display.block(self, tab)
@@ -45,7 +48,10 @@ def extract_blocks(ubi):
ubi.file.seek(ubi.file.start_offset)
peb_count = 0
cur_offset = 0
for i in range(ubi.file.start_offset, ubi.file.end_offset, ubi.file.block_size):
for i in range(
ubi.file.start_offset,
ubi.file.end_offset,
ubi.file.block_size):
buf = ubi.file.read(ubi.file.block_size)
if buf.startswith(UBI_EC_HDR_MAGIC):
blk = description(buf)

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubi.block import sort

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
def list_by_list(blist, slist):
slist_blocks = []
for block in blist:
@@ -24,11 +23,11 @@ def by_range(blocks, block_range):
def by_leb(blocks):
slist_len = len(blocks)
slist = ['x'] * slist_len
slist = ["x"] * slist_len
for block in blocks:
if blocks[block].leb_num >= slist_len:
add_elements = blocks[block].leb_num - slist_len + 1
slist += ['x'] * add_elements
slist += ["x"] * add_elements
slist_len = len(slist)
slist[blocks[block].leb_num] = block
@@ -78,7 +77,4 @@ def by_type(blocks, slist=None):
else:
unknown.append(i)
return (layout,
data,
int_vol,
unknown)
return (layout, data, int_vol, unknown)

View File

@@ -1,63 +1,64 @@
#!/usr/bin/python
import struct
UBI_CRC32_INIT = 4294967295
UBI_MAX_VOLUMES = 128
UBI_INTERNAL_VOL_START = 2147479551
UBI_EC_HDR_MAGIC = 'UBI#'
EC_HDR_FORMAT = '>4sB3sQIII32sI'
EC_HDR_FIELDS = ['magic',
'version',
'padding',
'ec',
'vid_hdr_offset',
'data_offset',
'image_seq',
'padding2',
'hdr_crc']
UBI_EC_HDR_MAGIC = "UBI#"
EC_HDR_FORMAT = ">4sB3sQIII32sI"
EC_HDR_FIELDS = [
"magic",
"version",
"padding",
"ec",
"vid_hdr_offset",
"data_offset",
"image_seq",
"padding2",
"hdr_crc",
]
UBI_EC_HDR_SZ = struct.calcsize(EC_HDR_FORMAT)
UBI_VID_HDR_MAGIC = 'UBI!'
VID_HDR_FORMAT = '>4sBBBBII4sIIII4sQ12sI'
VID_HDR_FIELDS = ['magic',
'version',
'vol_type',
'copy_flag',
'compat',
'vol_id',
'lnum',
'padding',
'data_size',
'used_ebs',
'data_pad',
'data_crc',
'padding2',
'sqnum',
'padding3',
'hdr_crc']
UBI_VID_HDR_MAGIC = "UBI!"
VID_HDR_FORMAT = ">4sBBBBII4sIIII4sQ12sI"
VID_HDR_FIELDS = [
"magic",
"version",
"vol_type",
"copy_flag",
"compat",
"vol_id",
"lnum",
"padding",
"data_size",
"used_ebs",
"data_pad",
"data_crc",
"padding2",
"sqnum",
"padding3",
"hdr_crc",
]
UBI_VID_HDR_SZ = struct.calcsize(VID_HDR_FORMAT)
VTBL_REC_FORMAT = '>IIIBBH128sB23sI'
VTBL_REC_FIELDS = ['reserved_pebs',
'alignment',
'data_pad',
'vol_type',
'upd_marker',
'name_len',
'name',
'flags',
'padding',
'crc']
VTBL_REC_FORMAT = ">IIIBBH128sB23sI"
VTBL_REC_FIELDS = [
"reserved_pebs",
"alignment",
"data_pad",
"vol_type",
"upd_marker",
"name_len",
"name",
"flags",
"padding",
"crc",
]
UBI_VTBL_REC_SZ = struct.calcsize(VTBL_REC_FORMAT)
UBI_VID_DYNAMIC = 1
UBI_VID_STATIC = 2
PRINT_VOL_TYPE_LIST = [0, 'dynamic', 'static']
PRINT_VOL_TYPE_LIST = [0, "dynamic", "static"]
UBI_VTBL_AUTORESIZE_FLG = 1
UBI_COMPAT_DELETE = 1
UBI_COMPAT_RO = 2
UBI_COMPAT_PRESERVE = 4
UBI_COMPAT_REJECT = 5
PRINT_COMPAT_LIST = [0,
'Delete',
'Read Only',
0,
'Preserve',
'Reject']
PRINT_COMPAT_LIST = [0, "Delete", "Read Only", 0, "Preserve", "Reject"]
FILE_CHUNK_SZ = 5242880

View File

@@ -1,111 +1,111 @@
#!/usr/bin/python
from ubi.defines import PRINT_COMPAT_LIST, PRINT_VOL_TYPE_LIST, UBI_VTBL_AUTORESIZE_FLG
def ubi(ubi, tab=''):
print(('%sUBI File' % tab))
print(('%s---------------------' % tab))
print(('\t%sMin I/O: %s' % (tab, ubi.min_io_size)))
print(('\t%sLEB Size: %s' % (tab, ubi.leb_size)))
print(('\t%sPEB Size: %s' % (tab, ubi.peb_size)))
print(('\t%sTotal Block Count: %s' % (tab, ubi.block_count)))
print(('\t%sData Block Count: %s' % (tab, len(ubi.data_blocks_list))))
print(('\t%sLayout Block Count: %s' % (tab, len(ubi.layout_blocks_list))))
print(('\t%sInternal Volume Block Count: %s' %
def ubi(ubi, tab=""):
print(("%sUBI File" % tab))
print(("%s---------------------" % tab))
print(("\t%sMin I/O: %s" % (tab, ubi.min_io_size)))
print(("\t%sLEB Size: %s" % (tab, ubi.leb_size)))
print(("\t%sPEB Size: %s" % (tab, ubi.peb_size)))
print(("\t%sTotal Block Count: %s" % (tab, ubi.block_count)))
print(("\t%sData Block Count: %s" % (tab, len(ubi.data_blocks_list))))
print(("\t%sLayout Block Count: %s" % (tab, len(ubi.layout_blocks_list))))
print(("\t%sInternal Volume Block Count: %s" %
(tab, len(ubi.int_vol_blocks_list))))
print(('\t%sUnknown Block Count: %s' % (tab, len(ubi.unknown_blocks_list))))
print(('\t%sFirst UBI PEB Number: %s' % (tab, ubi.first_peb_num)))
print(("\t%sUnknown Block Count: %s" %
(tab, len(ubi.unknown_blocks_list))))
print(("\t%sFirst UBI PEB Number: %s" % (tab, ubi.first_peb_num)))
def image(image, tab=''):
print(('%s%s' % (tab, image)))
print(('%s---------------------' % tab))
print(('\t%sImage Sequence Num: %s' % (tab, image.image_seq)))
def image(image, tab=""):
print(("%s%s" % (tab, image)))
print(("%s---------------------" % tab))
print(("\t%sImage Sequence Num: %s" % (tab, image.image_seq)))
for volume in image.volumes:
print(('\t%sVolume Name:%s' % (tab, volume)))
print(("\t%sVolume Name:%s" % (tab, volume)))
print(('\t%sPEB Range: %s - %s' %
(tab, image.peb_range[0], image.peb_range[1])))
print(("\t%sPEB Range: %s - %s" %
(tab, image.peb_range[0], image.peb_range[1])))
def volume(volume, tab=''):
print(('%s%s' % (tab, volume)))
print(('%s---------------------' % tab))
print(('\t%sVol ID: %s' % (tab, volume.vol_id)))
print(('\t%sName: %s' % (tab, volume.name)))
print(('\t%sBlock Count: %s' % (tab, volume.block_count)))
print('\n')
print(('\t%sVolume Record' % tab))
print(('\t%s---------------------' % tab))
vol_rec(volume.vol_rec, '\t\t%s' % tab)
print('\n')
def volume(volume, tab=""):
print(("%s%s" % (tab, volume)))
print(("%s---------------------" % tab))
print(("\t%sVol ID: %s" % (tab, volume.vol_id)))
print(("\t%sName: %s" % (tab, volume.name)))
print(("\t%sBlock Count: %s" % (tab, volume.block_count)))
print("\n")
print(("\t%sVolume Record" % tab))
print(("\t%s---------------------" % tab))
vol_rec(volume.vol_rec, "\t\t%s" % tab)
print("\n")
def block(block, tab='\t'):
print(('%s%s' % (tab, block)))
print(('%s---------------------' % tab))
print(('\t%sFile Offset: %s' % (tab, block.file_offset)))
print(('\t%sPEB #: %s' % (tab, block.peb_num)))
print(('\t%sLEB #: %s' % (tab, block.leb_num)))
print(('\t%sBlock Size: %s' % (tab, block.size)))
print(('\t%sInternal Volume: %s' % (tab, block.is_internal_vol)))
print(('\t%sIs Volume Table: %s' % (tab, block.is_vtbl)))
print(('\t%sIs Valid: %s' % (tab, block.is_valid)))
def block(block, tab="\t"):
print(("%s%s" % (tab, block)))
print(("%s---------------------" % tab))
print(("\t%sFile Offset: %s" % (tab, block.file_offset)))
print(("\t%sPEB #: %s" % (tab, block.peb_num)))
print(("\t%sLEB #: %s" % (tab, block.leb_num)))
print(("\t%sBlock Size: %s" % (tab, block.size)))
print(("\t%sInternal Volume: %s" % (tab, block.is_internal_vol)))
print(("\t%sIs Volume Table: %s" % (tab, block.is_vtbl)))
print(("\t%sIs Valid: %s" % (tab, block.is_valid)))
if not block.ec_hdr.errors:
print('\n')
print(('\t%sErase Count Header' % tab))
print(('\t%s---------------------' % tab))
ec_hdr(block.ec_hdr, '\t\t%s' % tab)
print("\n")
print(("\t%sErase Count Header" % tab))
print(("\t%s---------------------" % tab))
ec_hdr(block.ec_hdr, "\t\t%s" % tab)
if block.vid_hdr and not block.vid_hdr.errors:
print('\n')
print(('\t%sVID Header Header' % tab))
print(('\t%s---------------------' % tab))
vid_hdr(block.vid_hdr, '\t\t%s' % tab)
print("\n")
print(("\t%sVID Header Header" % tab))
print(("\t%s---------------------" % tab))
vid_hdr(block.vid_hdr, "\t\t%s" % tab)
if block.vtbl_recs:
print('\n')
print(('\t%sVolume Records' % tab))
print(('\t%s---------------------' % tab))
print("\n")
print(("\t%sVolume Records" % tab))
print(("\t%s---------------------" % tab))
for vol in block.vtbl_recs:
vol_rec(vol, '\t\t%s' % tab)
vol_rec(vol, "\t\t%s" % tab)
print('\n')
print("\n")
def ec_hdr(ec_hdr, tab=''):
def ec_hdr(ec_hdr, tab=""):
for key, value in ec_hdr:
if key == 'errors':
value = ','.join(value)
print(('%s%s: %r' % (tab, key, value)))
if key == "errors":
value = ",".join(value)
print(("%s%s: %r" % (tab, key, value)))
def vid_hdr(vid_hdr, tab=''):
def vid_hdr(vid_hdr, tab=""):
for key, value in vid_hdr:
if key == 'errors':
value = ','.join(value)
elif key == 'compat':
if key == "errors":
value = ",".join(value)
elif key == "compat":
if value in PRINT_COMPAT_LIST:
value = PRINT_COMPAT_LIST[value]
else:
value = -1
elif key == 'vol_type':
elif key == "vol_type":
if value < len(PRINT_VOL_TYPE_LIST):
value = PRINT_VOL_TYPE_LIST[value]
else:
value = -1
print(('%s%s: %s' % (tab, key, value)))
print(("%s%s: %s" % (tab, key, value)))
def vol_rec(vol_rec, tab=''):
def vol_rec(vol_rec, tab=""):
for key, value in vol_rec:
if key == 'errors':
value = ','.join(value)
elif key == 'vol_type':
if key == "errors":
value = ",".join(value)
elif key == "vol_type":
if value < len(PRINT_VOL_TYPE_LIST):
value = PRINT_VOL_TYPE_LIST[value]
else:
value = -1
elif key == 'flags' and value == UBI_VTBL_AUTORESIZE_FLG:
value = 'autoresize'
elif key == 'name':
value = value.strip('\x00')
print(('%s%s: %s' % (tab, key, value)))
elif key == "flags" and value == UBI_VTBL_AUTORESIZE_FLG:
value = "autoresize"
elif key == "name":
value = value.strip("\x00")
print(("%s%s: %s" % (tab, key, value)))

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import struct
from ubi.defines import *
from ubi.headers import errors
@@ -12,14 +11,14 @@ class ec_hdr(object):
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, "errors", [])
def __repr__(self):
return 'Error Count Header'
return "Error Count Header"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -31,15 +30,15 @@ class vid_hdr(object):
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, "errors", [])
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
def __repr__(self):
return 'VID Header'
return "VID Header"
class vtbl_rec(object):
@@ -50,15 +49,15 @@ class vtbl_rec(object):
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, 'rec_index', -1)
setattr(self, "errors", [])
setattr(self, "rec_index", -1)
def __repr__(self):
return 'Volume Table Record: %s' % getattr(self, 'name')
return "Volume Table Record: %s" % getattr(self, "name")
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -79,10 +78,10 @@ def extract_vid_hdr(buf):
def extract_vtbl_rec(buf):
data_buf = buf
vtbl_recs = []
vtbl_rec_ret = ''
vtbl_rec_ret = ""
for i in range(0, UBI_MAX_VOLUMES):
offset = i * UBI_VTBL_REC_SZ
vtbl_rec_buf = data_buf[offset:offset + UBI_VTBL_REC_SZ]
vtbl_rec_buf = data_buf[offset: offset + UBI_VTBL_REC_SZ]
if len(vtbl_rec_buf) == UBI_VTBL_REC_SZ:
vtbl_rec_ret = vtbl_rec(vtbl_rec_buf)
errors.vtbl_rec(vtbl_rec_ret, vtbl_rec_buf)

View File

@@ -1,29 +1,28 @@
#!/usr/bin/python
from zlib import crc32
from ubi.defines import *
def ec_hdr(ec_hdr, buf):
if ec_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
ec_hdr.errors.append('crc')
ec_hdr.errors.append("crc")
return ec_hdr
def vid_hdr(vid_hdr, buf):
vid_hdr.errors = []
if vid_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
vid_hdr.errors.append('crc')
vid_hdr.errors.append("crc")
return vid_hdr
def vtbl_rec(vtbl_rec, buf):
likely_vtbl = True
if vtbl_rec.name_len != len(vtbl_rec.name.strip('\x00')):
if vtbl_rec.name_len != len(vtbl_rec.name.strip("\x00")):
likely_vtbl = False
elif vtbl_rec.vol_type not in (1, 2):
likely_vtbl = False
if vtbl_rec.crc != ~crc32(buf[:-4]) & 4294967295:
vtbl_rec.errors.append('crc')
vtbl_rec.errors.append("crc")
if not likely_vtbl:
vtbl_rec.errors = ['False']
vtbl_rec.errors = ["False"]
return vtbl_rec

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubi import display
from ubi.volume import get_volumes
from ubi.block import get_blocks_in_list
@@ -15,10 +14,12 @@ class description(object):
self._volumes = get_volumes(blocks, layout_info)
def __repr__(self):
return 'Image: %s' % self.image_seq
return "Image: %s" % self.image_seq
def get_blocks(self, blocks):
return get_blocks_in_list(blocks, list(range(self._start_peb, self._end_peb + 1)))
return get_blocks_in_list(
blocks, list(range(self._start_peb, self._end_peb + 1))
)
def _get_peb_range(self):
return [self._start_peb, self._end_peb]
@@ -35,5 +36,5 @@ class description(object):
volumes = property(_get_volumes)
def display(self, tab=''):
def display(self, tab=""):
display.image(self, tab)

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubi import display
from ubi.block import sort, get_blocks_in_list
@@ -12,7 +11,7 @@ class description(object):
self._block_list = block_list
def __repr__(self):
return 'Volume: %s' % self.name
return "Volume: %s" % self.name
def _get_name(self):
return self._name
@@ -42,15 +41,15 @@ class description(object):
def get_blocks(self, blocks):
return get_blocks_in_list(blocks, self._block_list)
def display(self, tab=''):
def display(self, tab=""):
display.volume(self, tab)
def reader(self, ubi):
last_leb = 0
for block in sort.by_leb(self.get_blocks(ubi.blocks)):
if block == 'x':
if block == "x":
last_leb += 1
yield '\xff' * ubi.leb_size
yield "\xff" * ubi.leb_size
else:
last_leb += 1
yield ubi.file.read_block_data(ubi.blocks[block])
@@ -60,10 +59,11 @@ def get_volumes(blocks, layout_info):
volumes = {}
vol_blocks_lists = sort.by_vol_id(blocks, layout_info[2])
for vol_rec in blocks[layout_info[0]].vtbl_recs:
vol_name = vol_rec.name.strip('\x00')
vol_name = vol_rec.name.strip("\x00")
if vol_rec.rec_index not in vol_blocks_lists:
vol_blocks_lists[vol_rec.rec_index] = []
volumes[vol_name] = description(
vol_rec.rec_index, vol_rec, vol_blocks_lists[vol_rec.rec_index])
vol_rec.rec_index, vol_rec, vol_blocks_lists[vol_rec.rec_index]
)
return volumes

View File

@@ -1,38 +1,58 @@
#!/usr/bin/python
import os
import sys
# import argparse_neo
try:
import argparse
except:
except BaseException:
import argparse_neo
from ubi import ubi, get_peb_size
from ubifs import ubifs
from ubi_io import ubi_file, leb_virtual_file
from ui.common import extract_files, output_dir
if __name__ == '__main__':
if __name__ == "__main__":
os.system(
'echo "\n[NeoBoot] Zip file unzipped.\nInstallation in progress, please wait ..."')
description = 'Extract contents of UBI image.'
usage = 'ubi_extract_files.py [options] filepath'
# parser = argparse_neo.ArgumentParser(usage=usage, description=description)
'echo "\n[NeoBoot] Zip file unzipped.\nInstallation in progress, please wait ..."'
)
description = "Extract contents of UBI image."
usage = "ubi_extract_files.py [options] filepath"
try:
parser = argparse.ArgumentParser(usage=usage, description=description)
except:
except BaseException:
parser = argparse_neo.ArgumentParser(
usage=usage, description=description)
parser.add_argument('-l', '--log-file', dest='logpath',
help='Log output to file output/LOGPATH. (default: ubifs_output.log)')
parser.add_argument('-k', '--keep-permissions', action='store_true', dest='permissions',
help='Maintain file permissions, requires running as root. (default: False)')
parser.add_argument('-q', '--quiet', action='store_true', dest='quiet',
help='Suppress warnings and non-fatal errors. (default: False)')
parser.add_argument('-p', '--peb-size', type=int,
dest='block_size', help='Specify PEB size.')
parser.add_argument('-o', '--output-dir', dest='output_path',
help='Specify output directory path.')
parser.add_argument('filepath', help='File to extract contents of.')
parser.add_argument(
"-l",
"--log-file",
dest="logpath",
help="Log output to file output/LOGPATH. (default: ubifs_output.log)",
)
parser.add_argument(
"-k",
"--keep-permissions",
action="store_true",
dest="permissions",
help="Maintain file permissions, requires running as root. (default: False)",
)
parser.add_argument(
"-q",
"--quiet",
action="store_true",
dest="quiet",
help="Suppress warnings and non-fatal errors. (default: False)",
)
parser.add_argument(
"-p",
"--peb-size",
type=int,
dest="block_size",
help="Specify PEB size.")
parser.add_argument(
"-o",
"--output-dir",
dest="output_path",
help="Specify output directory path.")
parser.add_argument("filepath", help="File to extract contents of.")
if len(sys.argv) == 1:
parser.print_help()
sys.exit()
@@ -69,13 +89,16 @@ if __name__ == '__main__':
os.makedirs(vol_out_path)
elif os.listdir(vol_out_path):
parser.error(
'Volume output directory is not empty. %s' % vol_out_path)
"Volume output directory is not empty. %s" %
vol_out_path)
ufsfile = leb_virtual_file(uubi, image.volumes[volume])
uubifs = ubifs(ufsfile)
uubifs.log.log_file = log_file
uubifs.log.log_to_file = log_to_file
uubifs.log.quiet = quiet
print("Wait almost over ...\nLoading the image to: %s" % vol_out_path)
print(
"Wait almost over ...\nLoading the image to: %s" %
vol_out_path)
extract_files(uubifs, vol_out_path, perms)
sys.exit(0)

View File

@@ -1,11 +1,10 @@
#!/usr/bin/python
from ubi.block import sort
class ubi_file(object):
def __init__(self, path, block_size, start_offset=0, end_offset=None):
self._fhandle = open(path, 'rb')
self._fhandle = open(path, "rb")
self._start_offset = start_offset
if end_offset:
self._end_offset = end_offset
@@ -14,7 +13,7 @@ class ubi_file(object):
self._end_offset = self.tell()
self._block_size = block_size
if start_offset >= self._end_offset:
raise Exception('Start offset larger than file size!')
raise Exception("Start offset larger than file size!")
self._fhandle.seek(self._start_offset)
def _set_start(self, i):
@@ -69,7 +68,8 @@ class ubi_file(object):
def read_block_data(self, block):
self.seek(block.file_offset + block.ec_hdr.data_offset)
buf = self._fhandle.read(
block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad)
block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad
)
return buf
@@ -82,22 +82,22 @@ class leb_virtual_file:
self._seek = 0
self.leb_data_size = len(self._blocks) * self._ubi.leb_size
self._last_leb = -1
self._last_buf = ''
self._last_buf = ""
def read(self, i):
buf = ''
buf = ""
leb = int(self.tell() / self._ubi.leb_size)
offset = self.tell() % self._ubi.leb_size
if leb == self._last_leb:
self.seek(self.tell() + i)
return self._last_buf[offset:offset + i]
return self._last_buf[offset: offset + i]
else:
buf = self._ubi.file.read_block_data(
self._ubi.blocks[self._blocks[leb]])
self._last_buf = buf
self._last_leb = leb
self.seek(self.tell() + i)
return buf[offset:offset + i]
return buf[offset: offset + i]
def reset(self):
self.seek(0)
@@ -113,7 +113,7 @@ class leb_virtual_file:
for block in self._blocks:
while 0 != self._ubi.blocks[block].leb_num - last_leb:
last_leb += 1
yield '\xff' * self._ubi.leb_size
yield "\xff" * self._ubi.leb_size
last_leb += 1
yield self._ubi.file.read_block_data(self._ubi.blocks[block])

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import re
import struct
from ubifs.defines import *
@@ -50,7 +49,7 @@ class ubifs:
def get_leb_size(path):
f = open(path, 'rb')
f = open(path, "rb")
f.seek(0, 2)
file_size = f.tell() + 1
f.seek(0)
@@ -59,7 +58,7 @@ def get_leb_size(path):
buf = f.read(FILE_CHUNK_SZ)
for m in re.finditer(UBIFS_NODE_MAGIC, buf):
start = m.start()
chdr = nodes.common_hdr(buf[start:start + UBIFS_COMMON_HDR_SZ])
chdr = nodes.common_hdr(buf[start: start + UBIFS_COMMON_HDR_SZ])
if chdr and chdr.node_type == UBIFS_SB_NODE:
sb_start = start + UBIFS_COMMON_HDR_SZ
sb_end = sb_start + UBIFS_SB_NODE_SZ

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
import struct
UBIFS_NODE_MAGIC = '1\x18\x10\x06'
UBIFS_NODE_MAGIC = "1\x18\x10\x06"
UBIFS_CRC32_INIT = 4294967295
UBIFS_MIN_COMPR_LEN = 128
UBIFS_MIN_COMPRESS_DIFF = 64
@@ -10,7 +10,7 @@ UBIFS_MAX_NLEN = 255
UBIFS_MAX_JHEADS = 1
UBIFS_BLOCK_SIZE = 4096
UBIFS_BLOCK_SHIFT = 12
UBIFS_PADDING_BYTE = '\xce'
UBIFS_PADDING_BYTE = "\xce"
UBIFS_MAX_KEY_LEN = 16
UBIFS_SK_LEN = 8
UBIFS_MIN_FANOUT = 3
@@ -37,7 +37,7 @@ UBIFS_ITYPE_SOCK = 6
UBIFS_ITYPES_CNT = 7
UBIFS_KEY_HASH_R5 = 0
UBIFS_KEY_HASH_TEST = 1
PRINT_UBIFS_KEY_HASH = ['r5', 'test']
PRINT_UBIFS_KEY_HASH = ["r5", "test"]
UBIFS_SIMPLE_KEY_FMT = 0
UBIFS_S_KEY_BLOCK_BITS = 29
UBIFS_S_KEY_BLOCK_MASK = 536870911
@@ -64,7 +64,7 @@ UBIFS_COMPR_NONE = 0
UBIFS_COMPR_LZO = 1
UBIFS_COMPR_ZLIB = 2
UBIFS_COMPR_TYPES_CNT = 3
PRINT_UBIFS_COMPR = ['none', 'lzo', 'zlib']
PRINT_UBIFS_COMPR = ["none", "lzo", "zlib"]
UBIFS_INO_NODE = 0
UBIFS_DATA_NODE = 1
UBIFS_DENT_NODE = 2
@@ -86,136 +86,133 @@ UBIFS_IN_NODE_GROUP = 1
UBIFS_LAST_OF_NODE_GROUP = 2
UBIFS_FLG_BIGLPT = 2
UBIFS_FLG_SPACE_FIXUP = 4
UBIFS_COMMON_HDR_FORMAT = '<IIQIBB2s'
UBIFS_COMMON_HDR_FIELDS = ['magic',
'crc',
'sqnum',
'len',
'node_type',
'group_type',
'padding']
UBIFS_COMMON_HDR_FORMAT = "<IIQIBB2s"
UBIFS_COMMON_HDR_FIELDS = [
"magic",
"crc",
"sqnum",
"len",
"node_type",
"group_type",
"padding",
]
UBIFS_COMMON_HDR_SZ = struct.calcsize(UBIFS_COMMON_HDR_FORMAT)
UBIFS_KEY_OFFSET = UBIFS_COMMON_HDR_SZ
UBIFS_DEV_DESC_FORMAT = '<IQ'
UBIFS_DEV_DESC_FIELDS = ['new', 'huge']
UBIFS_DEV_DESC_FORMAT = "<IQ"
UBIFS_DEV_DESC_FIELDS = ["new", "huge"]
UBIFS_DEV_DESC_SZ = struct.calcsize(UBIFS_DEV_DESC_FORMAT)
UBIFS_INO_NODE_FORMAT = '<%ssQQQQQIIIIIIIIIII4sIH26s' % UBIFS_MAX_KEY_LEN
UBIFS_INO_NODE_FIELDS = ['key',
'creat_sqnum',
'size',
'atime_sec',
'ctime_sec',
'mtime_sec',
'atime_nsec',
'ctime_nsec',
'mtime_nsec',
'nlink',
'uid',
'gid',
'mode',
'flags',
'data_len',
'xattr_cnt',
'xattr_size',
'padding1',
'xattr_names',
'compr_type',
'padding2']
UBIFS_INO_NODE_FORMAT = "<%ssQQQQQIIIIIIIIIII4sIH26s" % UBIFS_MAX_KEY_LEN
UBIFS_INO_NODE_FIELDS = [
"key",
"creat_sqnum",
"size",
"atime_sec",
"ctime_sec",
"mtime_sec",
"atime_nsec",
"ctime_nsec",
"mtime_nsec",
"nlink",
"uid",
"gid",
"mode",
"flags",
"data_len",
"xattr_cnt",
"xattr_size",
"padding1",
"xattr_names",
"compr_type",
"padding2",
]
UBIFS_INO_NODE_SZ = struct.calcsize(UBIFS_INO_NODE_FORMAT)
UBIFS_DENT_NODE_FORMAT = '<%ssQBBH4s' % UBIFS_MAX_KEY_LEN
UBIFS_DENT_NODE_FIELDS = ['key',
'inum',
'padding1',
'type',
'nlen',
'padding2']
UBIFS_DENT_NODE_FORMAT = "<%ssQBBH4s" % UBIFS_MAX_KEY_LEN
UBIFS_DENT_NODE_FIELDS = [
"key",
"inum",
"padding1",
"type",
"nlen",
"padding2"]
UBIFS_DENT_NODE_SZ = struct.calcsize(UBIFS_DENT_NODE_FORMAT)
UBIFS_DATA_NODE_FORMAT = '<%ssIH2s' % UBIFS_MAX_KEY_LEN
UBIFS_DATA_NODE_FIELDS = ['key',
'size',
'compr_type',
'padding']
UBIFS_DATA_NODE_FORMAT = "<%ssIH2s" % UBIFS_MAX_KEY_LEN
UBIFS_DATA_NODE_FIELDS = ["key", "size", "compr_type", "padding"]
UBIFS_DATA_NODE_SZ = struct.calcsize(UBIFS_DATA_NODE_FORMAT)
UBIFS_TRUN_NODE_FORMAT = '<I12sQQ'
UBIFS_TRUN_NODE_FIELDS = ['inum',
'padding',
'old_size',
'new_size']
UBIFS_TRUN_NODE_FORMAT = "<I12sQQ"
UBIFS_TRUN_NODE_FIELDS = ["inum", "padding", "old_size", "new_size"]
UBIFS_TRUN_NODE_SZ = struct.calcsize(UBIFS_TRUN_NODE_FORMAT)
UBIFS_PAD_NODE_FORMAT = '<I'
UBIFS_PAD_NODE_FIELDS = ['pad_len']
UBIFS_PAD_NODE_FORMAT = "<I"
UBIFS_PAD_NODE_FIELDS = ["pad_len"]
UBIFS_PAD_NODE_SZ = struct.calcsize(UBIFS_PAD_NODE_FORMAT)
UBIFS_SB_NODE_FORMAT = '<2sBBIIIIIQIIIIIIIH2sIIQI16sI3968s'
UBIFS_SB_NODE_FIELDS = ['padding',
'key_hash',
'key_fmt',
'flags',
'min_io_size',
'leb_size',
'leb_cnt',
'max_leb_cnt',
'max_bud_bytes',
'log_lebs',
'lpt_lebs',
'orph_lebs',
'jhead_cnt',
'fanout',
'lsave_cnt',
'fmt_version',
'default_compr',
'padding1',
'rp_uid',
'rp_gid',
'rp_size',
'time_gran',
'uuid',
'ro_compat_version',
'padding2']
UBIFS_SB_NODE_FORMAT = "<2sBBIIIIIQIIIIIIIH2sIIQI16sI3968s"
UBIFS_SB_NODE_FIELDS = [
"padding",
"key_hash",
"key_fmt",
"flags",
"min_io_size",
"leb_size",
"leb_cnt",
"max_leb_cnt",
"max_bud_bytes",
"log_lebs",
"lpt_lebs",
"orph_lebs",
"jhead_cnt",
"fanout",
"lsave_cnt",
"fmt_version",
"default_compr",
"padding1",
"rp_uid",
"rp_gid",
"rp_size",
"time_gran",
"uuid",
"ro_compat_version",
"padding2",
]
UBIFS_SB_NODE_SZ = struct.calcsize(UBIFS_SB_NODE_FORMAT)
UBIFS_MST_NODE_FORMAT = '<QQIIIIIIIIQQQQQQIIIIIIIIIIII344s'
UBIFS_MST_NODE_FIELDS = ['highest_inum',
'cmt_no',
'flags',
'log_lnum',
'root_lnum',
'root_offs',
'root_len',
'gc_lnum',
'ihead_lnum',
'ihead_offs',
'index_size',
'total_free',
'total_dirty',
'total_used',
'total_dead',
'total_dark',
'lpt_lnum',
'lpt_offs',
'nhead_lnum',
'nhead_offs',
'ltab_lnum',
'ltab_offs',
'lsave_lnum',
'lsave_offs',
'lscan_lnum',
'empty_lebs',
'idx_lebs',
'leb_cnt',
'padding']
UBIFS_MST_NODE_FORMAT = "<QQIIIIIIIIQQQQQQIIIIIIIIIIII344s"
UBIFS_MST_NODE_FIELDS = [
"highest_inum",
"cmt_no",
"flags",
"log_lnum",
"root_lnum",
"root_offs",
"root_len",
"gc_lnum",
"ihead_lnum",
"ihead_offs",
"index_size",
"total_free",
"total_dirty",
"total_used",
"total_dead",
"total_dark",
"lpt_lnum",
"lpt_offs",
"nhead_lnum",
"nhead_offs",
"ltab_lnum",
"ltab_offs",
"lsave_lnum",
"lsave_offs",
"lscan_lnum",
"empty_lebs",
"idx_lebs",
"leb_cnt",
"padding",
]
UBIFS_MST_NODE_SZ = struct.calcsize(UBIFS_MST_NODE_FORMAT)
UBIFS_REF_NODE_FORMAT = '<III28s'
UBIFS_REF_NODE_FIELDS = ['lnum',
'offs',
'jhead',
'padding']
UBIFS_REF_NODE_FORMAT = "<III28s"
UBIFS_REF_NODE_FIELDS = ["lnum", "offs", "jhead", "padding"]
UBIFS_REF_NODE_SZ = struct.calcsize(UBIFS_REF_NODE_FORMAT)
UBIFS_BRANCH_FORMAT = '<III%ss' % UBIFS_SK_LEN
UBIFS_BRANCH_FIELDS = ['lnum',
'offs',
'len',
'key']
UBIFS_BRANCH_FORMAT = "<III%ss" % UBIFS_SK_LEN
UBIFS_BRANCH_FIELDS = ["lnum", "offs", "len", "key"]
UBIFS_BRANCH_SZ = struct.calcsize(UBIFS_BRANCH_FORMAT)
UBIFS_IDX_NODE_FORMAT = '<HH'
UBIFS_IDX_NODE_FIELDS = ['child_cnt', 'level']
UBIFS_IDX_NODE_FORMAT = "<HH"
UBIFS_IDX_NODE_FIELDS = ["child_cnt", "level"]
UBIFS_IDX_NODE_SZ = struct.calcsize(UBIFS_IDX_NODE_FORMAT)
FILE_CHUNK_SZ = 5242880

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import os
import sys
import ui
@@ -8,18 +7,18 @@ class log:
def __init__(self):
self.log_to_file = False
self.log_file = 'ubifs_output.log'
self.log_file = "ubifs_output.log"
self.exit_on_except = False
self.quiet = False
def _out(self, s):
if not self.quiet:
if self.log_to_file:
with open(os.path.join(ui.common.output_dir, self.log_file), 'a') as f:
f.write('%s\n' % s)
with open(os.path.join(ui.common.output_dir, self.log_file), "a") as f:
f.write("%s\n" % s)
f.close()
else:
print(('%s' % s))
print(("%s" % s))
if self.exit_on_except:
sys.exit()
@@ -27,8 +26,8 @@ class log:
self._out(s)
def write_node(self, n):
buf = '%s\n' % n
buf = "%s\n" % n
for key, value in n:
buf += '\t%s: %s\n' % (key, value)
buf += "\t%s: %s\n" % (key, value)
self._out(buf)

View File

@@ -1,46 +1,34 @@
#!/usr/bin/python
# import lzo
import struct
import zlib
from ubifs.defines import *
ino_types = ['file',
'dir',
'lnk',
'blk',
'chr',
'fifo',
'sock']
node_types = ['ino',
'data',
'dent',
'xent',
'trun',
'pad',
'sb',
'mst',
'ref',
'idx',
'cs',
'orph']
key_types = ['ino',
'data',
'dent',
'xent']
ino_types = ["file", "dir", "lnk", "blk", "chr", "fifo", "sock"]
node_types = [
"ino",
"data",
"dent",
"xent",
"trun",
"pad",
"sb",
"mst",
"ref",
"idx",
"cs",
"orph",
]
key_types = ["ino", "data", "dent", "xent"]
def parse_key(key):
hkey, lkey = struct.unpack('<II', key[0:UBIFS_SK_LEN])
hkey, lkey = struct.unpack("<II", key[0:UBIFS_SK_LEN])
ino_num = hkey & UBIFS_S_KEY_HASH_MASK
key_type = lkey >> UBIFS_S_KEY_BLOCK_BITS
khash = lkey
return {'type': key_type,
'ino_num': ino_num,
'khash': khash}
return {"type": key_type, "ino_num": ino_num, "khash": khash}
def decompress(ctype, unc_len, data):
# if ctype == UBIFS_COMPR_LZO:
# return lzo.decompress(''.join(('\xf0', struct.pack('>I', unc_len), data)))
if ctype == UBIFS_COMPR_ZLIB:
return zlib.decompress(data, -11)
else:

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import struct
from ubifs.defines import *
from ubifs.misc import parse_key
@@ -8,18 +7,18 @@ class common_hdr(object):
def __init__(self, buf):
fields = dict(list(zip(UBIFS_COMMON_HDR_FIELDS,
struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf))))
struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf))))
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, "errors", [])
def __repr__(self):
return 'UBIFS Common Header'
return "UBIFS Common Header"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -27,16 +26,17 @@ class sb_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf))))
list(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
def __repr__(self):
return 'UBIFS Super Block Node'
return "UBIFS Super Block Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -44,16 +44,17 @@ class mst_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf))))
list(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
def __repr__(self):
return 'UBIFS Master Block Node'
return "UBIFS Master Block Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -61,21 +62,24 @@ class dent_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf))))
list(
zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf))
)
)
for key in fields:
if key == 'key':
if key == "key":
setattr(self, key, parse_key(fields[key]))
else:
setattr(self, key, fields[key])
setattr(self, 'name', '')
setattr(self, "name", "")
def __repr__(self):
return 'UBIFS Directory Entry Node'
return "UBIFS Directory Entry Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -83,22 +87,25 @@ class data_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf))))
list(
zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf))
)
)
for key in fields:
if key == 'key':
if key == "key":
setattr(self, key, parse_key(fields[key]))
else:
setattr(self, key, fields[key])
setattr(self, 'offset', 0)
setattr(self, 'compr_len', 0)
setattr(self, "offset", 0)
setattr(self, "compr_len", 0)
def __repr__(self):
return 'UBIFS Data Node'
return "UBIFS Data Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -106,18 +113,19 @@ class idx_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf))))
list(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'branches', [])
setattr(self, "branches", [])
def __repr__(self):
return 'UBIFS Index Node'
return "UBIFS Index Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -125,21 +133,22 @@ class ino_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf))))
list(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf)))
)
for key in fields:
if key == 'key':
if key == "key":
setattr(self, key, parse_key(fields[key]))
else:
setattr(self, key, fields[key])
setattr(self, 'data', '')
setattr(self, "data", "")
def __repr__(self):
return 'UBIFS Ino Node'
return "UBIFS Ino Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -147,14 +156,15 @@ class branch(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf))))
list(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
def __repr__(self):
return 'UBIFS Branch'
return "UBIFS Branch"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubifs import nodes
from ubifs.defines import *
@@ -28,7 +27,7 @@ def sb_node(ubifs, offset=0):
def dent_node(ubifs, lnum, offset=0):
ubifs.file.seek(ubifs.leb_size * lnum + offset)
den = nodes.dent_node(ubifs.file.read(UBIFS_DENT_NODE_SZ))
den.name = '%s' % ubifs.file.read(den.nlen)
den.name = "%s" % ubifs.file.read(den.nlen)
return den

View File

@@ -1,11 +1,10 @@
#!/usr/bin/python
import os
import struct
from ubifs.defines import *
from ubifs.misc import decompress
def dents(ubifs, inodes, dent_node, path='', perms=False):
def dents(ubifs, inodes, dent_node, path="", perms=False):
inode = inodes[dent_node.inum]
dent_path = os.path.join(path, dent_node.name)
if dent_node.type == UBIFS_ITYPE_DIR:
@@ -15,41 +14,42 @@ def dents(ubifs, inodes, dent_node, path='', perms=False):
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('DIR Fail: %s' % e)
ubifs.log.write("DIR Fail: %s" % e)
if 'dent' in inode:
for dnode in inode['dent']:
if "dent" in inode:
for dnode in inode["dent"]:
dents(ubifs, inodes, dnode, dent_path, perms)
elif dent_node.type == UBIFS_ITYPE_REG:
try:
if inode['ino'].nlink > 1:
if 'hlink' not in inode:
inode['hlink'] = dent_path
if inode["ino"].nlink > 1:
if "hlink" not in inode:
inode["hlink"] = dent_path
buf = process_reg_file(ubifs, inode, dent_path)
write_reg_file(dent_path, buf)
else:
os.link(inode['hlink'], dent_path)
os.link(inode["hlink"], dent_path)
else:
buf = process_reg_file(ubifs, inode, dent_path)
write_reg_file(dent_path, buf)
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('FILE Fail: %s' % e)
ubifs.log.write("FILE Fail: %s" % e)
elif dent_node.type == UBIFS_ITYPE_LNK:
try:
os.symlink('%s' % inode['ino'].data, dent_path)
os.symlink("%s" % inode["ino"].data, dent_path)
except Exception as e:
ubifs.log.write('SYMLINK Fail: %s : %s' %
(inode['ino'].data, dent_path))
ubifs.log.write(
"SYMLINK Fail: %s : %s" %
(inode["ino"].data, dent_path))
elif dent_node.type in [UBIFS_ITYPE_BLK, UBIFS_ITYPE_CHR]:
try:
dev = struct.unpack('<II', inode['ino'].data)[0]
dev = struct.unpack("<II", inode["ino"].data)[0]
if perms:
os.mknod(dent_path, inode['ino'].mode, dev)
os.mknod(dent_path, inode["ino"].mode, dev)
if perms:
set_file_perms(path, inode)
else:
@@ -57,60 +57,60 @@ def dents(ubifs, inodes, dent_node, path='', perms=False):
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('DEV Fail: %s : %s' % (dent_path, e))
ubifs.log.write("DEV Fail: %s : %s" % (dent_path, e))
elif dent_node.type == UBIFS_ITYPE_FIFO:
try:
os.mkfifo(dent_path, inode['ino'].mode)
os.mkfifo(dent_path, inode["ino"].mode)
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('FIFO Fail: %s : %s' % (dent_path, e))
ubifs.log.write("FIFO Fail: %s : %s" % (dent_path, e))
elif dent_node.type == UBIFS_ITYPE_SOCK:
try:
write_reg_file(dent_path, '')
write_reg_file(dent_path, "")
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('SOCK Fail: %s' % dent_path)
ubifs.log.write("SOCK Fail: %s" % dent_path)
def set_file_perms(path, inode):
try:
os.chmod(path, inode['ino'].mode)
os.chown(path, inode['ino'].uid, inode['ino'].gid)
except:
raise Exception('Failed File Permissions: %s' % path)
os.chmod(path, inode["ino"].mode)
os.chown(path, inode["ino"].uid, inode["ino"].gid)
except BaseException:
raise Exception("Failed File Permissions: %s" % path)
def write_reg_file(path, data):
with open(path, 'wb') as f:
with open(path, "wb") as f:
f.write(data)
def process_reg_file(ubifs, inode, path):
try:
buf = ''
if 'data' in inode:
buf = ""
if "data" in inode:
compr_type = 0
sorted_data = sorted(inode['data'], key=lambda x: x.key['khash'])
last_khash = sorted_data[0].key['khash'] - 1
sorted_data = sorted(inode["data"], key=lambda x: x.key["khash"])
last_khash = sorted_data[0].key["khash"] - 1
for data in sorted_data:
if data.key['khash'] - last_khash != 1:
while 1 != data.key['khash'] - last_khash:
buf += '\x00' * UBIFS_BLOCK_SIZE
if data.key["khash"] - last_khash != 1:
while 1 != data.key["khash"] - last_khash:
buf += "\x00" * UBIFS_BLOCK_SIZE
last_khash += 1
compr_type = data.compr_type
ubifs.file.seek(data.offset)
d = ubifs.file.read(data.compr_len)
buf += decompress(compr_type, data.size, d)
last_khash = data.key['khash']
last_khash = data.key["khash"]
except Exception as e:
raise Exception('inode num:%s :%s' % (inode['ino'].key['ino_num'], e))
raise Exception("inode num:%s :%s" % (inode["ino"].key["ino_num"], e))
if inode['ino'].size > len(buf):
buf += '\x00' * (inode['ino'].size - len(buf))
if inode["ino"].size > len(buf):
buf += "\x00" * (inode["ino"].size - len(buf))
return buf

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubifs import extract
from ubifs.defines import *
@@ -12,24 +11,28 @@ def index(ubifs, lnum, offset, inodes={}):
elif chdr.node_type == UBIFS_INO_NODE:
inon = extract.ino_node(ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ)
ino_num = inon.key['ino_num']
ino_num = inon.key["ino_num"]
if ino_num not in inodes:
inodes[ino_num] = {}
inodes[ino_num]['ino'] = inon
inodes[ino_num]["ino"] = inon
elif chdr.node_type == UBIFS_DATA_NODE:
datn = extract.data_node(
ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ, chdr.len)
ino_num = datn.key['ino_num']
ubifs,
lnum,
offset +
UBIFS_COMMON_HDR_SZ,
chdr.len)
ino_num = datn.key["ino_num"]
if ino_num not in inodes:
inodes[ino_num] = {}
if 'data' not in inodes[ino_num]:
inodes[ino_num]['data'] = []
inodes[ino_num]['data'].append(datn)
if "data" not in inodes[ino_num]:
inodes[ino_num]["data"] = []
inodes[ino_num]["data"].append(datn)
elif chdr.node_type == UBIFS_DENT_NODE:
dn = extract.dent_node(ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ)
ino_num = dn.key['ino_num']
ino_num = dn.key["ino_num"]
if ino_num not in inodes:
inodes[ino_num] = {}
if 'dent' not in inodes[ino_num]:
inodes[ino_num]['dent'] = []
inodes[ino_num]['dent'].append(dn)
if "dent" not in inodes[ino_num]:
inodes[ino_num]["dent"] = []
inodes[ino_num]["dent"].append(dn)

View File

@@ -1,11 +1,12 @@
#!/usr/bin/python
import os
from ubi_io import leb_virtual_file
from ubifs import ubifs, walk, output
from ubifs.defines import PRINT_UBIFS_KEY_HASH, PRINT_UBIFS_COMPR
from ubi.defines import PRINT_VOL_TYPE_LIST, UBI_VTBL_AUTORESIZE_FLG
output_dir = os.path.join(os.path.dirname(
os.path.dirname(os.path.realpath(__file__))), 'output')
output_dir = os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "output"
)
def extract_files(ubifs, out_path, perms=False):
@@ -13,34 +14,37 @@ def extract_files(ubifs, out_path, perms=False):
inodes = {}
walk.index(ubifs, ubifs.master_node.root_lnum,
ubifs.master_node.root_offs, inodes)
for dent in inodes[1]['dent']:
for dent in inodes[1]["dent"]:
output.dents(ubifs, inodes, dent, out_path, perms)
except Exception as e:
import traceback
ubifs.log.write('%s' % e)
ubifs.log.write("%s" % e)
traceback.print_exc()
def get_ubi_params(ubi):
ubi_flags = {'min_io_size': '-m',
'max_bud_bytes': '-j',
'leb_size': '-e',
'default_compr': '-x',
'sub_page_size': '-s',
'fanout': '-f',
'key_hash': '-k',
'orph_lebs': '-p',
'log_lebs': '-l',
'max_leb_cnt': '-c',
'peb_size': '-p',
'sub_page_size': '-s',
'vid_hdr_offset': '-O',
'version': '-x',
'image_seq': '-Q',
'alignment': '-a',
'vol_id': '-n',
'name': '-N'}
ubi_flags = {
"min_io_size": "-m",
"max_bud_bytes": "-j",
"leb_size": "-e",
"default_compr": "-x",
"sub_page_size": "-s",
"fanout": "-f",
"key_hash": "-k",
"orph_lebs": "-p",
"log_lebs": "-l",
"max_leb_cnt": "-c",
"peb_size": "-p",
"sub_page_size": "-s",
"vid_hdr_offset": "-O",
"version": "-x",
"image_seq": "-Q",
"alignment": "-a",
"vol_id": "-n",
"name": "-N",
}
ubi_params = {}
ubi_args = {}
ini_params = {}
@@ -52,41 +56,55 @@ def get_ubi_params(ubi):
for volume in image.volumes:
ubi_args[img_seq][volume] = {}
ini_params[img_seq][volume] = {}
ini_params[img_seq][volume]['vol_type'] = PRINT_VOL_TYPE_LIST[image.volumes[volume].vol_rec.vol_type]
ini_params[img_seq][volume]["vol_type"] = PRINT_VOL_TYPE_LIST[
image.volumes[volume].vol_rec.vol_type
]
if image.volumes[volume].vol_rec.flags == UBI_VTBL_AUTORESIZE_FLG:
ini_params[img_seq][volume]['vol_flags'] = 'autoresize'
ini_params[img_seq][volume]["vol_flags"] = "autoresize"
else:
ini_params[img_seq][volume]['vol_flags'] = image.volumes[volume].vol_rec.flags
ini_params[img_seq][volume]['vol_id'] = image.volumes[volume].vol_id
ini_params[img_seq][volume]['vol_name'] = image.volumes[volume].name.rstrip(
'\x00')
ini_params[img_seq][volume]['vol_alignment'] = image.volumes[volume].vol_rec.alignment
ini_params[img_seq][volume]['vol_size'] = image.volumes[volume].vol_rec.reserved_pebs * ubi.leb_size
ini_params[img_seq][volume]["vol_flags"] = image.volumes[
volume
].vol_rec.flags
ini_params[img_seq][volume]["vol_id"] = image.volumes[volume].vol_id
ini_params[img_seq][volume]["vol_name"] = image.volumes[volume].name.rstrip(
"\x00")
ini_params[img_seq][volume]["vol_alignment"] = image.volumes[
volume
].vol_rec.alignment
ini_params[img_seq][volume]["vol_size"] = (
image.volumes[volume].vol_rec.reserved_pebs * ubi.leb_size
)
ufsfile = leb_virtual_file(ubi, image.volumes[volume])
uubifs = ubifs(ufsfile)
for key, value in uubifs.superblock_node:
if key == 'key_hash':
if key == "key_hash":
value = PRINT_UBIFS_KEY_HASH[value]
elif key == 'default_compr':
elif key == "default_compr":
value = PRINT_UBIFS_COMPR[value]
if key in ubi_flags:
ubi_args[img_seq][volume][key] = value
for key, value in image.volumes[volume].vol_rec:
if key == 'name':
value = value.rstrip('\x00')
if key == "name":
value = value.rstrip("\x00")
if key in ubi_flags:
ubi_args[img_seq][volume][key] = value
ubi_args[img_seq][volume]['version'] = image.version
ubi_args[img_seq][volume]['vid_hdr_offset'] = image.vid_hdr_offset
ubi_args[img_seq][volume]['sub_page_size'] = ubi_args[img_seq][volume]['vid_hdr_offset']
ubi_args[img_seq][volume]['sub_page_size'] = ubi_args[img_seq][volume]['vid_hdr_offset']
ubi_args[img_seq][volume]['image_seq'] = image.image_seq
ubi_args[img_seq][volume]['peb_size'] = ubi.peb_size
ubi_args[img_seq][volume]['vol_id'] = image.volumes[volume].vol_id
ubi_params[img_seq][volume] = {'flags': ubi_flags,
'args': ubi_args[img_seq][volume],
'ini': ini_params[img_seq][volume]}
ubi_args[img_seq][volume]["version"] = image.version
ubi_args[img_seq][volume]["vid_hdr_offset"] = image.vid_hdr_offset
ubi_args[img_seq][volume]["sub_page_size"] = ubi_args[img_seq][volume][
"vid_hdr_offset"
]
ubi_args[img_seq][volume]["sub_page_size"] = ubi_args[img_seq][volume][
"vid_hdr_offset"
]
ubi_args[img_seq][volume]["image_seq"] = image.image_seq
ubi_args[img_seq][volume]["peb_size"] = ubi.peb_size
ubi_args[img_seq][volume]["vol_id"] = image.volumes[volume].vol_id
ubi_params[img_seq][volume] = {
"flags": ubi_flags,
"args": ubi_args[img_seq][volume],
"ini": ini_params[img_seq][volume],
}
return ubi_params

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import re
from ubi.volume import get_volumes
from ubi.block import sort, get_blocks_in_list, extract_blocks
@@ -16,7 +15,7 @@ class ubi:
self._blocks = extract_blocks(self)
self._block_count = len(self.blocks)
if self._block_count <= 0:
raise Exception('No blocks found.')
raise Exception("No blocks found.")
layout_list, data_list, int_vol_list, unknown_list = sort.by_type(
self.blocks)
self._layout_blocks_list = layout_list
@@ -28,7 +27,8 @@ class ubi:
self._leb_size = self.file.block_size - arbitrary_block.ec_hdr.data_offset
layout_pairs = layout.group_pairs(self.blocks, self.layout_blocks_list)
layout_infos = layout.associate_blocks(
self.blocks, layout_pairs, self.first_peb_num)
self.blocks, layout_pairs, self.first_peb_num
)
self._images = []
for i in range(0, len(layout_infos)):
self._images.append(image(self.blocks, layout_infos[i]))
@@ -96,14 +96,14 @@ class ubi:
blocks = property(_get_blocks)
def display(self, tab=''):
def display(self, tab=""):
display.ubi(self, tab)
def get_peb_size(path):
file_offset = 0
offsets = []
f = open(path, 'rb')
f = open(path, "rb")
f.seek(0, 2)
file_size = f.tell() + 1
f.seek(0)
@@ -125,7 +125,7 @@ def get_peb_size(path):
for i in range(0, len(offsets)):
try:
diff = offsets[i] - offsets[i - 1]
except:
except BaseException:
diff = offsets[i]
if diff not in occurances:

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import re
from ubi import display
from ubi.defines import *
@@ -18,7 +17,11 @@ class description(object):
self.ec_hdr = extract_ec_hdr(block_buf[0:UBI_EC_HDR_SZ])
if not self.ec_hdr.errors:
self.vid_hdr = extract_vid_hdr(
block_buf[self.ec_hdr.vid_hdr_offset:self.ec_hdr.vid_hdr_offset + UBI_VID_HDR_SZ])
block_buf[
self.ec_hdr.vid_hdr_offset: self.ec_hdr.vid_hdr_offset
+ UBI_VID_HDR_SZ
]
)
self.is_internal_vol = self.vid_hdr.vol_id >= UBI_INTERNAL_VOL_START
if self.vid_hdr.vol_id >= UBI_INTERNAL_VOL_START:
self.vtbl_recs = extract_vtbl_rec(
@@ -29,9 +32,9 @@ class description(object):
return
def __repr__(self):
return 'Block: PEB# %s: LEB# %s' % (self.peb_num, self.leb_num)
return "Block: PEB# %s: LEB# %s" % (self.peb_num, self.leb_num)
def display(self, tab=''):
def display(self, tab=""):
display.block(self, tab)
@@ -45,7 +48,10 @@ def extract_blocks(ubi):
ubi.file.seek(ubi.file.start_offset)
peb_count = 0
cur_offset = 0
for i in range(ubi.file.start_offset, ubi.file.end_offset, ubi.file.block_size):
for i in range(
ubi.file.start_offset,
ubi.file.end_offset,
ubi.file.block_size):
buf = ubi.file.read(ubi.file.block_size)
if buf.startswith(UBI_EC_HDR_MAGIC):
blk = description(buf)

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubi.block import sort

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
def list_by_list(blist, slist):
slist_blocks = []
for block in blist:
@@ -24,11 +23,11 @@ def by_range(blocks, block_range):
def by_leb(blocks):
slist_len = len(blocks)
slist = ['x'] * slist_len
slist = ["x"] * slist_len
for block in blocks:
if blocks[block].leb_num >= slist_len:
add_elements = blocks[block].leb_num - slist_len + 1
slist += ['x'] * add_elements
slist += ["x"] * add_elements
slist_len = len(slist)
slist[blocks[block].leb_num] = block
@@ -78,7 +77,4 @@ def by_type(blocks, slist=None):
else:
unknown.append(i)
return (layout,
data,
int_vol,
unknown)
return (layout, data, int_vol, unknown)

View File

@@ -1,63 +1,64 @@
#!/usr/bin/python
import struct
UBI_CRC32_INIT = 4294967295
UBI_MAX_VOLUMES = 128
UBI_INTERNAL_VOL_START = 2147479551
UBI_EC_HDR_MAGIC = 'UBI#'
EC_HDR_FORMAT = '>4sB3sQIII32sI'
EC_HDR_FIELDS = ['magic',
'version',
'padding',
'ec',
'vid_hdr_offset',
'data_offset',
'image_seq',
'padding2',
'hdr_crc']
UBI_EC_HDR_MAGIC = "UBI#"
EC_HDR_FORMAT = ">4sB3sQIII32sI"
EC_HDR_FIELDS = [
"magic",
"version",
"padding",
"ec",
"vid_hdr_offset",
"data_offset",
"image_seq",
"padding2",
"hdr_crc",
]
UBI_EC_HDR_SZ = struct.calcsize(EC_HDR_FORMAT)
UBI_VID_HDR_MAGIC = 'UBI!'
VID_HDR_FORMAT = '>4sBBBBII4sIIII4sQ12sI'
VID_HDR_FIELDS = ['magic',
'version',
'vol_type',
'copy_flag',
'compat',
'vol_id',
'lnum',
'padding',
'data_size',
'used_ebs',
'data_pad',
'data_crc',
'padding2',
'sqnum',
'padding3',
'hdr_crc']
UBI_VID_HDR_MAGIC = "UBI!"
VID_HDR_FORMAT = ">4sBBBBII4sIIII4sQ12sI"
VID_HDR_FIELDS = [
"magic",
"version",
"vol_type",
"copy_flag",
"compat",
"vol_id",
"lnum",
"padding",
"data_size",
"used_ebs",
"data_pad",
"data_crc",
"padding2",
"sqnum",
"padding3",
"hdr_crc",
]
UBI_VID_HDR_SZ = struct.calcsize(VID_HDR_FORMAT)
VTBL_REC_FORMAT = '>IIIBBH128sB23sI'
VTBL_REC_FIELDS = ['reserved_pebs',
'alignment',
'data_pad',
'vol_type',
'upd_marker',
'name_len',
'name',
'flags',
'padding',
'crc']
VTBL_REC_FORMAT = ">IIIBBH128sB23sI"
VTBL_REC_FIELDS = [
"reserved_pebs",
"alignment",
"data_pad",
"vol_type",
"upd_marker",
"name_len",
"name",
"flags",
"padding",
"crc",
]
UBI_VTBL_REC_SZ = struct.calcsize(VTBL_REC_FORMAT)
UBI_VID_DYNAMIC = 1
UBI_VID_STATIC = 2
PRINT_VOL_TYPE_LIST = [0, 'dynamic', 'static']
PRINT_VOL_TYPE_LIST = [0, "dynamic", "static"]
UBI_VTBL_AUTORESIZE_FLG = 1
UBI_COMPAT_DELETE = 1
UBI_COMPAT_RO = 2
UBI_COMPAT_PRESERVE = 4
UBI_COMPAT_REJECT = 5
PRINT_COMPAT_LIST = [0,
'Delete',
'Read Only',
0,
'Preserve',
'Reject']
PRINT_COMPAT_LIST = [0, "Delete", "Read Only", 0, "Preserve", "Reject"]
FILE_CHUNK_SZ = 5242880

View File

@@ -1,109 +1,111 @@
#!/usr/bin/python
from ubi.defines import PRINT_COMPAT_LIST, PRINT_VOL_TYPE_LIST, UBI_VTBL_AUTORESIZE_FLG
def ubi(ubi, tab=''):
print(('%sUBI File' % tab))
print(('%s---------------------' % tab))
print(('\t%sMin I/O: %s' % (tab, ubi.min_io_size)))
print(('\t%sLEB Size: %s' % (tab, ubi.leb_size)))
print(('\t%sPEB Size: %s' % (tab, ubi.peb_size)))
print(('\t%sTotal Block Count: %s' % (tab, ubi.block_count)))
print(('\t%sData Block Count: %s' % (tab, len(ubi.data_blocks_list))))
print(('\t%sLayout Block Count: %s' % (tab, len(ubi.layout_blocks_list))))
print(('\t%sInternal Volume Block Count: %s' % (tab, len(ubi.int_vol_blocks_list))))
print(('\t%sUnknown Block Count: %s' % (tab, len(ubi.unknown_blocks_list))))
print(('\t%sFirst UBI PEB Number: %s' % (tab, ubi.first_peb_num)))
def ubi(ubi, tab=""):
print(("%sUBI File" % tab))
print(("%s---------------------" % tab))
print(("\t%sMin I/O: %s" % (tab, ubi.min_io_size)))
print(("\t%sLEB Size: %s" % (tab, ubi.leb_size)))
print(("\t%sPEB Size: %s" % (tab, ubi.peb_size)))
print(("\t%sTotal Block Count: %s" % (tab, ubi.block_count)))
print(("\t%sData Block Count: %s" % (tab, len(ubi.data_blocks_list))))
print(("\t%sLayout Block Count: %s" % (tab, len(ubi.layout_blocks_list))))
print(("\t%sInternal Volume Block Count: %s" %
(tab, len(ubi.int_vol_blocks_list))))
print(("\t%sUnknown Block Count: %s" %
(tab, len(ubi.unknown_blocks_list))))
print(("\t%sFirst UBI PEB Number: %s" % (tab, ubi.first_peb_num)))
def image(image, tab=''):
print(('%s%s' % (tab, image)))
print(('%s---------------------' % tab))
print(('\t%sImage Sequence Num: %s' % (tab, image.image_seq)))
def image(image, tab=""):
print(("%s%s" % (tab, image)))
print(("%s---------------------" % tab))
print(("\t%sImage Sequence Num: %s" % (tab, image.image_seq)))
for volume in image.volumes:
print(('\t%sVolume Name:%s' % (tab, volume)))
print(("\t%sVolume Name:%s" % (tab, volume)))
print(('\t%sPEB Range: %s - %s' % (tab, image.peb_range[0], image.peb_range[1])))
print(("\t%sPEB Range: %s - %s" %
(tab, image.peb_range[0], image.peb_range[1])))
def volume(volume, tab=''):
print(('%s%s' % (tab, volume)))
print(('%s---------------------' % tab))
print(('\t%sVol ID: %s' % (tab, volume.vol_id)))
print(('\t%sName: %s' % (tab, volume.name)))
print(('\t%sBlock Count: %s' % (tab, volume.block_count)))
print('\n')
print(('\t%sVolume Record' % tab))
print(('\t%s---------------------' % tab))
vol_rec(volume.vol_rec, '\t\t%s' % tab)
print('\n')
def volume(volume, tab=""):
print(("%s%s" % (tab, volume)))
print(("%s---------------------" % tab))
print(("\t%sVol ID: %s" % (tab, volume.vol_id)))
print(("\t%sName: %s" % (tab, volume.name)))
print(("\t%sBlock Count: %s" % (tab, volume.block_count)))
print("\n")
print(("\t%sVolume Record" % tab))
print(("\t%s---------------------" % tab))
vol_rec(volume.vol_rec, "\t\t%s" % tab)
print("\n")
def block(block, tab='\t'):
print(('%s%s' % (tab, block)))
print(('%s---------------------' % tab))
print(('\t%sFile Offset: %s' % (tab, block.file_offset)))
print(('\t%sPEB #: %s' % (tab, block.peb_num)))
print(('\t%sLEB #: %s' % (tab, block.leb_num)))
print(('\t%sBlock Size: %s' % (tab, block.size)))
print(('\t%sInternal Volume: %s' % (tab, block.is_internal_vol)))
print(('\t%sIs Volume Table: %s' % (tab, block.is_vtbl)))
print(('\t%sIs Valid: %s' % (tab, block.is_valid)))
def block(block, tab="\t"):
print(("%s%s" % (tab, block)))
print(("%s---------------------" % tab))
print(("\t%sFile Offset: %s" % (tab, block.file_offset)))
print(("\t%sPEB #: %s" % (tab, block.peb_num)))
print(("\t%sLEB #: %s" % (tab, block.leb_num)))
print(("\t%sBlock Size: %s" % (tab, block.size)))
print(("\t%sInternal Volume: %s" % (tab, block.is_internal_vol)))
print(("\t%sIs Volume Table: %s" % (tab, block.is_vtbl)))
print(("\t%sIs Valid: %s" % (tab, block.is_valid)))
if not block.ec_hdr.errors:
print('\n')
print(('\t%sErase Count Header' % tab))
print(('\t%s---------------------' % tab))
ec_hdr(block.ec_hdr, '\t\t%s' % tab)
print("\n")
print(("\t%sErase Count Header" % tab))
print(("\t%s---------------------" % tab))
ec_hdr(block.ec_hdr, "\t\t%s" % tab)
if block.vid_hdr and not block.vid_hdr.errors:
print('\n')
print(('\t%sVID Header Header' % tab))
print(('\t%s---------------------' % tab))
vid_hdr(block.vid_hdr, '\t\t%s' % tab)
print("\n")
print(("\t%sVID Header Header" % tab))
print(("\t%s---------------------" % tab))
vid_hdr(block.vid_hdr, "\t\t%s" % tab)
if block.vtbl_recs:
print('\n')
print(('\t%sVolume Records' % tab))
print(('\t%s---------------------' % tab))
print("\n")
print(("\t%sVolume Records" % tab))
print(("\t%s---------------------" % tab))
for vol in block.vtbl_recs:
vol_rec(vol, '\t\t%s' % tab)
vol_rec(vol, "\t\t%s" % tab)
print('\n')
print("\n")
def ec_hdr(ec_hdr, tab=''):
def ec_hdr(ec_hdr, tab=""):
for key, value in ec_hdr:
if key == 'errors':
value = ','.join(value)
print(('%s%s: %r' % (tab, key, value)))
if key == "errors":
value = ",".join(value)
print(("%s%s: %r" % (tab, key, value)))
def vid_hdr(vid_hdr, tab=''):
def vid_hdr(vid_hdr, tab=""):
for key, value in vid_hdr:
if key == 'errors':
value = ','.join(value)
elif key == 'compat':
if key == "errors":
value = ",".join(value)
elif key == "compat":
if value in PRINT_COMPAT_LIST:
value = PRINT_COMPAT_LIST[value]
else:
value = -1
elif key == 'vol_type':
elif key == "vol_type":
if value < len(PRINT_VOL_TYPE_LIST):
value = PRINT_VOL_TYPE_LIST[value]
else:
value = -1
print(('%s%s: %s' % (tab, key, value)))
print(("%s%s: %s" % (tab, key, value)))
def vol_rec(vol_rec, tab=''):
def vol_rec(vol_rec, tab=""):
for key, value in vol_rec:
if key == 'errors':
value = ','.join(value)
elif key == 'vol_type':
if key == "errors":
value = ",".join(value)
elif key == "vol_type":
if value < len(PRINT_VOL_TYPE_LIST):
value = PRINT_VOL_TYPE_LIST[value]
else:
value = -1
elif key == 'flags' and value == UBI_VTBL_AUTORESIZE_FLG:
value = 'autoresize'
elif key == 'name':
value = value.strip('\x00')
print(('%s%s: %s' % (tab, key, value)))
elif key == "flags" and value == UBI_VTBL_AUTORESIZE_FLG:
value = "autoresize"
elif key == "name":
value = value.strip("\x00")
print(("%s%s: %s" % (tab, key, value)))

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import struct
from ubi.defines import *
from ubi.headers import errors
@@ -12,14 +11,14 @@ class ec_hdr(object):
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, "errors", [])
def __repr__(self):
return 'Error Count Header'
return "Error Count Header"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -31,15 +30,15 @@ class vid_hdr(object):
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, "errors", [])
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
def __repr__(self):
return 'VID Header'
return "VID Header"
class vtbl_rec(object):
@@ -50,15 +49,15 @@ class vtbl_rec(object):
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, 'rec_index', -1)
setattr(self, "errors", [])
setattr(self, "rec_index", -1)
def __repr__(self):
return 'Volume Table Record: %s' % getattr(self, 'name')
return "Volume Table Record: %s" % getattr(self, "name")
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -79,10 +78,10 @@ def extract_vid_hdr(buf):
def extract_vtbl_rec(buf):
data_buf = buf
vtbl_recs = []
vtbl_rec_ret = ''
vtbl_rec_ret = ""
for i in range(0, UBI_MAX_VOLUMES):
offset = i * UBI_VTBL_REC_SZ
vtbl_rec_buf = data_buf[offset:offset + UBI_VTBL_REC_SZ]
vtbl_rec_buf = data_buf[offset: offset + UBI_VTBL_REC_SZ]
if len(vtbl_rec_buf) == UBI_VTBL_REC_SZ:
vtbl_rec_ret = vtbl_rec(vtbl_rec_buf)
errors.vtbl_rec(vtbl_rec_ret, vtbl_rec_buf)

View File

@@ -1,29 +1,28 @@
#!/usr/bin/python
from zlib import crc32
from ubi.defines import *
def ec_hdr(ec_hdr, buf):
if ec_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
ec_hdr.errors.append('crc')
ec_hdr.errors.append("crc")
return ec_hdr
def vid_hdr(vid_hdr, buf):
vid_hdr.errors = []
if vid_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
vid_hdr.errors.append('crc')
vid_hdr.errors.append("crc")
return vid_hdr
def vtbl_rec(vtbl_rec, buf):
likely_vtbl = True
if vtbl_rec.name_len != len(vtbl_rec.name.strip('\x00')):
if vtbl_rec.name_len != len(vtbl_rec.name.strip("\x00")):
likely_vtbl = False
elif vtbl_rec.vol_type not in (1, 2):
likely_vtbl = False
if vtbl_rec.crc != ~crc32(buf[:-4]) & 4294967295:
vtbl_rec.errors.append('crc')
vtbl_rec.errors.append("crc")
if not likely_vtbl:
vtbl_rec.errors = ['False']
vtbl_rec.errors = ["False"]
return vtbl_rec

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubi import display
from ubi.volume import get_volumes
from ubi.block import get_blocks_in_list
@@ -15,10 +14,12 @@ class description(object):
self._volumes = get_volumes(blocks, layout_info)
def __repr__(self):
return 'Image: %s' % self.image_seq
return "Image: %s" % self.image_seq
def get_blocks(self, blocks):
return get_blocks_in_list(blocks, list(range(self._start_peb, self._end_peb + 1)))
return get_blocks_in_list(
blocks, list(range(self._start_peb, self._end_peb + 1))
)
def _get_peb_range(self):
return [self._start_peb, self._end_peb]
@@ -35,5 +36,5 @@ class description(object):
volumes = property(_get_volumes)
def display(self, tab=''):
def display(self, tab=""):
display.image(self, tab)

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubi import display
from ubi.block import sort, get_blocks_in_list
@@ -12,7 +11,7 @@ class description(object):
self._block_list = block_list
def __repr__(self):
return 'Volume: %s' % self.name
return "Volume: %s" % self.name
def _get_name(self):
return self._name
@@ -42,15 +41,15 @@ class description(object):
def get_blocks(self, blocks):
return get_blocks_in_list(blocks, self._block_list)
def display(self, tab=''):
def display(self, tab=""):
display.volume(self, tab)
def reader(self, ubi):
last_leb = 0
for block in sort.by_leb(self.get_blocks(ubi.blocks)):
if block == 'x':
if block == "x":
last_leb += 1
yield '\xff' * ubi.leb_size
yield "\xff" * ubi.leb_size
else:
last_leb += 1
yield ubi.file.read_block_data(ubi.blocks[block])
@@ -60,10 +59,11 @@ def get_volumes(blocks, layout_info):
volumes = {}
vol_blocks_lists = sort.by_vol_id(blocks, layout_info[2])
for vol_rec in blocks[layout_info[0]].vtbl_recs:
vol_name = vol_rec.name.strip('\x00')
vol_name = vol_rec.name.strip("\x00")
if vol_rec.rec_index not in vol_blocks_lists:
vol_blocks_lists[vol_rec.rec_index] = []
volumes[vol_name] = description(
vol_rec.rec_index, vol_rec, vol_blocks_lists[vol_rec.rec_index])
vol_rec.rec_index, vol_rec, vol_blocks_lists[vol_rec.rec_index]
)
return volumes

View File

@@ -1,34 +1,55 @@
#!/usr/bin/python
import os
import sys
try:
import argparse
except:
except BaseException:
import argparse_neo
from ubi import ubi, get_peb_size
from ubifs import ubifs
from ubi_io import ubi_file, leb_virtual_file
from ui.common import extract_files, output_dir
if __name__ == '__main__':
description = 'Extract contents of UBI image.'
usage = 'ubi_extract_files.py [options] filepath'
if __name__ == "__main__":
description = "Extract contents of UBI image."
usage = "ubi_extract_files.py [options] filepath"
try:
parser = argparse.ArgumentParser(usage=usage, description=description)
except:
except BaseException:
parser = argparse_neo.ArgumentParser(
usage=usage, description=description)
parser.add_argument('-l', '--log-file', dest='logpath',
help='Log output to file output/LOGPATH. (default: ubifs_output.log)')
parser.add_argument('-k', '--keep-permissions', action='store_true', dest='permissions',
help='Maintain file permissions, requires running as root. (default: False)')
parser.add_argument('-q', '--quiet', action='store_true', dest='quiet',
help='Suppress warnings and non-fatal errors. (default: False)')
parser.add_argument('-p', '--peb-size', type=int,
dest='block_size', help='Specify PEB size.')
parser.add_argument('-o', '--output-dir', dest='output_path',
help='Specify output directory path.')
parser.add_argument('filepath', help='File to extract contents of.')
parser.add_argument(
"-l",
"--log-file",
dest="logpath",
help="Log output to file output/LOGPATH. (default: ubifs_output.log)",
)
parser.add_argument(
"-k",
"--keep-permissions",
action="store_true",
dest="permissions",
help="Maintain file permissions, requires running as root. (default: False)",
)
parser.add_argument(
"-q",
"--quiet",
action="store_true",
dest="quiet",
help="Suppress warnings and non-fatal errors. (default: False)",
)
parser.add_argument(
"-p",
"--peb-size",
type=int,
dest="block_size",
help="Specify PEB size.")
parser.add_argument(
"-o",
"--output-dir",
dest="output_path",
help="Specify output directory path.")
parser.add_argument("filepath", help="File to extract contents of.")
if len(sys.argv) == 1:
parser.print_help()
sys.exit()
@@ -65,13 +86,14 @@ if __name__ == '__main__':
os.makedirs(vol_out_path)
elif os.listdir(vol_out_path):
parser.error(
'Volume output directory is not empty. %s' % vol_out_path)
"Volume output directory is not empty. %s" %
vol_out_path)
ufsfile = leb_virtual_file(uubi, image.volumes[volume])
uubifs = ubifs(ufsfile)
uubifs.log.log_file = log_file
uubifs.log.log_to_file = log_to_file
uubifs.log.quiet = quiet
print(('Writing to: %s' % vol_out_path))
print(("Writing to: %s" % vol_out_path))
extract_files(uubifs, vol_out_path, perms)
sys.exit(0)

View File

@@ -1,11 +1,10 @@
#!/usr/bin/python
from ubi.block import sort
class ubi_file(object):
def __init__(self, path, block_size, start_offset=0, end_offset=None):
self._fhandle = open(path, 'rb')
self._fhandle = open(path, "rb")
self._start_offset = start_offset
if end_offset:
self._end_offset = end_offset
@@ -14,7 +13,7 @@ class ubi_file(object):
self._end_offset = self.tell()
self._block_size = block_size
if start_offset >= self._end_offset:
raise Exception('Start offset larger than file size!')
raise Exception("Start offset larger than file size!")
self._fhandle.seek(self._start_offset)
def _set_start(self, i):
@@ -69,7 +68,8 @@ class ubi_file(object):
def read_block_data(self, block):
self.seek(block.file_offset + block.ec_hdr.data_offset)
buf = self._fhandle.read(
block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad)
block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad
)
return buf
@@ -82,22 +82,22 @@ class leb_virtual_file:
self._seek = 0
self.leb_data_size = len(self._blocks) * self._ubi.leb_size
self._last_leb = -1
self._last_buf = ''
self._last_buf = ""
def read(self, i):
buf = ''
buf = ""
leb = int(self.tell() / self._ubi.leb_size)
offset = self.tell() % self._ubi.leb_size
if leb == self._last_leb:
self.seek(self.tell() + i)
return self._last_buf[offset:offset + i]
return self._last_buf[offset: offset + i]
else:
buf = self._ubi.file.read_block_data(
self._ubi.blocks[self._blocks[leb]])
self._last_buf = buf
self._last_leb = leb
self.seek(self.tell() + i)
return buf[offset:offset + i]
return buf[offset: offset + i]
def reset(self):
self.seek(0)
@@ -113,7 +113,7 @@ class leb_virtual_file:
for block in self._blocks:
while 0 != self._ubi.blocks[block].leb_num - last_leb:
last_leb += 1
yield '\xff' * self._ubi.leb_size
yield "\xff" * self._ubi.leb_size
last_leb += 1
yield self._ubi.file.read_block_data(self._ubi.blocks[block])

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import re
import struct
from ubifs.defines import *
@@ -50,7 +49,7 @@ class ubifs:
def get_leb_size(path):
f = open(path, 'rb')
f = open(path, "rb")
f.seek(0, 2)
file_size = f.tell() + 1
f.seek(0)
@@ -59,7 +58,7 @@ def get_leb_size(path):
buf = f.read(FILE_CHUNK_SZ)
for m in re.finditer(UBIFS_NODE_MAGIC, buf):
start = m.start()
chdr = nodes.common_hdr(buf[start:start + UBIFS_COMMON_HDR_SZ])
chdr = nodes.common_hdr(buf[start: start + UBIFS_COMMON_HDR_SZ])
if chdr and chdr.node_type == UBIFS_SB_NODE:
sb_start = start + UBIFS_COMMON_HDR_SZ
sb_end = sb_start + UBIFS_SB_NODE_SZ

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
import struct
UBIFS_NODE_MAGIC = '1\x18\x10\x06'
UBIFS_NODE_MAGIC = "1\x18\x10\x06"
UBIFS_CRC32_INIT = 4294967295
UBIFS_MIN_COMPR_LEN = 128
UBIFS_MIN_COMPRESS_DIFF = 64
@@ -10,7 +10,7 @@ UBIFS_MAX_NLEN = 255
UBIFS_MAX_JHEADS = 1
UBIFS_BLOCK_SIZE = 4096
UBIFS_BLOCK_SHIFT = 12
UBIFS_PADDING_BYTE = '\xce'
UBIFS_PADDING_BYTE = "\xce"
UBIFS_MAX_KEY_LEN = 16
UBIFS_SK_LEN = 8
UBIFS_MIN_FANOUT = 3
@@ -37,7 +37,7 @@ UBIFS_ITYPE_SOCK = 6
UBIFS_ITYPES_CNT = 7
UBIFS_KEY_HASH_R5 = 0
UBIFS_KEY_HASH_TEST = 1
PRINT_UBIFS_KEY_HASH = ['r5', 'test']
PRINT_UBIFS_KEY_HASH = ["r5", "test"]
UBIFS_SIMPLE_KEY_FMT = 0
UBIFS_S_KEY_BLOCK_BITS = 29
UBIFS_S_KEY_BLOCK_MASK = 536870911
@@ -64,7 +64,7 @@ UBIFS_COMPR_NONE = 0
UBIFS_COMPR_LZO = 1
UBIFS_COMPR_ZLIB = 2
UBIFS_COMPR_TYPES_CNT = 3
PRINT_UBIFS_COMPR = ['none', 'lzo', 'zlib']
PRINT_UBIFS_COMPR = ["none", "lzo", "zlib"]
UBIFS_INO_NODE = 0
UBIFS_DATA_NODE = 1
UBIFS_DENT_NODE = 2
@@ -86,136 +86,133 @@ UBIFS_IN_NODE_GROUP = 1
UBIFS_LAST_OF_NODE_GROUP = 2
UBIFS_FLG_BIGLPT = 2
UBIFS_FLG_SPACE_FIXUP = 4
UBIFS_COMMON_HDR_FORMAT = '<IIQIBB2s'
UBIFS_COMMON_HDR_FIELDS = ['magic',
'crc',
'sqnum',
'len',
'node_type',
'group_type',
'padding']
UBIFS_COMMON_HDR_FORMAT = "<IIQIBB2s"
UBIFS_COMMON_HDR_FIELDS = [
"magic",
"crc",
"sqnum",
"len",
"node_type",
"group_type",
"padding",
]
UBIFS_COMMON_HDR_SZ = struct.calcsize(UBIFS_COMMON_HDR_FORMAT)
UBIFS_KEY_OFFSET = UBIFS_COMMON_HDR_SZ
UBIFS_DEV_DESC_FORMAT = '<IQ'
UBIFS_DEV_DESC_FIELDS = ['new', 'huge']
UBIFS_DEV_DESC_FORMAT = "<IQ"
UBIFS_DEV_DESC_FIELDS = ["new", "huge"]
UBIFS_DEV_DESC_SZ = struct.calcsize(UBIFS_DEV_DESC_FORMAT)
UBIFS_INO_NODE_FORMAT = '<%ssQQQQQIIIIIIIIIII4sIH26s' % UBIFS_MAX_KEY_LEN
UBIFS_INO_NODE_FIELDS = ['key',
'creat_sqnum',
'size',
'atime_sec',
'ctime_sec',
'mtime_sec',
'atime_nsec',
'ctime_nsec',
'mtime_nsec',
'nlink',
'uid',
'gid',
'mode',
'flags',
'data_len',
'xattr_cnt',
'xattr_size',
'padding1',
'xattr_names',
'compr_type',
'padding2']
UBIFS_INO_NODE_FORMAT = "<%ssQQQQQIIIIIIIIIII4sIH26s" % UBIFS_MAX_KEY_LEN
UBIFS_INO_NODE_FIELDS = [
"key",
"creat_sqnum",
"size",
"atime_sec",
"ctime_sec",
"mtime_sec",
"atime_nsec",
"ctime_nsec",
"mtime_nsec",
"nlink",
"uid",
"gid",
"mode",
"flags",
"data_len",
"xattr_cnt",
"xattr_size",
"padding1",
"xattr_names",
"compr_type",
"padding2",
]
UBIFS_INO_NODE_SZ = struct.calcsize(UBIFS_INO_NODE_FORMAT)
UBIFS_DENT_NODE_FORMAT = '<%ssQBBH4s' % UBIFS_MAX_KEY_LEN
UBIFS_DENT_NODE_FIELDS = ['key',
'inum',
'padding1',
'type',
'nlen',
'padding2']
UBIFS_DENT_NODE_FORMAT = "<%ssQBBH4s" % UBIFS_MAX_KEY_LEN
UBIFS_DENT_NODE_FIELDS = [
"key",
"inum",
"padding1",
"type",
"nlen",
"padding2"]
UBIFS_DENT_NODE_SZ = struct.calcsize(UBIFS_DENT_NODE_FORMAT)
UBIFS_DATA_NODE_FORMAT = '<%ssIH2s' % UBIFS_MAX_KEY_LEN
UBIFS_DATA_NODE_FIELDS = ['key',
'size',
'compr_type',
'padding']
UBIFS_DATA_NODE_FORMAT = "<%ssIH2s" % UBIFS_MAX_KEY_LEN
UBIFS_DATA_NODE_FIELDS = ["key", "size", "compr_type", "padding"]
UBIFS_DATA_NODE_SZ = struct.calcsize(UBIFS_DATA_NODE_FORMAT)
UBIFS_TRUN_NODE_FORMAT = '<I12sQQ'
UBIFS_TRUN_NODE_FIELDS = ['inum',
'padding',
'old_size',
'new_size']
UBIFS_TRUN_NODE_FORMAT = "<I12sQQ"
UBIFS_TRUN_NODE_FIELDS = ["inum", "padding", "old_size", "new_size"]
UBIFS_TRUN_NODE_SZ = struct.calcsize(UBIFS_TRUN_NODE_FORMAT)
UBIFS_PAD_NODE_FORMAT = '<I'
UBIFS_PAD_NODE_FIELDS = ['pad_len']
UBIFS_PAD_NODE_FORMAT = "<I"
UBIFS_PAD_NODE_FIELDS = ["pad_len"]
UBIFS_PAD_NODE_SZ = struct.calcsize(UBIFS_PAD_NODE_FORMAT)
UBIFS_SB_NODE_FORMAT = '<2sBBIIIIIQIIIIIIIH2sIIQI16sI3968s'
UBIFS_SB_NODE_FIELDS = ['padding',
'key_hash',
'key_fmt',
'flags',
'min_io_size',
'leb_size',
'leb_cnt',
'max_leb_cnt',
'max_bud_bytes',
'log_lebs',
'lpt_lebs',
'orph_lebs',
'jhead_cnt',
'fanout',
'lsave_cnt',
'fmt_version',
'default_compr',
'padding1',
'rp_uid',
'rp_gid',
'rp_size',
'time_gran',
'uuid',
'ro_compat_version',
'padding2']
UBIFS_SB_NODE_FORMAT = "<2sBBIIIIIQIIIIIIIH2sIIQI16sI3968s"
UBIFS_SB_NODE_FIELDS = [
"padding",
"key_hash",
"key_fmt",
"flags",
"min_io_size",
"leb_size",
"leb_cnt",
"max_leb_cnt",
"max_bud_bytes",
"log_lebs",
"lpt_lebs",
"orph_lebs",
"jhead_cnt",
"fanout",
"lsave_cnt",
"fmt_version",
"default_compr",
"padding1",
"rp_uid",
"rp_gid",
"rp_size",
"time_gran",
"uuid",
"ro_compat_version",
"padding2",
]
UBIFS_SB_NODE_SZ = struct.calcsize(UBIFS_SB_NODE_FORMAT)
UBIFS_MST_NODE_FORMAT = '<QQIIIIIIIIQQQQQQIIIIIIIIIIII344s'
UBIFS_MST_NODE_FIELDS = ['highest_inum',
'cmt_no',
'flags',
'log_lnum',
'root_lnum',
'root_offs',
'root_len',
'gc_lnum',
'ihead_lnum',
'ihead_offs',
'index_size',
'total_free',
'total_dirty',
'total_used',
'total_dead',
'total_dark',
'lpt_lnum',
'lpt_offs',
'nhead_lnum',
'nhead_offs',
'ltab_lnum',
'ltab_offs',
'lsave_lnum',
'lsave_offs',
'lscan_lnum',
'empty_lebs',
'idx_lebs',
'leb_cnt',
'padding']
UBIFS_MST_NODE_FORMAT = "<QQIIIIIIIIQQQQQQIIIIIIIIIIII344s"
UBIFS_MST_NODE_FIELDS = [
"highest_inum",
"cmt_no",
"flags",
"log_lnum",
"root_lnum",
"root_offs",
"root_len",
"gc_lnum",
"ihead_lnum",
"ihead_offs",
"index_size",
"total_free",
"total_dirty",
"total_used",
"total_dead",
"total_dark",
"lpt_lnum",
"lpt_offs",
"nhead_lnum",
"nhead_offs",
"ltab_lnum",
"ltab_offs",
"lsave_lnum",
"lsave_offs",
"lscan_lnum",
"empty_lebs",
"idx_lebs",
"leb_cnt",
"padding",
]
UBIFS_MST_NODE_SZ = struct.calcsize(UBIFS_MST_NODE_FORMAT)
UBIFS_REF_NODE_FORMAT = '<III28s'
UBIFS_REF_NODE_FIELDS = ['lnum',
'offs',
'jhead',
'padding']
UBIFS_REF_NODE_FORMAT = "<III28s"
UBIFS_REF_NODE_FIELDS = ["lnum", "offs", "jhead", "padding"]
UBIFS_REF_NODE_SZ = struct.calcsize(UBIFS_REF_NODE_FORMAT)
UBIFS_BRANCH_FORMAT = '<III%ss' % UBIFS_SK_LEN
UBIFS_BRANCH_FIELDS = ['lnum',
'offs',
'len',
'key']
UBIFS_BRANCH_FORMAT = "<III%ss" % UBIFS_SK_LEN
UBIFS_BRANCH_FIELDS = ["lnum", "offs", "len", "key"]
UBIFS_BRANCH_SZ = struct.calcsize(UBIFS_BRANCH_FORMAT)
UBIFS_IDX_NODE_FORMAT = '<HH'
UBIFS_IDX_NODE_FIELDS = ['child_cnt', 'level']
UBIFS_IDX_NODE_FORMAT = "<HH"
UBIFS_IDX_NODE_FIELDS = ["child_cnt", "level"]
UBIFS_IDX_NODE_SZ = struct.calcsize(UBIFS_IDX_NODE_FORMAT)
FILE_CHUNK_SZ = 5242880

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import os
import sys
import ui
@@ -8,18 +7,18 @@ class log:
def __init__(self):
self.log_to_file = False
self.log_file = 'ubifs_output.log'
self.log_file = "ubifs_output.log"
self.exit_on_except = False
self.quiet = False
def _out(self, s):
if not self.quiet:
if self.log_to_file:
with open(os.path.join(ui.common.output_dir, self.log_file), 'a') as f:
f.write('%s\n' % s)
with open(os.path.join(ui.common.output_dir, self.log_file), "a") as f:
f.write("%s\n" % s)
f.close()
else:
print(('%s' % s))
print(("%s" % s))
if self.exit_on_except:
sys.exit()
@@ -27,8 +26,8 @@ class log:
self._out(s)
def write_node(self, n):
buf = '%s\n' % n
buf = "%s\n" % n
for key, value in n:
buf += '\t%s: %s\n' % (key, value)
buf += "\t%s: %s\n" % (key, value)
self._out(buf)

View File

@@ -1,46 +1,38 @@
#!/usr/bin/python
from . import lzo
import struct
import zlib
from ubifs.defines import *
ino_types = ['file',
'dir',
'lnk',
'blk',
'chr',
'fifo',
'sock']
node_types = ['ino',
'data',
'dent',
'xent',
'trun',
'pad',
'sb',
'mst',
'ref',
'idx',
'cs',
'orph']
key_types = ['ino',
'data',
'dent',
'xent']
ino_types = ["file", "dir", "lnk", "blk", "chr", "fifo", "sock"]
node_types = [
"ino",
"data",
"dent",
"xent",
"trun",
"pad",
"sb",
"mst",
"ref",
"idx",
"cs",
"orph",
]
key_types = ["ino", "data", "dent", "xent"]
def parse_key(key):
hkey, lkey = struct.unpack('<II', key[0:UBIFS_SK_LEN])
hkey, lkey = struct.unpack("<II", key[0:UBIFS_SK_LEN])
ino_num = hkey & UBIFS_S_KEY_HASH_MASK
key_type = lkey >> UBIFS_S_KEY_BLOCK_BITS
khash = lkey
return {'type': key_type,
'ino_num': ino_num,
'khash': khash}
return {"type": key_type, "ino_num": ino_num, "khash": khash}
def decompress(ctype, unc_len, data):
if ctype == UBIFS_COMPR_LZO:
return lzo.decompress(''.join(('\xf0', struct.pack('>I', unc_len), data)))
return lzo.decompress(
"".join(("\xf0", struct.pack(">I", unc_len), data)))
elif ctype == UBIFS_COMPR_ZLIB:
return zlib.decompress(data, -11)
else:

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
import struct
from ubifs.defines import *
from ubifs.misc import parse_key
@@ -8,18 +7,18 @@ class common_hdr(object):
def __init__(self, buf):
fields = dict(list(zip(UBIFS_COMMON_HDR_FIELDS,
struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf))))
struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf))))
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'errors', [])
setattr(self, "errors", [])
def __repr__(self):
return 'UBIFS Common Header'
return "UBIFS Common Header"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -27,16 +26,17 @@ class sb_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf))))
list(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
def __repr__(self):
return 'UBIFS Super Block Node'
return "UBIFS Super Block Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -44,16 +44,17 @@ class mst_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf))))
list(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
def __repr__(self):
return 'UBIFS Master Block Node'
return "UBIFS Master Block Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -61,21 +62,24 @@ class dent_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf))))
list(
zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf))
)
)
for key in fields:
if key == 'key':
if key == "key":
setattr(self, key, parse_key(fields[key]))
else:
setattr(self, key, fields[key])
setattr(self, 'name', '')
setattr(self, "name", "")
def __repr__(self):
return 'UBIFS Directory Entry Node'
return "UBIFS Directory Entry Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -83,22 +87,25 @@ class data_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf))))
list(
zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf))
)
)
for key in fields:
if key == 'key':
if key == "key":
setattr(self, key, parse_key(fields[key]))
else:
setattr(self, key, fields[key])
setattr(self, 'offset', 0)
setattr(self, 'compr_len', 0)
setattr(self, "offset", 0)
setattr(self, "compr_len", 0)
def __repr__(self):
return 'UBIFS Data Node'
return "UBIFS Data Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -106,18 +113,19 @@ class idx_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf))))
list(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
setattr(self, 'branches', [])
setattr(self, "branches", [])
def __repr__(self):
return 'UBIFS Index Node'
return "UBIFS Index Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -125,21 +133,22 @@ class ino_node(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf))))
list(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf)))
)
for key in fields:
if key == 'key':
if key == "key":
setattr(self, key, parse_key(fields[key]))
else:
setattr(self, key, fields[key])
setattr(self, 'data', '')
setattr(self, "data", "")
def __repr__(self):
return 'UBIFS Ino Node'
return "UBIFS Ino Node"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))
@@ -147,14 +156,15 @@ class branch(object):
def __init__(self, buf):
fields = dict(
list(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf))))
list(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf)))
)
for key in fields:
setattr(self, key, fields[key])
def __repr__(self):
return 'UBIFS Branch'
return "UBIFS Branch"
def __iter__(self):
for key in dir(self):
if not key.startswith('_'):
if not key.startswith("_"):
yield (key, getattr(self, key))

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubifs import nodes
from ubifs.defines import *
@@ -28,7 +27,7 @@ def sb_node(ubifs, offset=0):
def dent_node(ubifs, lnum, offset=0):
ubifs.file.seek(ubifs.leb_size * lnum + offset)
den = nodes.dent_node(ubifs.file.read(UBIFS_DENT_NODE_SZ))
den.name = '%s' % ubifs.file.read(den.nlen)
den.name = "%s" % ubifs.file.read(den.nlen)
return den

View File

@@ -1,11 +1,10 @@
#!/usr/bin/python
import os
import struct
from ubifs.defines import *
from ubifs.misc import decompress
def dents(ubifs, inodes, dent_node, path='', perms=False):
def dents(ubifs, inodes, dent_node, path="", perms=False):
inode = inodes[dent_node.inum]
dent_path = os.path.join(path, dent_node.name)
if dent_node.type == UBIFS_ITYPE_DIR:
@@ -15,41 +14,42 @@ def dents(ubifs, inodes, dent_node, path='', perms=False):
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('DIR Fail: %s' % e)
ubifs.log.write("DIR Fail: %s" % e)
if 'dent' in inode:
for dnode in inode['dent']:
if "dent" in inode:
for dnode in inode["dent"]:
dents(ubifs, inodes, dnode, dent_path, perms)
elif dent_node.type == UBIFS_ITYPE_REG:
try:
if inode['ino'].nlink > 1:
if 'hlink' not in inode:
inode['hlink'] = dent_path
if inode["ino"].nlink > 1:
if "hlink" not in inode:
inode["hlink"] = dent_path
buf = process_reg_file(ubifs, inode, dent_path)
write_reg_file(dent_path, buf)
else:
os.link(inode['hlink'], dent_path)
os.link(inode["hlink"], dent_path)
else:
buf = process_reg_file(ubifs, inode, dent_path)
write_reg_file(dent_path, buf)
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('FILE Fail: %s' % e)
ubifs.log.write("FILE Fail: %s" % e)
elif dent_node.type == UBIFS_ITYPE_LNK:
try:
os.symlink('%s' % inode['ino'].data, dent_path)
os.symlink("%s" % inode["ino"].data, dent_path)
except Exception as e:
ubifs.log.write('SYMLINK Fail: %s : %s' %
(inode['ino'].data, dent_path))
ubifs.log.write(
"SYMLINK Fail: %s : %s" %
(inode["ino"].data, dent_path))
elif dent_node.type in [UBIFS_ITYPE_BLK, UBIFS_ITYPE_CHR]:
try:
dev = struct.unpack('<II', inode['ino'].data)[0]
dev = struct.unpack("<II", inode["ino"].data)[0]
if perms:
os.mknod(dent_path, inode['ino'].mode, dev)
os.mknod(dent_path, inode["ino"].mode, dev)
if perms:
set_file_perms(path, inode)
else:
@@ -57,60 +57,60 @@ def dents(ubifs, inodes, dent_node, path='', perms=False):
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('DEV Fail: %s : %s' % (dent_path, e))
ubifs.log.write("DEV Fail: %s : %s" % (dent_path, e))
elif dent_node.type == UBIFS_ITYPE_FIFO:
try:
os.mkfifo(dent_path, inode['ino'].mode)
os.mkfifo(dent_path, inode["ino"].mode)
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('FIFO Fail: %s : %s' % (dent_path, e))
ubifs.log.write("FIFO Fail: %s : %s" % (dent_path, e))
elif dent_node.type == UBIFS_ITYPE_SOCK:
try:
write_reg_file(dent_path, '')
write_reg_file(dent_path, "")
if perms:
set_file_perms(dent_path, inode)
except Exception as e:
ubifs.log.write('SOCK Fail: %s' % dent_path)
ubifs.log.write("SOCK Fail: %s" % dent_path)
def set_file_perms(path, inode):
try:
os.chmod(path, inode['ino'].mode)
os.chown(path, inode['ino'].uid, inode['ino'].gid)
except:
raise Exception('Failed File Permissions: %s' % path)
os.chmod(path, inode["ino"].mode)
os.chown(path, inode["ino"].uid, inode["ino"].gid)
except BaseException:
raise Exception("Failed File Permissions: %s" % path)
def write_reg_file(path, data):
with open(path, 'wb') as f:
with open(path, "wb") as f:
f.write(data)
def process_reg_file(ubifs, inode, path):
try:
buf = ''
if 'data' in inode:
buf = ""
if "data" in inode:
compr_type = 0
sorted_data = sorted(inode['data'], key=lambda x: x.key['khash'])
last_khash = sorted_data[0].key['khash'] - 1
sorted_data = sorted(inode["data"], key=lambda x: x.key["khash"])
last_khash = sorted_data[0].key["khash"] - 1
for data in sorted_data:
if data.key['khash'] - last_khash != 1:
while 1 != data.key['khash'] - last_khash:
buf += '\x00' * UBIFS_BLOCK_SIZE
if data.key["khash"] - last_khash != 1:
while 1 != data.key["khash"] - last_khash:
buf += "\x00" * UBIFS_BLOCK_SIZE
last_khash += 1
compr_type = data.compr_type
ubifs.file.seek(data.offset)
d = ubifs.file.read(data.compr_len)
buf += decompress(compr_type, data.size, d)
last_khash = data.key['khash']
last_khash = data.key["khash"]
except Exception as e:
raise Exception('inode num:%s :%s' % (inode['ino'].key['ino_num'], e))
raise Exception("inode num:%s :%s" % (inode["ino"].key["ino_num"], e))
if inode['ino'].size > len(buf):
buf += '\x00' * (inode['ino'].size - len(buf))
if inode["ino"].size > len(buf):
buf += "\x00" * (inode["ino"].size - len(buf))
return buf

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
from ubifs import extract
from ubifs.defines import *
@@ -12,24 +11,28 @@ def index(ubifs, lnum, offset, inodes={}):
elif chdr.node_type == UBIFS_INO_NODE:
inon = extract.ino_node(ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ)
ino_num = inon.key['ino_num']
ino_num = inon.key["ino_num"]
if ino_num not in inodes:
inodes[ino_num] = {}
inodes[ino_num]['ino'] = inon
inodes[ino_num]["ino"] = inon
elif chdr.node_type == UBIFS_DATA_NODE:
datn = extract.data_node(
ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ, chdr.len)
ino_num = datn.key['ino_num']
ubifs,
lnum,
offset +
UBIFS_COMMON_HDR_SZ,
chdr.len)
ino_num = datn.key["ino_num"]
if ino_num not in inodes:
inodes[ino_num] = {}
if 'data' not in inodes[ino_num]:
inodes[ino_num]['data'] = []
inodes[ino_num]['data'].append(datn)
if "data" not in inodes[ino_num]:
inodes[ino_num]["data"] = []
inodes[ino_num]["data"].append(datn)
elif chdr.node_type == UBIFS_DENT_NODE:
dn = extract.dent_node(ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ)
ino_num = dn.key['ino_num']
ino_num = dn.key["ino_num"]
if ino_num not in inodes:
inodes[ino_num] = {}
if 'dent' not in inodes[ino_num]:
inodes[ino_num]['dent'] = []
inodes[ino_num]['dent'].append(dn)
if "dent" not in inodes[ino_num]:
inodes[ino_num]["dent"] = []
inodes[ino_num]["dent"].append(dn)

View File

@@ -1,11 +1,12 @@
#!/usr/bin/python
import os
from ubi_io import leb_virtual_file
from ubifs import ubifs, walk, output
from ubifs.defines import PRINT_UBIFS_KEY_HASH, PRINT_UBIFS_COMPR
from ubi.defines import PRINT_VOL_TYPE_LIST, UBI_VTBL_AUTORESIZE_FLG
output_dir = os.path.join(os.path.dirname(
os.path.dirname(os.path.realpath(__file__))), 'output')
output_dir = os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "output"
)
def extract_files(ubifs, out_path, perms=False):
@@ -13,34 +14,37 @@ def extract_files(ubifs, out_path, perms=False):
inodes = {}
walk.index(ubifs, ubifs.master_node.root_lnum,
ubifs.master_node.root_offs, inodes)
for dent in inodes[1]['dent']:
for dent in inodes[1]["dent"]:
output.dents(ubifs, inodes, dent, out_path, perms)
except Exception as e:
import traceback
ubifs.log.write('%s' % e)
ubifs.log.write("%s" % e)
traceback.print_exc()
def get_ubi_params(ubi):
ubi_flags = {'min_io_size': '-m',
'max_bud_bytes': '-j',
'leb_size': '-e',
'default_compr': '-x',
'sub_page_size': '-s',
'fanout': '-f',
'key_hash': '-k',
'orph_lebs': '-p',
'log_lebs': '-l',
'max_leb_cnt': '-c',
'peb_size': '-p',
'sub_page_size': '-s',
'vid_hdr_offset': '-O',
'version': '-x',
'image_seq': '-Q',
'alignment': '-a',
'vol_id': '-n',
'name': '-N'}
ubi_flags = {
"min_io_size": "-m",
"max_bud_bytes": "-j",
"leb_size": "-e",
"default_compr": "-x",
"sub_page_size": "-s",
"fanout": "-f",
"key_hash": "-k",
"orph_lebs": "-p",
"log_lebs": "-l",
"max_leb_cnt": "-c",
"peb_size": "-p",
"sub_page_size": "-s",
"vid_hdr_offset": "-O",
"version": "-x",
"image_seq": "-Q",
"alignment": "-a",
"vol_id": "-n",
"name": "-N",
}
ubi_params = {}
ubi_args = {}
ini_params = {}
@@ -52,41 +56,55 @@ def get_ubi_params(ubi):
for volume in image.volumes:
ubi_args[img_seq][volume] = {}
ini_params[img_seq][volume] = {}
ini_params[img_seq][volume]['vol_type'] = PRINT_VOL_TYPE_LIST[image.volumes[volume].vol_rec.vol_type]
ini_params[img_seq][volume]["vol_type"] = PRINT_VOL_TYPE_LIST[
image.volumes[volume].vol_rec.vol_type
]
if image.volumes[volume].vol_rec.flags == UBI_VTBL_AUTORESIZE_FLG:
ini_params[img_seq][volume]['vol_flags'] = 'autoresize'
ini_params[img_seq][volume]["vol_flags"] = "autoresize"
else:
ini_params[img_seq][volume]['vol_flags'] = image.volumes[volume].vol_rec.flags
ini_params[img_seq][volume]['vol_id'] = image.volumes[volume].vol_id
ini_params[img_seq][volume]['vol_name'] = image.volumes[volume].name.rstrip(
'\x00')
ini_params[img_seq][volume]['vol_alignment'] = image.volumes[volume].vol_rec.alignment
ini_params[img_seq][volume]['vol_size'] = image.volumes[volume].vol_rec.reserved_pebs * ubi.leb_size
ini_params[img_seq][volume]["vol_flags"] = image.volumes[
volume
].vol_rec.flags
ini_params[img_seq][volume]["vol_id"] = image.volumes[volume].vol_id
ini_params[img_seq][volume]["vol_name"] = image.volumes[volume].name.rstrip(
"\x00")
ini_params[img_seq][volume]["vol_alignment"] = image.volumes[
volume
].vol_rec.alignment
ini_params[img_seq][volume]["vol_size"] = (
image.volumes[volume].vol_rec.reserved_pebs * ubi.leb_size
)
ufsfile = leb_virtual_file(ubi, image.volumes[volume])
uubifs = ubifs(ufsfile)
for key, value in uubifs.superblock_node:
if key == 'key_hash':
if key == "key_hash":
value = PRINT_UBIFS_KEY_HASH[value]
elif key == 'default_compr':
elif key == "default_compr":
value = PRINT_UBIFS_COMPR[value]
if key in ubi_flags:
ubi_args[img_seq][volume][key] = value
for key, value in image.volumes[volume].vol_rec:
if key == 'name':
value = value.rstrip('\x00')
if key == "name":
value = value.rstrip("\x00")
if key in ubi_flags:
ubi_args[img_seq][volume][key] = value
ubi_args[img_seq][volume]['version'] = image.version
ubi_args[img_seq][volume]['vid_hdr_offset'] = image.vid_hdr_offset
ubi_args[img_seq][volume]['sub_page_size'] = ubi_args[img_seq][volume]['vid_hdr_offset']
ubi_args[img_seq][volume]['sub_page_size'] = ubi_args[img_seq][volume]['vid_hdr_offset']
ubi_args[img_seq][volume]['image_seq'] = image.image_seq
ubi_args[img_seq][volume]['peb_size'] = ubi.peb_size
ubi_args[img_seq][volume]['vol_id'] = image.volumes[volume].vol_id
ubi_params[img_seq][volume] = {'flags': ubi_flags,
'args': ubi_args[img_seq][volume],
'ini': ini_params[img_seq][volume]}
ubi_args[img_seq][volume]["version"] = image.version
ubi_args[img_seq][volume]["vid_hdr_offset"] = image.vid_hdr_offset
ubi_args[img_seq][volume]["sub_page_size"] = ubi_args[img_seq][volume][
"vid_hdr_offset"
]
ubi_args[img_seq][volume]["sub_page_size"] = ubi_args[img_seq][volume][
"vid_hdr_offset"
]
ubi_args[img_seq][volume]["image_seq"] = image.image_seq
ubi_args[img_seq][volume]["peb_size"] = ubi.peb_size
ubi_args[img_seq][volume]["vol_id"] = image.volumes[volume].vol_id
ubi_params[img_seq][volume] = {
"flags": ubi_flags,
"args": ubi_args[img_seq][volume],
"ini": ini_params[img_seq][volume],
}
return ubi_params

View File

@@ -1,10 +1,15 @@
# -*- coding: utf-8 -*-
# from __init__ import _
from Plugins.Extensions.NeoBoot.__init__ import _
from Plugins.Extensions.NeoBoot.files.stbbranding import getNeoLocation, getKernelVersionString, getKernelImageVersion, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getTunerModel
from Plugins.Extensions.NeoBoot.files.stbbranding import (
getNeoLocation,
getKernelVersionString,
getKernelImageVersion,
getCPUtype,
getCPUSoC,
getImageNeoBoot,
getBoxVuModel,
getBoxHostName,
getTunerModel,
)
from enigma import getDesktop
from enigma import eTimer
from Screens.Screen import Screen
@@ -27,16 +32,36 @@ 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, pathExists, createDir, resolveFilename, SCOPE_PLUGINS
from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen
from Tools.Directories import (
fileExists,
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 not fileExists('/etc/vtiversion.info') and not fileExists('/etc/bhversion') and fileExists('/usr/lib/python2.7'):
if (
not fileExists("/etc/vtiversion.info")
and not fileExists("/etc/bhversion")
and fileExists("/usr/lib/python2.7")
):
from Plugins.Extensions.NeoBoot.files.neoconsole import Console
else:
from Screens.Console import Console
LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot"
def getDS():
@@ -96,47 +121,47 @@ class InstallImage(Screen, ConfigListScreen):
def __init__(self, session):
Screen.__init__(self, session)
fn = 'NewImage'
fn = "NewImage"
sourcelist = []
for fn in os.listdir('%sImagesUpload' % getNeoLocation()):
if fn.find('.zip') != -1:
fn = fn.replace('.zip', '')
for fn in os.listdir("%sImagesUpload" % getNeoLocation()):
if fn.find(".zip") != -1:
fn = fn.replace(".zip", "")
sourcelist.append((fn, fn))
continue
if fn.find('.rar') != -1:
fn = fn.replace('.rar', '')
if fn.find(".rar") != -1:
fn = fn.replace(".rar", "")
sourcelist.append((fn, fn))
continue
if fn.find('.tar.xz') != -1:
fn = fn.replace('.tar.xz', '')
if fn.find(".tar.xz") != -1:
fn = fn.replace(".tar.xz", "")
sourcelist.append((fn, fn))
continue
if fn.find('.tar.gz') != -1:
fn = fn.replace('.tar.gz', '')
if fn.find(".tar.gz") != -1:
fn = fn.replace(".tar.gz", "")
sourcelist.append((fn, fn))
continue
if fn.find('.tar.bz2') != -1:
fn = fn.replace('.tar.bz2', '')
if fn.find(".tar.bz2") != -1:
fn = fn.replace(".tar.bz2", "")
sourcelist.append((fn, fn))
continue
if fn.find('.tar') != -1:
fn = fn.replace('.tar', '')
if fn.find(".tar") != -1:
fn = fn.replace(".tar", "")
sourcelist.append((fn, fn))
continue
if fn.find('.tar') != -1:
fn = fn.replace('.tar.gz', '')
if fn.find(".tar") != -1:
fn = fn.replace(".tar.gz", "")
sourcelist.append((fn, fn))
continue
if fn.find('.mb') != -1:
fn = fn.replace('.mb', '')
if fn.find(".mb") != -1:
fn = fn.replace(".mb", "")
sourcelist.append((fn, fn))
continue
if fn.find('.nfi') != -1:
fn = fn.replace('.nfi', '')
if fn.find(".nfi") != -1:
fn = fn.replace(".nfi", "")
sourcelist.append((fn, fn))
continue
if len(sourcelist) == 0:
sourcelist = [('None', 'None')]
sourcelist = [("None", "None")]
self.source = ConfigSelection(choices=sourcelist)
self.target = ConfigText(fixed_size=False)
self.CopyFiles = ConfigYesNo(default=True)
@@ -160,159 +185,224 @@ class InstallImage(Screen, ConfigListScreen):
self.Kodi = ConfigYesNo(default=False)
self.BlackHole = ConfigYesNo(default=False)
for line in open("/etc/hostname"):
if getCPUtype() == 'MIPS' and not "dm500hd" in line and not "dm800se" in line and not "dm800" in line and not "dm8000" in line:
if (
getCPUtype() == "MIPS"
and "dm500hd" not in line
and "dm800se" not in line
and "dm800" not in line
and "dm8000" not in line
):
self.Nandsim = ConfigYesNo(default=True)
else:
self.Nandsim = ConfigYesNo(default=False)
self.target.value = ''
self.curselimage = ''
self.target.value = ""
self.curselimage = ""
try:
if self.curselimage != self.source.value:
self.target.value = self.source.value[:-13]
self.curselimage = self.source.value
except:
except BaseException:
pass
self.createSetup()
ConfigListScreen.__init__(self, self.list, session=session)
self.source.addNotifier(self.typeChange)
self['actions'] = ActionMap(['OkCancelActions',
'ColorActions',
'CiSelectionActions',
'VirtualKeyboardActions'], {'cancel': self.cancel,
'red': self.cancel,
'green': self.imageInstall,
'yellow': self.HelpInstall,
'blue': self.openKeyboard}, -2)
self['key_green'] = Label(_('Install'))
self['key_red'] = Label(_('Cancel'))
self['key_yellow'] = Label(_('Help'))
self['key_blue'] = Label(_('Keyboard'))
self['HelpWindow'] = Pixmap()
self['HelpWindow'].hide()
self["actions"] = ActionMap(
[
"OkCancelActions",
"ColorActions",
"CiSelectionActions",
"VirtualKeyboardActions",
],
{
"cancel": self.cancel,
"red": self.cancel,
"green": self.imageInstall,
"yellow": self.HelpInstall,
"blue": self.openKeyboard,
},
-2,
)
self["key_green"] = Label(_("Install"))
self["key_red"] = Label(_("Cancel"))
self["key_yellow"] = Label(_("Help"))
self["key_blue"] = Label(_("Keyboard"))
self["HelpWindow"] = Pixmap()
self["HelpWindow"].hide()
def createSetup(self):
self.list = []
self.list.append(getConfigListEntry(
_('Source Image file'), self.source))
self.list.append(getConfigListEntry(_('Image Name'), self.target))
self.list.append(getConfigListEntry(
_('Copy files from Flash to the installed image ?'), self.CopyFiles))
self.list.append(getConfigListEntry(
_('Copy the kernel of the installed system (recommended ?'), self.CopyKernel))
self.list.append(getConfigListEntry(
_('Copy the channel list ?'), self.TvList))
self.list.append(getConfigListEntry(
_('Copy network settings LAN-WLAN ?'), self.LanWlan))
self.list.append(getConfigListEntry(
_('Copy the drivers ? (Recommended only other image.)'), self.Sterowniki))
self.list.append(getConfigListEntry(
_('Copy mounting disks ? (Recommended)'), self.Montowanie))
self.list.append(getConfigListEntry(
_('Copy Settings to the new Image'), self.InstallSettings))
self.list.append(getConfigListEntry(
_('Delete Image zip after Install ?'), self.ZipDelete))
self.list.append(getConfigListEntry(
_('Repair FTP ? (Recommended only other image if it does not work.)'), self.RepairFTP))
self.list.append(getConfigListEntry(
_('Copy config SoftCam ?'), self.SoftCam))
self.list.append(getConfigListEntry(
_('Copy MediaPortal ?'), self.MediaPortal))
self.list.append(getConfigListEntry(
_('Copy picon flash to image install ?'), self.PiconR))
self.list.append(getConfigListEntry(
_('Transfer kodi settings ?'), self.Kodi))
self.list.append(getConfigListEntry(
_('Path BlackHole ? (Not recommended for VuPlus)'), self.BlackHole))
if getCPUtype() == 'MIPS':
self.list.append(getConfigListEntry(
_('Use Nandsim to install image ?'), self.Nandsim))
self.list.append(
getConfigListEntry(
_("Source Image file"),
self.source))
self.list.append(getConfigListEntry(_("Image Name"), self.target))
self.list.append(
getConfigListEntry(
_("Copy files from Flash to the installed image ?"),
self.CopyFiles))
self.list.append(
getConfigListEntry(
_("Copy the kernel of the installed system (recommended ?"),
self.CopyKernel,
)
)
self.list.append(
getConfigListEntry(
_("Copy the channel list ?"),
self.TvList))
self.list.append(
getConfigListEntry(
_("Copy network settings LAN-WLAN ?"),
self.LanWlan))
self.list.append(
getConfigListEntry(
_("Copy the drivers ? (Recommended only other image.)"),
self.Sterowniki))
self.list.append(
getConfigListEntry(
_("Copy mounting disks ? (Recommended)"), self.Montowanie
)
)
self.list.append(
getConfigListEntry(
_("Copy Settings to the new Image"), self.InstallSettings
)
)
self.list.append(
getConfigListEntry(
_("Delete Image zip after Install ?"),
self.ZipDelete))
self.list.append(
getConfigListEntry(
_("Repair FTP ? (Recommended only other image if it does not work.)"),
self.RepairFTP,
))
self.list.append(
getConfigListEntry(
_("Copy config SoftCam ?"),
self.SoftCam))
self.list.append(
getConfigListEntry(
_("Copy MediaPortal ?"),
self.MediaPortal))
self.list.append(
getConfigListEntry(
_("Copy picon flash to image install ?"),
self.PiconR))
self.list.append(
getConfigListEntry(
_("Transfer kodi settings ?"),
self.Kodi))
self.list.append(
getConfigListEntry(
_("Path BlackHole ? (Not recommended for VuPlus)"),
self.BlackHole))
if getCPUtype() == "MIPS":
self.list.append(
getConfigListEntry(
_("Use Nandsim to install image ?"),
self.Nandsim))
def HelpInstall(self):
self.session.open(HelpInstall)
def typeChange(self, value):
self.createSetup()
self['config'].l.setList(self.list)
self["config"].l.setList(self.list)
if self.curselimage != self.source.value:
self.target.value = self.source.value[:-13]
self.curselimage = self.source.value
def openKeyboard(self):
sel = self['config'].getCurrent()
sel = self["config"].getCurrent()
if sel:
if sel == self.target:
if self['config'].getCurrent()[1].help_window.instance is not None:
self['config'].getCurrent()[1].help_window.hide()
if self["config"].getCurrent(
)[1].help_window.instance is not None:
self["config"].getCurrent()[1].help_window.hide()
self.vkvar = sel[0]
if self.vkvar == _('Image Name'):
self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title=self['config'].getCurrent()[
0], text=self['config'].getCurrent()[1].value)
if self.vkvar == _("Image Name"):
self.session.openWithCallback(
self.VirtualKeyBoardCallback,
VirtualKeyBoard,
title=self["config"].getCurrent()[0],
text=self["config"].getCurrent()[1].value,
)
return
def VirtualKeyBoardCallback(self, callback=None):
if callback is not None and len(callback):
self['config'].getCurrent()[1].setValue(callback)
self['config'].invalidate(self['config'].getCurrent())
self["config"].getCurrent()[1].setValue(callback)
self["config"].invalidate(self["config"].getCurrent())
return
def imageInstall(self):
pluginpath = '' + LinkNeoBoot + ''
myerror = ''
source = self.source.value.replace(' ', '')
target = self.target.value.replace(' ', '')
for fn in os.listdir('%sImageBoot' % getNeoLocation()):
pluginpath = "" + LinkNeoBoot + ""
myerror = ""
source = self.source.value.replace(" ", "")
target = self.target.value.replace(" ", "")
for fn in os.listdir("%sImageBoot" % getNeoLocation()):
if fn == target:
myerror = _('Sorry, an Image with the name ') + target + \
_(' is already installed.\n Please try another name.')
myerror = (
_("Sorry, an Image with the name ")
+ target
+ _(" is already installed.\n Please try another name.")
)
continue
if source == 'None':
if source == "None":
myerror = _(
'You have to select one Image to install.\nPlease, upload your zip file in the folder: %sImagesUpload and select the image to install.')
if target == '':
myerror = _('You have to provide a name for the new Image.')
if target == 'Flash':
"You have to select one Image to install.\nPlease, upload your zip file in the folder: %sImagesUpload and select the image to install."
)
if target == "":
myerror = _("You have to provide a name for the new Image.")
if target == "Flash":
myerror = _(
'Sorry this name is reserved. Choose another name for the new Image.')
"Sorry this name is reserved. Choose another name for the new Image."
)
if len(target) > 30:
myerror = _('Sorry the name of the new Image is too long.')
myerror = _("Sorry the name of the new Image is too long.")
if myerror:
myerror
self.session.open(MessageBox, myerror, MessageBox.TYPE_INFO)
else:
myerror
message = "echo -e '"
message += _('NeoBot started installing new image.\n')
message += _('The installation process may take a few minutes.\n')
message += _('Please: DO NOT reboot your STB and turn off the power.\n')
message += _('Please, wait...\n')
message += _("NeoBot started installing new image.\n")
message += _("The installation process may take a few minutes.\n")
message += _("Please: DO NOT reboot your STB and turn off the power.\n")
message += _("Please, wait...\n")
message += "'"
cmd1 = 'python ' + pluginpath + '/ex_init.py'
cmd = '%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s ' % (cmd1,
source,
target.replace(
' ', '.'),
str(self.CopyFiles.value),
str(self.CopyKernel.value),
str(self.TvList.value),
str(self.LanWlan.value),
str(self.Sterowniki.value),
str(self.Montowanie.value),
str(
self.InstallSettings.value),
str(self.ZipDelete.value),
str(self.RepairFTP.value),
str(self.SoftCam.value),
str(self.MediaPortal.value),
str(self.PiconR.value),
str(self.Kodi.value),
str(self.BlackHole.value),
str(self.Nandsim.value))
cmd1 = "python " + pluginpath + "/ex_init.py"
cmd = "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s " % (
cmd1,
source,
target.replace(" ", "."),
str(self.CopyFiles.value),
str(self.CopyKernel.value),
str(self.TvList.value),
str(self.LanWlan.value),
str(self.Sterowniki.value),
str(self.Montowanie.value),
str(self.InstallSettings.value),
str(self.ZipDelete.value),
str(self.RepairFTP.value),
str(self.SoftCam.value),
str(self.MediaPortal.value),
str(self.PiconR.value),
str(self.Kodi.value),
str(self.BlackHole.value),
str(self.Nandsim.value),
)
print("[MULTI-BOOT]: "), cmd
from Plugins.Extensions.NeoBoot.plugin import PLUGINVERSION
self.session.open(Console, _(
'NeoBoot v.%s - Install new image') % PLUGINVERSION, [message, cmd])
self.session.open(
Console,
_("NeoBoot v.%s - Install new image") % PLUGINVERSION,
[message, cmd],
)
def cancel(self):
self.close()
@@ -333,59 +423,86 @@ class HelpInstall(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self['lab1'] = ScrollLabel('')
self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'DirectionActions'], {'back': self.close,
'ok': self.close,
'up': self['lab1'].pageUp,
'left': self['lab1'].pageUp,
'down': self['lab1'].pageDown,
'right': self['lab1'].pageDown})
self['lab1'].hide()
self["lab1"] = ScrollLabel("")
self["actions"] = ActionMap(
["WizardActions", "ColorActions", "DirectionActions"],
{
"back": self.close,
"ok": self.close,
"up": self["lab1"].pageUp,
"left": self["lab1"].pageUp,
"down": self["lab1"].pageDown,
"right": self["lab1"].pageDown,
},
)
self["lab1"].hide()
self.updatetext()
def updatetext(self):
message = _('Source Image file')
message += _(' - Select the software to be installed with the cursor (left or right).\n\n')
message = _("Source Image file")
message += _(
" - Select the software to be installed with the cursor (left or right).\n\n"
)
message += _('Image Name')
message += _(' - to change, press blue on the remote control.\n\n')
message += _("Image Name")
message += _(" - to change, press blue on the remote control.\n\n")
message += _('Copy files from Flash to the installed image ?')
message += _(' - this checking this option on it nothing will be copied from the image flash to the installed image in neoboot.\n\n')
message += _("Copy files from Flash to the installed image ?")
message += _(
" - this checking this option on it nothing will be copied from the image flash to the installed image in neoboot.\n\n"
)
message += _('Copy the kernel of the installed system (recommended ?')
message += _('- after selecting this option, the kernel of the installed image will be copied to neoboot, only recommended for STB vuplus\n\n')
message += _("Copy the kernel of the installed system (recommended ?")
message += _(
"- after selecting this option, the kernel of the installed image will be copied to neoboot, only recommended for STB vuplus\n\n"
)
message += _('Copy the channel list ?')
message += _(' - Option to copy channel list from flash to image installed in neoboot.\n\n')
message += _("Copy the channel list ?")
message += _(
" - Option to copy channel list from flash to image installed in neoboot.\n\n"
)
message += _('Copy mounting disks ? (Recommended)')
message += _(' - the option transfers mounts to the image installed in neoboot from the flashlight, recommended only if you are installing an image from a different model than you have.\n\n')
message += _("Copy mounting disks ? (Recommended)")
message += _(
" - the option transfers mounts to the image installed in neoboot from the flashlight, recommended only if you are installing an image from a different model than you have.\n\n"
)
message += _('Copy network settings LAN-WLAN ?')
message += _(' - the option moves files with the settings for lan and wlan.\n\n')
message += _("Copy network settings LAN-WLAN ?")
message += _(
" - the option moves files with the settings for lan and wlan.\n\n"
)
message += _('Copy the drivers ? (Recommended only other image.)')
message += _(' - Option to copy drivers to the image installed in neoboot from the flashlight, recommended only if you are installing an image from a different model than you have.\n\n')
message += _("Copy the drivers ? (Recommended only other image.)")
message += _(
" - Option to copy drivers to the image installed in neoboot from the flashlight, recommended only if you are installing an image from a different model than you have.\n\n"
)
message += _('Copy Settings to the new Image')
message += _(' - the option copies the software settings from the flashlight to the system being installed in the neobot.\n\n')
message += _("Copy Settings to the new Image")
message += _(
" - the option copies the software settings from the flashlight to the system being installed in the neobot.\n\n"
)
message += _('Delete Image zip after Install ?')
message += _(' - po instalacji, opcja kasuje plik zip image z katalogu ImagesUpload.\n\n')
message += _("Delete Image zip after Install ?")
message += _(
" - po instalacji, opcja kasuje plik zip image z katalogu ImagesUpload.\n\n"
)
message += _('Repair FTP ? (Recommended only other image if it does not work.)')
message += _(' - the option in some cases repairs the File Transfer Protocol connection in the installed image.\n\n')
message += _("Repair FTP ? (Recommended only other image if it does not work.)")
message += _(
" - the option in some cases repairs the File Transfer Protocol connection in the installed image.\n\n"
)
message += _('Copy config SoftCam ?')
message += _(' - the option copies oscam configi and cccam, openpli default.\n\n')
message += _("Copy config SoftCam ?")
message += _(
" - the option copies oscam configi and cccam, openpli default.\n\n"
)
message += _('Copy picon flash to image install ?')
message += _(' - cpuy picon from flash to image install in neoboot\n\n')
message += _("Copy picon flash to image install ?")
message += _(" - cpuy picon from flash to image install in neoboot\n\n")
message += _('Path BlackHole ? (Not recommended for VuPlus)')
message += _(' - option for image blackhole, helps to run BH in neoboot\n\n')
message += _("Path BlackHole ? (Not recommended for VuPlus)")
message += _(" - option for image blackhole, helps to run BH in neoboot\n\n")
self['lab1'].show()
self['lab1'].setText(message)
self["lab1"].show()
self["lab1"].setText(message)

View File

@@ -1,36 +1,8 @@
# skin = ./meoskins/defaul_skin - gutosie
from Screens.Screen import Screen
from Components.Pixmap import Pixmap
import os
# Colors (#AARRGGBB)
# ____Recommended colors - Zalecane kolory :
# color name="white" value="#ffffff"
# color name="darkwhite" value="#00dddddd"
# color name="red" value="#f23d21"
# color name="green" value="#389416"
# color name="blue" value="#0064c7"
# color name="yellow" value="#bab329"
# color name="orange" value="#00ffa500"
# color name="gray" value="#808080"
# color name="lightgrey" value="#009b9b9b"
# green = '#00389416' lub #00389416
# red = '#00ff2525'
# yellow = '#00ffe875'
# orange = '#00ff7f50'
# seledynowy = #00FF00
# jasny-blue = #99FFFF
# Zamiast font=Regular ktory nie rozpoznaje polskich znakow np. na VTi, mozesz zmienic na ponizsze font="*:
# font - genel
# font - baslk
# font - tasat
# font - dugme
# <widget name="config" position="1177,256" size="703,717" itemHeight="43" font="genel;30" scrollbarMode="showOnDemand" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" foregroundColorSelected="#00FFFFF" backgroundColorSelected="#1A27408B" scrollbarSliderBorderWidth="1" scrollbarWidth="8" scrollbarSliderForegroundColor="#00FFFFFF" scrollbarSliderBorderColor="#0027408B" enableWrapAround="1" transparent="1" />
# ____ Skin Ultra HD - ImageChooseFULLHD ___ mod. gutosie___
ImageChooseFULLHD = """
<screen name="ImageChooseFULLHD" position="center,center" size="1920,1080" title=" " flags="wfNoBorder" backgroundColor="transparent">
<eLabel backgroundColor="black" font="dugme; 30" foregroundColor="#99FFFF" position="70,50" size="298,55" valign="center" text="NEOBoot Multi-image" transparent="1" />
@@ -88,7 +60,6 @@ ImageChooseFULLHD = """
"""
# ____ Skin Ultra HD - ImageChooseULTRAHD ___ mod. gutosie___
ImageChooseULTRAHD = """
<screen name="NeoBootImageChoose" position="0,0" size="3840,2160" flags="wfNoBorder" backgroundColor="#ff111111">
<widget source="Title" render="Label" position="174,108" size="1575,150" font="baslk;102" valign="bottom" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" noWrap="1" transparent="1" />
@@ -137,7 +108,6 @@ ImageChooseULTRAHD = """
</screen>"""
# ____ Skin HD - ImageChoose ___mod. gutosie ___
ImageChooseHD = """
<screen name="NeoBootImageChoose" position="center,center" size="1280, 720" backgroundColor="transpBlack">
<ePixmap position="0,0" zPosition="-1" size="1274,720" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/1frame_base-fs8.png" />
@@ -184,7 +154,6 @@ ImageChooseHD = """
"""
# ____ Skin FULLHD - MyUpgradeFULLHD ___mod. gutosie ___
MyUpgradeFULLHD = """
<screen name="MyUpgradeFULLHD" position="center,center" size="1380,570" title="Tools Neoboot">
<ePixmap position="594,255" zPosition="-2" size="623,313" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrix.png" />
@@ -203,7 +172,6 @@ MyUpgradeFULLHD = """
</screen>"""
# ____ Skin UltraHD - MyUpgradeUltraHD ___mod. gutosie ___
MyUpgradeUltraHD = """
<screen name="MyUpgradeUltraHD" position="center,center" size="2100,1020" flags="wfNoBorder" backgroundColor="#ff111111">
<widget name="label1" position="180,210" size="1740,78" font="genel;60" halign="center" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" zPosition="1" transparent="1" />
@@ -220,7 +188,6 @@ MyUpgradeUltraHD = """
</screen>"""
# ____ Skin MyUpgradeHD - MyUpgradeHD ___mod. gutosie ___
MyUpgradeHD = """
<screen name="MyUpgradeHD" position="center,center" size="1127,569" title="Tools NeoBoot">
<ePixmap position="492,223" zPosition="-2" size="589,298" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrix.png" />
@@ -239,7 +206,6 @@ MyUpgradeHD = """
</screen>"""
# ____ Skin NeoBootInstallationFULLHD - NeoBootInstallationFULLHD ___mod. gutosie ___
NeoBootInstallationFULLHD = """
<screen name="NeoBootInstallationFULLHD" position="410,138" size="1200,850" title="NeoBoot">
<ePixmap position="643,282" zPosition="-2" size="531,331" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrix.png" />
@@ -264,7 +230,6 @@ NeoBootInstallationFULLHD = """
<widget name="key_blue" position="856,761" zPosition="1" size="326,52" font="dugme; 28" halign="center" valign="center" backgroundColor="blue" transparent="1" foregroundColor="blue" />
</screen>"""
# ____ Skin NeoBootInstallationUltraHD - NeoBootInstallationUltraHD ___mod. gutosie ___
NeoBootInstallationUltraHD = """
<screen name="NeoBootInstallationUltraHD" position="0,0" size="3840,2160" flags="wfNoBorder" backgroundColor="#ff111111">
<widget source="Title" render="Label" position="174,108" size="1575,150" font="baslk;102" valign="bottom" foregroundColor="#00FFFFFF" backgroundColor="#1A0F0F0F" noWrap="1" transparent="1" />
@@ -296,7 +261,6 @@ NeoBootInstallationUltraHD = """
</screen>"""
# ____ Skin NeoBootInstallationHD - NeoBootInstallationHD ___mod. gutosie ___
NeoBootInstallationHD = """
<screen position="center, center" size="835, 500" title="NeoBoot">
<ePixmap position="0,0" zPosition="-1" size="835,500" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/frame835x500.png" />