mirror of
https://github.com/gutosie/neoboot.git
synced 2025-11-02 12:25:46 +01:00
add novaler4kpro support
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from Components.Language import language
|
||||
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
|
||||
import os
|
||||
@@ -13,7 +13,8 @@ def localeInit():
|
||||
lang = language.getLanguage()[:2]
|
||||
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):
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import extract
|
||||
from . import extract
|
||||
if len(sys.argv) < 17:
|
||||
pass
|
||||
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])
|
||||
|
||||
1913
NeoBoot/extract.py
1913
NeoBoot/extract.py
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@ from Tools.Directories import fileExists, pathExists
|
||||
from Tools.CList import CList
|
||||
from Components.SystemInfo import SystemInfo
|
||||
from Components.Console import Console
|
||||
#from Plugins.Extensions.NeoBoot.files import Task
|
||||
# from Plugins.Extensions.NeoBoot.files import Task
|
||||
if fileExists('/usr/lib/python2.7'):
|
||||
from Plugins.Extensions.NeoBoot.files import Task
|
||||
else:
|
||||
@@ -35,7 +35,7 @@ def getProcMounts():
|
||||
try:
|
||||
mounts = open('/proc/mounts', 'r')
|
||||
except IOError as ex:
|
||||
print(("[Harddisk] Failed to open /proc/mounts"), ex)
|
||||
print((("[Harddisk] Failed to open /proc/mounts"), ex))
|
||||
return []
|
||||
|
||||
result = [line.strip().split(' ') for line in mounts]
|
||||
@@ -57,7 +57,7 @@ def isFileSystemSupported(filesystem):
|
||||
|
||||
return False
|
||||
except Exception as ex:
|
||||
print(("[Harddisk] Failed to read /proc/filesystems:'"), ex)
|
||||
print((("[Harddisk] Failed to read /proc/filesystems:'"), ex))
|
||||
|
||||
|
||||
def findMountPoint(path):
|
||||
@@ -98,7 +98,8 @@ class Harddisk():
|
||||
self.removable = removable
|
||||
self.internal = 'pci' in self.phys_path or 'ahci' in self.phys_path or 'sata' in self.phys_path
|
||||
try:
|
||||
data = open('/sys/block/%s/queue/rotational' % device, 'r').read().strip()
|
||||
data = open('/sys/block/%s/queue/rotational' %
|
||||
device, 'r').read().strip()
|
||||
self.rotational = int(data)
|
||||
except:
|
||||
self.rotational = True
|
||||
@@ -125,7 +126,8 @@ class Harddisk():
|
||||
break
|
||||
|
||||
self.card = self.device[:2] == 'hd' and 'host0' not in self.dev_path
|
||||
print("[Harddisk] new device"), self.device, '->', self.dev_path, '->', self.disk_path
|
||||
print(("[Harddisk] new device"), self.device,
|
||||
'->', self.dev_path, '->', self.disk_path)
|
||||
if not removable and not self.card:
|
||||
self.startIdle()
|
||||
return
|
||||
@@ -201,9 +203,9 @@ class Harddisk():
|
||||
return vendor + '(' + model + ')'
|
||||
if self.device.startswith('mmcblk0'):
|
||||
return readFile(self.sysfsPath('device/name'))
|
||||
raise (Exception, ("[Harddisk] no hdX or sdX or mmcX"))
|
||||
raise Exception
|
||||
except Exception as e:
|
||||
print("[Harddisk] Failed to get model:"), e
|
||||
print(("[Harddisk] Failed to get model:"), e)
|
||||
return '-?-'
|
||||
|
||||
def free(self):
|
||||
@@ -269,7 +271,7 @@ class Harddisk():
|
||||
return 0
|
||||
else:
|
||||
cmd = 'umount ' + dev
|
||||
print("[Harddisk]"), cmd
|
||||
print(("[Harddisk]"), cmd)
|
||||
res = os.system(cmd)
|
||||
return res >> 8
|
||||
|
||||
@@ -297,7 +299,7 @@ class Harddisk():
|
||||
parts = line.strip().split(' ')
|
||||
fspath = os.path.realpath(parts[0])
|
||||
if fspath == dev:
|
||||
print("[Harddisk] mounting:"), fspath
|
||||
print(("[Harddisk] mounting:"), fspath)
|
||||
cmd = 'mount -t auto ' + fspath
|
||||
res = os.system(cmd)
|
||||
return res >> 8
|
||||
@@ -332,7 +334,7 @@ class Harddisk():
|
||||
def createInitializeJob(self):
|
||||
job = Task.Job(_('Initializing storage device...'))
|
||||
size = self.diskSize()
|
||||
print("[HD] size: %s MB") % size
|
||||
print(("[HD] size: %s MB") % size)
|
||||
task = UnmountTask(job, self)
|
||||
task = Task.PythonTask(job, _('Removing partition table'))
|
||||
task.work = self.killPartitionTable
|
||||
@@ -342,7 +344,8 @@ class Harddisk():
|
||||
task.setTool('hdparm')
|
||||
task.args.append('-z')
|
||||
task.args.append(self.disk_path)
|
||||
task = Task.ConditionTask(job, _('Waiting for partition'), timeoutCount=20)
|
||||
task = Task.ConditionTask(
|
||||
job, _('Waiting for partition'), timeoutCount=20)
|
||||
task.check = lambda: not os.path.exists(self.partitionPath('1'))
|
||||
task.weighting = 1
|
||||
if os.path.exists('/usr/sbin/parted'):
|
||||
@@ -365,15 +368,15 @@ class Harddisk():
|
||||
else:
|
||||
parttype = 'msdos'
|
||||
task.args += ['-a',
|
||||
alignment,
|
||||
'-s',
|
||||
self.disk_path,
|
||||
'mklabel',
|
||||
parttype,
|
||||
'mkpart',
|
||||
'primary',
|
||||
'0%',
|
||||
'100%']
|
||||
alignment,
|
||||
'-s',
|
||||
self.disk_path,
|
||||
'mklabel',
|
||||
parttype,
|
||||
'mkpart',
|
||||
'primary',
|
||||
'0%',
|
||||
'100%']
|
||||
else:
|
||||
task.setTool('sfdisk')
|
||||
task.args.append('-f')
|
||||
@@ -390,7 +393,7 @@ class Harddisk():
|
||||
task = MkfsTask(job, _('Creating filesystem'))
|
||||
big_o_options = ['dir_index']
|
||||
|
||||
###__blokada hash dla ext4 >>>
|
||||
# __blokada hash dla ext4 >>>
|
||||
# if isFileSystemSupported('ext4'):
|
||||
# task.setTool('mkfs.ext4')
|
||||
# if size > 20000:
|
||||
@@ -407,22 +410,22 @@ class Harddisk():
|
||||
task.setTool('mkfs.ext3')
|
||||
if size > 250000:
|
||||
task.args += ['-T',
|
||||
'largefile',
|
||||
'-N',
|
||||
'262144']
|
||||
'largefile',
|
||||
'-N',
|
||||
'262144']
|
||||
big_o_options.append('sparse_super')
|
||||
elif size > 16384:
|
||||
task.args += ['-T', 'largefile']
|
||||
big_o_options.append('sparse_super')
|
||||
elif size > 2048:
|
||||
task.args += ['-T',
|
||||
'largefile',
|
||||
'-N',
|
||||
str(size * 32)]
|
||||
'largefile',
|
||||
'-N',
|
||||
str(size * 32)]
|
||||
task.args += ['-m0',
|
||||
'-O',
|
||||
','.join(big_o_options),
|
||||
self.partitionPath('1')]
|
||||
'-O',
|
||||
','.join(big_o_options),
|
||||
self.partitionPath('1')]
|
||||
task = MountTask(job, self)
|
||||
task.weighting = 3
|
||||
task = Task.ConditionTask(job, _('Waiting for mount'), timeoutCount=20)
|
||||
@@ -472,14 +475,14 @@ class Harddisk():
|
||||
from enigma import eTimer
|
||||
if self.bus() == _('External'):
|
||||
Console().ePopen(('sdparm',
|
||||
'sdparm',
|
||||
'--set=SCT=0',
|
||||
self.disk_path))
|
||||
'sdparm',
|
||||
'--set=SCT=0',
|
||||
self.disk_path))
|
||||
else:
|
||||
Console().ePopen(('hdparm',
|
||||
'hdparm',
|
||||
'-S0',
|
||||
self.disk_path))
|
||||
'hdparm',
|
||||
'-S0',
|
||||
self.disk_path))
|
||||
self.timer = eTimer()
|
||||
self.timer.callback.append(self.runIdle)
|
||||
self.idle_running = True
|
||||
@@ -504,16 +507,16 @@ class Harddisk():
|
||||
def setSleep(self):
|
||||
if self.bus() == _('External'):
|
||||
Console().ePopen(('sdparm',
|
||||
'sdparm',
|
||||
'--flexible',
|
||||
'--readonly',
|
||||
'--command=stop',
|
||||
self.disk_path))
|
||||
'sdparm',
|
||||
'--flexible',
|
||||
'--readonly',
|
||||
'--command=stop',
|
||||
self.disk_path))
|
||||
else:
|
||||
Console().ePopen(('hdparm',
|
||||
'hdparm',
|
||||
'-y',
|
||||
self.disk_path))
|
||||
'hdparm',
|
||||
'-y',
|
||||
self.disk_path))
|
||||
|
||||
def setIdleTime(self, idle):
|
||||
self.max_idle_time = idle
|
||||
@@ -614,25 +617,27 @@ class HarddiskManager():
|
||||
self.on_partition_list_change = CList()
|
||||
self.enumerateBlockDevices()
|
||||
p = (('/media/hdd', _('Hard disk')),
|
||||
('/media/card', _('Card')),
|
||||
('/media/cf', _('Compact flash')),
|
||||
('/media/mmc1', _('MMC card')),
|
||||
('/media/net', _('Network mount')),
|
||||
('/media/net1', _('Network mount %s') % '1'),
|
||||
('/media/net2', _('Network mount %s') % '2'),
|
||||
('/media/net3', _('Network mount %s') % '3'),
|
||||
('/media/ram', _('Ram disk')),
|
||||
('/media/usb', _('USB stick')),
|
||||
('/media/usb1', _('USB1 stick')),
|
||||
('/media/usb2', _('USB2 stick')),
|
||||
('/', _('Internal flash')))
|
||||
known = set([os.path.normpath(a.mountpoint) for a in self.partitions if a.mountpoint])
|
||||
('/media/card', _('Card')),
|
||||
('/media/cf', _('Compact flash')),
|
||||
('/media/mmc1', _('MMC card')),
|
||||
('/media/net', _('Network mount')),
|
||||
('/media/net1', _('Network mount %s') % '1'),
|
||||
('/media/net2', _('Network mount %s') % '2'),
|
||||
('/media/net3', _('Network mount %s') % '3'),
|
||||
('/media/ram', _('Ram disk')),
|
||||
('/media/usb', _('USB stick')),
|
||||
('/media/usb1', _('USB1 stick')),
|
||||
('/media/usb2', _('USB2 stick')),
|
||||
('/', _('Internal flash')))
|
||||
known = set([os.path.normpath(a.mountpoint)
|
||||
for a in self.partitions if a.mountpoint])
|
||||
for m, d in p:
|
||||
if m not in known and os.path.ismount(m):
|
||||
self.partitions.append(Partition(mountpoint=m, description=d))
|
||||
|
||||
def getBlockDevInfo(self, blockdev):
|
||||
HasMMC = fileExists('/proc/cmdline') and 'root=/dev/mmcblk' in open('/proc/cmdline', 'r').read()
|
||||
HasMMC = fileExists(
|
||||
'/proc/cmdline') and 'root=/dev/mmcblk' in open('/proc/cmdline', 'r').read()
|
||||
devpath = '/sys/block/' + blockdev
|
||||
error = False
|
||||
removable = False
|
||||
@@ -647,10 +652,10 @@ class HarddiskManager():
|
||||
else:
|
||||
dev = None
|
||||
blacklisted = dev in [1,
|
||||
7,
|
||||
31,
|
||||
253,
|
||||
254] + (['HasMMC'] and [179] or [])
|
||||
7,
|
||||
31,
|
||||
253,
|
||||
254] + (['HasMMC'] and [179] or [])
|
||||
if blockdev[0:2] == 'sr':
|
||||
is_cdrom = True
|
||||
if blockdev[0:2] == 'hd':
|
||||
@@ -680,24 +685,25 @@ class HarddiskManager():
|
||||
medium_found = False
|
||||
|
||||
return (error,
|
||||
blacklisted,
|
||||
removable,
|
||||
is_cdrom,
|
||||
partitions,
|
||||
medium_found)
|
||||
blacklisted,
|
||||
removable,
|
||||
is_cdrom,
|
||||
partitions,
|
||||
medium_found)
|
||||
|
||||
def enumerateBlockDevices(self):
|
||||
print("[Harddisk] enumerating block devices...")
|
||||
for blockdev in os.listdir('/sys/block'):
|
||||
error, blacklisted, removable, is_cdrom, partitions, medium_found = self.addHotplugPartition(blockdev)
|
||||
error, blacklisted, removable, is_cdrom, partitions, medium_found = self.addHotplugPartition(
|
||||
blockdev)
|
||||
if not error and not blacklisted and medium_found:
|
||||
for part in partitions:
|
||||
self.addHotplugPartition(part)
|
||||
|
||||
self.devices_scanned_on_init.append((blockdev,
|
||||
removable,
|
||||
is_cdrom,
|
||||
medium_found))
|
||||
removable,
|
||||
is_cdrom,
|
||||
medium_found))
|
||||
|
||||
def getAutofsMountpoint(self, device):
|
||||
r = self.getMountpoint(device)
|
||||
@@ -721,12 +727,14 @@ class HarddiskManager():
|
||||
physdev = os.path.realpath('/sys/block/' + dev + '/device')[4:]
|
||||
except OSError:
|
||||
physdev = dev
|
||||
print(("couldn't determine blockdev physdev for device"), device)
|
||||
print((("couldn't determine blockdev physdev for device"), device))
|
||||
|
||||
error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device)
|
||||
error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(
|
||||
device)
|
||||
if not blacklisted and medium_found:
|
||||
description = self.getUserfriendlyDeviceName(device, physdev)
|
||||
p = Partition(mountpoint=self.getMountpoint(device), description=description, force_mounted=True, device=device)
|
||||
p = Partition(mountpoint=self.getMountpoint(
|
||||
device), description=description, force_mounted=True, device=device)
|
||||
self.partitions.append(p)
|
||||
if p.mountpoint:
|
||||
self.on_partition_list_change('add', p)
|
||||
@@ -736,11 +744,11 @@ class HarddiskManager():
|
||||
self.hdd.sort()
|
||||
SystemInfo['Harddisk'] = True
|
||||
return (error,
|
||||
blacklisted,
|
||||
removable,
|
||||
is_cdrom,
|
||||
partitions,
|
||||
medium_found)
|
||||
blacklisted,
|
||||
removable,
|
||||
is_cdrom,
|
||||
partitions,
|
||||
medium_found)
|
||||
|
||||
def addHotplugAudiocd(self, device, physdev=None):
|
||||
if not physdev:
|
||||
@@ -749,21 +757,23 @@ class HarddiskManager():
|
||||
physdev = os.path.realpath('/sys/block/' + dev + '/device')[4:]
|
||||
except OSError:
|
||||
physdev = dev
|
||||
print(("couldn't determine blockdev physdev for device"), device)
|
||||
print((("couldn't determine blockdev physdev for device"), device))
|
||||
|
||||
error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device)
|
||||
error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(
|
||||
device)
|
||||
if not blacklisted and medium_found:
|
||||
description = self.getUserfriendlyDeviceName(device, physdev)
|
||||
p = Partition(mountpoint='/media/audiocd', description=description, force_mounted=True, device=device)
|
||||
p = Partition(mountpoint='/media/audiocd',
|
||||
description=description, force_mounted=True, device=device)
|
||||
self.partitions.append(p)
|
||||
self.on_partition_list_change('add', p)
|
||||
SystemInfo['Harddisk'] = False
|
||||
return (error,
|
||||
blacklisted,
|
||||
removable,
|
||||
is_cdrom,
|
||||
partitions,
|
||||
medium_found)
|
||||
blacklisted,
|
||||
removable,
|
||||
is_cdrom,
|
||||
partitions,
|
||||
medium_found)
|
||||
|
||||
def removeHotplugPartition(self, device):
|
||||
for x in self.partitions[:]:
|
||||
@@ -802,7 +812,8 @@ class HarddiskManager():
|
||||
def getMountedPartitions(self, onlyhotplug=False, mounts=None):
|
||||
if mounts is None:
|
||||
mounts = getProcMounts()
|
||||
parts = [x for x in self.partitions if (x.is_hotplug or not onlyhotplug) and x.mounted(mounts)]
|
||||
parts = [x for x in self.partitions if (
|
||||
x.is_hotplug or not onlyhotplug) and x.mounted(mounts)]
|
||||
devs = set([x.device for x in parts])
|
||||
for devname in devs.copy():
|
||||
if not devname:
|
||||
@@ -828,7 +839,7 @@ class HarddiskManager():
|
||||
try:
|
||||
description = readFile('/sys' + phys + '/model')
|
||||
except IOError as s:
|
||||
print(("couldn't read model: "), s)
|
||||
print((("couldn't read model: "), s))
|
||||
|
||||
if part and part != 1:
|
||||
description += _(' (Partition %d)') % part
|
||||
@@ -857,7 +868,8 @@ class HarddiskManager():
|
||||
ioctl(cd.fileno(), ioctl_flag, speed)
|
||||
cd.close()
|
||||
except Exception as ex:
|
||||
print("[Harddisk] Failed to set %s speed to %s") % (device, speed), ex
|
||||
print(("[Harddisk] Failed to set %s speed to %s") %
|
||||
(device, speed), ex)
|
||||
|
||||
|
||||
class UnmountTask(Task.LoggingTask):
|
||||
@@ -872,7 +884,7 @@ class UnmountTask(Task.LoggingTask):
|
||||
dev = self.hdd.disk_path.split('/')[-1]
|
||||
open('/dev/nomount.%s' % dev, 'wb').close()
|
||||
except Exception as e:
|
||||
print("ERROR: Failed to create /dev/nomount file:"), e
|
||||
print(("ERROR: Failed to create /dev/nomount file:"), e)
|
||||
|
||||
self.setTool('umount')
|
||||
self.args.append('-f')
|
||||
@@ -891,7 +903,7 @@ class UnmountTask(Task.LoggingTask):
|
||||
try:
|
||||
os.rmdir(path)
|
||||
except Exception as ex:
|
||||
print("Failed to remove path '%s':") % path, ex
|
||||
print(("Failed to remove path '%s':") % path, ex)
|
||||
|
||||
|
||||
class MountTask(Task.LoggingTask):
|
||||
@@ -905,7 +917,7 @@ class MountTask(Task.LoggingTask):
|
||||
dev = self.hdd.disk_path.split('/')[-1]
|
||||
os.unlink('/dev/nomount.%s' % dev)
|
||||
except Exception as e:
|
||||
print("ERROR: Failed to remove /dev/nomount file:"), e
|
||||
print(("ERROR: Failed to remove /dev/nomount file:"), e)
|
||||
|
||||
if self.hdd.mount_device is None:
|
||||
dev = self.hdd.partitionPath('1')
|
||||
@@ -935,7 +947,7 @@ class MkfsTask(Task.LoggingTask):
|
||||
return
|
||||
|
||||
def processOutput(self, data):
|
||||
print("[Mkfs]"), data
|
||||
print(("[Mkfs]"), data)
|
||||
if 'Writing inode tables:' in data:
|
||||
self.fsck_state = 'inode'
|
||||
elif 'Creating journal' in data:
|
||||
@@ -951,13 +963,13 @@ class MkfsTask(Task.LoggingTask):
|
||||
d[1] = d[1].split('\x08', 1)[0]
|
||||
self.setProgress(80 * int(d[0]) / int(d[1]))
|
||||
except Exception as e:
|
||||
print("[Mkfs] E:"), e
|
||||
print(("[Mkfs] E:"), e)
|
||||
|
||||
return
|
||||
self.log.append(data)
|
||||
|
||||
|
||||
###########################__From HarddiskSetup_################################
|
||||
########################### __From HarddiskSetup_################################
|
||||
class HarddiskSetup(Screen):
|
||||
|
||||
def __init__(self, session, hdd, action, text, question):
|
||||
@@ -971,19 +983,20 @@ class HarddiskSetup(Screen):
|
||||
self['key_red'] = Label(_('Cancel'))
|
||||
self['key_green'] = Label(text)
|
||||
self['actions'] = ActionMap(['OkCancelActions'], {'ok': self.hddQuestion,
|
||||
'cancel': self.close})
|
||||
'cancel': self.close})
|
||||
self['shortcuts'] = ActionMap(['ShortcutActions'], {'red': self.close,
|
||||
'green': self.hddQuestion})
|
||||
'green': self.hddQuestion})
|
||||
|
||||
def hddQuestion(self):
|
||||
message = self.question + '\n' + _('You can continue watching TV etc. while this is running.')
|
||||
message = self.question + '\n' + \
|
||||
_('You can continue watching TV etc. while this is running.')
|
||||
self.session.openWithCallback(self.hddConfirmed, MessageBox, message)
|
||||
|
||||
def hddConfirmed(self, confirmed):
|
||||
if not confirmed:
|
||||
return
|
||||
try:
|
||||
from Task import job_manager
|
||||
from .Task import job_manager
|
||||
except:
|
||||
from Components.Task import job_manager
|
||||
try:
|
||||
@@ -992,7 +1005,8 @@ class HarddiskSetup(Screen):
|
||||
from Screens.TaskView import JobView
|
||||
self.session.open(JobView, job, afterEventChangeable=False)
|
||||
except Exception as ex:
|
||||
self.session.open(MessageBox, str(ex), type=MessageBox.TYPE_ERROR, timeout=10)
|
||||
self.session.open(MessageBox, str(
|
||||
ex), type=MessageBox.TYPE_ERROR, timeout=10)
|
||||
|
||||
self.close()
|
||||
|
||||
@@ -1011,12 +1025,13 @@ class HarddiskSelection(Screen):
|
||||
self['key_red'] = Label(_('Cancel'))
|
||||
self['key_green'] = Label(_('Select'))
|
||||
self['actions'] = ActionMap(['OkCancelActions'], {'ok': self.okbuttonClick,
|
||||
'cancel': self.close})
|
||||
'cancel': self.close})
|
||||
self['shortcuts'] = ActionMap(['ShortcutActions'], {'red': self.close,
|
||||
'green': self.okbuttonClick})
|
||||
'green': self.okbuttonClick})
|
||||
|
||||
def doIt(self, selection):
|
||||
self.session.openWithCallback(self.close, HarddiskSetup, selection, action=selection.createInitializeJob, text=_('Initialize'), question=_('Do you really want to initialize the device?\nAll data on the disk will be lost!'))
|
||||
self.session.openWithCallback(self.close, HarddiskSetup, selection, action=selection.createInitializeJob, text=_(
|
||||
'Initialize'), question=_('Do you really want to initialize the device?\nAll data on the disk will be lost!'))
|
||||
|
||||
def okbuttonClick(self):
|
||||
selection = self['hddlist'].getCurrent()
|
||||
@@ -1027,8 +1042,9 @@ class HarddiskSelection(Screen):
|
||||
class HarddiskFsckSelection(HarddiskSelection):
|
||||
|
||||
def doIt(self, selection):
|
||||
self.session.openWithCallback(self.close, HarddiskSetup, selection, action=selection.createCheckJob, text=_('Check'), question=_('Do you really want to check the filesystem?\nThis could take lots of time!'))
|
||||
###########################__end HarddiskSetup_################################
|
||||
self.session.openWithCallback(self.close, HarddiskSetup, selection, action=selection.createCheckJob, text=_(
|
||||
'Check'), question=_('Do you really want to check the filesystem?\nThis could take lots of time!'))
|
||||
########################### __end HarddiskSetup_################################
|
||||
|
||||
|
||||
harddiskmanager = HarddiskManager()
|
||||
@@ -1058,4 +1074,5 @@ def internalHDDNotSleeping(external=False):
|
||||
|
||||
|
||||
harddiskmanager = HarddiskManager()
|
||||
SystemInfo['ext4'] = isFileSystemSupported('ext4') or isFileSystemSupported('ext3')
|
||||
SystemInfo['ext4'] = isFileSystemSupported(
|
||||
'ext4') or isFileSystemSupported('ext3')
|
||||
|
||||
@@ -4,7 +4,7 @@ from Tools.CList import CList
|
||||
|
||||
|
||||
class Job(object):
|
||||
NOT_STARTED, IN_PROGRESS, FINISHED, FAILED = range(4)
|
||||
NOT_STARTED, IN_PROGRESS, FINISHED, FAILED = list(range(4))
|
||||
|
||||
def __init__(self, name):
|
||||
self.tasks = []
|
||||
@@ -33,16 +33,18 @@ 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]
|
||||
self.IN_PROGRESS: _('In progress'),
|
||||
self.FINISHED: _('Finished'),
|
||||
self.FAILED: _('Failed')}[self.status]
|
||||
|
||||
def task_progress_changed_CB(self):
|
||||
self.state_changed()
|
||||
@@ -71,7 +73,8 @@ 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()
|
||||
@@ -82,18 +85,18 @@ class Job(object):
|
||||
if stay_resident:
|
||||
if cb_idx not in self.resident_tasks:
|
||||
self.resident_tasks.append(self.current_task)
|
||||
print("task going resident:"), task
|
||||
print(("task going resident:"), task)
|
||||
else:
|
||||
print("task keeps staying resident:"), task
|
||||
print(("task keeps staying resident:"), task)
|
||||
return
|
||||
if len(res):
|
||||
print(">>> Error:"), res
|
||||
print((">>> Error:"), res)
|
||||
self.status = self.FAILED
|
||||
self.state_changed()
|
||||
self.callback(self, task, res)
|
||||
if cb_idx != self.current_task:
|
||||
if cb_idx in self.resident_tasks:
|
||||
print("resident task finished:"), task
|
||||
print(("resident task finished:"), task)
|
||||
self.resident_tasks.remove(cb_idx)
|
||||
if res == []:
|
||||
self.state_changed()
|
||||
@@ -177,16 +180,19 @@ 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
|
||||
return
|
||||
|
||||
def run(self, callback):
|
||||
failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False)
|
||||
failed_preconditions = self.checkPreconditions(
|
||||
True) + self.checkPreconditions(False)
|
||||
if failed_preconditions:
|
||||
print("[Task] preconditions failed")
|
||||
callback(self, failed_preconditions)
|
||||
@@ -196,7 +202,7 @@ class Task(object):
|
||||
self.prepare()
|
||||
self._run()
|
||||
except Exception as ex:
|
||||
print("[Task] exception:"), ex
|
||||
print(("[Task] exception:"), ex)
|
||||
self.postconditions = [FailedPostcondition(ex)]
|
||||
self.finish()
|
||||
|
||||
@@ -222,7 +228,7 @@ class Task(object):
|
||||
self.output_line = self.output_line[i + 1:]
|
||||
|
||||
def processOutputLine(self, line):
|
||||
print("[Task %s]") % self.name, line[:-1]
|
||||
print(("[Task %s]") % self.name, line[:-1])
|
||||
|
||||
def processFinished(self, returncode):
|
||||
self.returncode = returncode
|
||||
@@ -277,7 +283,7 @@ class LoggingTask(Task):
|
||||
self.log = []
|
||||
|
||||
def processOutput(self, data):
|
||||
print("[%s]") % self.name, data,
|
||||
print(("[%s]") % self.name, data, end=' ')
|
||||
self.log.append(data)
|
||||
|
||||
|
||||
@@ -294,7 +300,7 @@ class PythonTask(Task):
|
||||
self.timer.start(5)
|
||||
|
||||
def work(self):
|
||||
raise (NotImplemented, "work")
|
||||
raise NotImplemented
|
||||
|
||||
def abort(self):
|
||||
self.aborted = True
|
||||
@@ -339,7 +345,7 @@ class ConditionTask(Task):
|
||||
self.triggerCount += 1
|
||||
try:
|
||||
if self.timeoutCount is not None and self.triggerCount > self.timeoutCount:
|
||||
raise (Exception, "Timeout elapsed, sorry")
|
||||
raise Exception
|
||||
res = self.check()
|
||||
except Exception as e:
|
||||
self.postconditions.append(FailedPostcondition(e))
|
||||
@@ -382,14 +388,16 @@ class JobManager:
|
||||
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):
|
||||
print("job"), job, ("completed with"), problems, ("in"), task
|
||||
print(("job"), job, ("completed with"), problems, ("in"), task)
|
||||
if problems:
|
||||
if not job.onFail(job, task, problems):
|
||||
self.errorCB(False)
|
||||
@@ -464,12 +472,14 @@ class ToolExistsPrecondition(Condition):
|
||||
import os
|
||||
if task.cmd[0] == '/':
|
||||
self.realpath = task.cmd
|
||||
print("[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!")
|
||||
print(
|
||||
"[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 = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file=task.cmd: os.path.join(directory, file), path))
|
||||
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from Components.Language import language
|
||||
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
|
||||
import os
|
||||
@@ -13,7 +13,8 @@ def localeInit():
|
||||
lang = language.getLanguage()[:2]
|
||||
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):
|
||||
|
||||
Binary file not shown.
@@ -29,11 +29,8 @@ import os
|
||||
from Screens.VirtualKeyBoard import VirtualKeyBoard
|
||||
import gettext
|
||||
from Plugins.Extensions.NeoBoot.files.stbbranding import getTunerModel, getCheckExt, getBoxHostName, getMyUUID
|
||||
if not fileExists('/usr/lib/python2.7'):
|
||||
open = file
|
||||
getoutput = "os.system"
|
||||
else:
|
||||
from commands import getoutput
|
||||
import subprocess
|
||||
|
||||
LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
|
||||
|
||||
class ManagerDevice(Screen):
|
||||
@@ -605,29 +602,37 @@ class SetDiskLabel(Screen):
|
||||
def sprDev(self):
|
||||
global lista
|
||||
lista = ['']
|
||||
if getTunerModel() in ('sf8008', 'sf8008s', 'sf8008t'):
|
||||
tuner_model = getTunerModel()
|
||||
blackL = ''
|
||||
if tuner_model in ('sf8008', 'sf8008s', 'sf8008t'):
|
||||
blackL = 'mmcblk0'
|
||||
if getTunerModel() in ('h9se'):
|
||||
elif tuner_model in ('h9se'):
|
||||
blackL = 'mmcblk1'
|
||||
else:
|
||||
blackL = getoutput('cat /etc/udev/mount-helper.sh | grep "BLACKLISTED="')
|
||||
blackL = blackL[13:-1]
|
||||
devL = getoutput('cat /proc/partitions | grep "sd\\|mmc" | awk \'{print $4}\'')
|
||||
devL = devL.split('\n')
|
||||
try:
|
||||
blackL_output = subprocess.getoutput('cat /etc/udev/mount-helper.sh | grep "BLACKLISTED="')
|
||||
blackL = blackL_output[13:-1]
|
||||
except Exception:
|
||||
blackL = ''
|
||||
try:
|
||||
devL_output = subprocess.getoutput('cat /proc/partitions | grep "sd\\|mmc" | awk \'{print $4}\'')
|
||||
devL = devL_output.split('\n')
|
||||
except Exception:
|
||||
devL = []
|
||||
|
||||
ilosc = len(devL)
|
||||
i = 0
|
||||
while i < ilosc:
|
||||
if len(devL[i]) == 9 or len(devL[i]) == 4:
|
||||
if devL[i][:7] != blackL:
|
||||
if self.sprLinux(devL[i]) == True:
|
||||
if self.sprLinux(devL[i]) is True:
|
||||
lista.append(devL[i])
|
||||
i += 1
|
||||
|
||||
if ilosc > 0:
|
||||
if ilosc > 0 and '' in lista:
|
||||
lista.remove('')
|
||||
elif lista[0] == '':
|
||||
lista.remove('')
|
||||
lista.insert(0, 'No Disk')
|
||||
elif not lista and not ilosc:
|
||||
lista.append('No Disk')
|
||||
|
||||
def cancel(self):
|
||||
self.close()
|
||||
@@ -676,20 +681,26 @@ class SetDiskLabel(Screen):
|
||||
return
|
||||
|
||||
def sprLabel(self):
|
||||
lab = getoutput('blkid /dev/' + self['devlist'].getCurrent())
|
||||
lab1 = lab.split(' ')
|
||||
licz1 = len(lab1)
|
||||
i = 0
|
||||
while i < licz1:
|
||||
if lab1[i][:5] == 'LABEL':
|
||||
self['disklabel'].setText(lab1[i][7:-1])
|
||||
break
|
||||
else:
|
||||
self['disklabel'].setText(_('No label'))
|
||||
i += 1
|
||||
current_device = self['devlist'].getCurrent()
|
||||
if not current_device:
|
||||
self['disklabel'].setText(_('No device selected'))
|
||||
return
|
||||
try:
|
||||
lab_output = subprocess.getoutput('blkid /dev/' + current_device)
|
||||
except Exception:
|
||||
lab_output = ''
|
||||
if lab_output:
|
||||
lab1 = lab_output.split(' ')
|
||||
for item in lab1:
|
||||
if item.startswith('LABEL='):
|
||||
label = item.split('"')[1]
|
||||
self['disklabel'].setText(label)
|
||||
return
|
||||
|
||||
self['disklabel'].setText(_('No label'))
|
||||
|
||||
def sprLinux(self, dev):
|
||||
lab = getoutput('blkid /dev/' + dev)
|
||||
lab = subprocess.getoutput('blkid /dev/' + dev)
|
||||
lab1 = lab.split(' ')
|
||||
licz1 = len(lab1)
|
||||
jest = False
|
||||
@@ -700,7 +711,6 @@ class SetDiskLabel(Screen):
|
||||
return jest
|
||||
jest = False
|
||||
j += 1
|
||||
|
||||
return jest
|
||||
|
||||
def MyClose(self):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from Plugins.Extensions.NeoBoot.__init__ import _
|
||||
#from __future__ import print_function
|
||||
# from __future__ import print_function
|
||||
from enigma import eConsoleAppContainer
|
||||
from Screens.Screen import Screen
|
||||
from Components.ActionMap import ActionMap
|
||||
@@ -29,11 +29,11 @@ class Console(Screen):
|
||||
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)
|
||||
'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
|
||||
@@ -59,7 +59,8 @@ class Console(Screen):
|
||||
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]
|
||||
print(("[Console] executing in run"), self.run,
|
||||
(" the command:"), self.cmdlist[self.run])
|
||||
if self.doExec(self.cmdlist[self.run]):
|
||||
self.runFinished(-1)
|
||||
|
||||
@@ -72,8 +73,8 @@ 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['key_red'].setText(_('Close'))
|
||||
# self['key_green'].setText(_('Save'))
|
||||
self.toggleScreenHide(True)
|
||||
if self.cancel_msg:
|
||||
self.cancel_msg.close()
|
||||
@@ -81,7 +82,8 @@ class Console(Screen):
|
||||
if not fileExists('/etc/vtiversion.info'):
|
||||
lastpage = self['text'].isAtLastPage()
|
||||
self['text'].appendText('\n' + _('Execution finished!!'))
|
||||
self['summary_description'].setText('\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:
|
||||
@@ -113,7 +115,7 @@ class Console(Screen):
|
||||
self.output_file = 'end'
|
||||
elif self.run == len(self.cmdlist):
|
||||
self.saveOutputText()
|
||||
#self.toggleScreenHide()
|
||||
# self.toggleScreenHide()
|
||||
else:
|
||||
self.toggleScreenHide()
|
||||
|
||||
@@ -124,7 +126,8 @@ 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
|
||||
@@ -135,8 +138,10 @@ class Console(Screen):
|
||||
def saveOutputText(self):
|
||||
from time import time, localtime
|
||||
lt = localtime(time())
|
||||
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.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)
|
||||
|
||||
def formatCmdList(self, source):
|
||||
if isinstance(source, (list, tuple)):
|
||||
@@ -164,13 +169,16 @@ class Console(Screen):
|
||||
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'
|
||||
text += 'next commands:\n\n' + \
|
||||
'\n'.join(cmdlist[1:]) + '\n\n'
|
||||
except:
|
||||
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.write(text)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#from Plugins.Extensions.NeoBoot.__init__ import _
|
||||
# from Plugins.Extensions.NeoBoot.__init__ import _
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
@@ -9,9 +9,10 @@ LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot'
|
||||
|
||||
LogFileObj = None
|
||||
|
||||
|
||||
def Log(param=''):
|
||||
global LogFileObj
|
||||
#first close object if exists
|
||||
# first close object if exists
|
||||
if param.lower() in ['open', 'write', 'append', 'close']:
|
||||
if LogFileObj is not None:
|
||||
LogFileObj.close()
|
||||
@@ -25,7 +26,7 @@ def Log(param=''):
|
||||
print("ERROR closing LogFile!!!")
|
||||
else:
|
||||
print("ERROR closing LogFile!!!")
|
||||
#second create object if does not exist
|
||||
# second create object if does not exist
|
||||
if LogFileObj is None:
|
||||
if param.lower() in ['open', 'write']:
|
||||
LogFileObj = open(LogFile, "w")
|
||||
@@ -45,39 +46,39 @@ def clearMemory():
|
||||
|
||||
|
||||
def LogCrashGS(line):
|
||||
if os.path.isfile('' + getNeoLocation() + 'ImageBoot/neoboot.log'):
|
||||
os.system(' rm -f ' + getNeoLocation() + 'ImageBoot/neoboot.log;')
|
||||
log_file = open('%sImageBoot/neoboot.log' % getNeoLocation(), 'a')
|
||||
log_file.write(line)
|
||||
log_file.close()
|
||||
|
||||
|
||||
if os.path.isfile('' + getNeoLocation() + 'ImageBoot/neoboot.log'):
|
||||
os.system(' rm -f ' + getNeoLocation() + 'ImageBoot/neoboot.log;')
|
||||
log_file = open('%sImageBoot/neoboot.log' % getNeoLocation(), 'a')
|
||||
log_file.write(line)
|
||||
log_file.close()
|
||||
|
||||
|
||||
def fileCheck(f, mode='r'):
|
||||
return fileExists(f, mode) and f
|
||||
|
||||
# if not IsImageName():
|
||||
# from Components.PluginComponent import plugins
|
||||
# plugins.reloadPlugins()
|
||||
# if not IsImageName():
|
||||
# from Components.PluginComponent import plugins
|
||||
# plugins.reloadPlugins()
|
||||
|
||||
|
||||
def IsImageName():
|
||||
if fileExists("/etc/issue"):
|
||||
for line in open("/etc/issue"):
|
||||
if "BlackHole" in line or "vuplus" in line:
|
||||
return True
|
||||
return False
|
||||
if fileExists("/etc/issue"):
|
||||
for line in open("/etc/issue"):
|
||||
if "BlackHole" in line or "vuplus" in line:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def mountp():
|
||||
pathmp = []
|
||||
if os.path.isfile('/proc/mounts'):
|
||||
for line in open('/proc/mounts'):
|
||||
if '/dev/sd' in line or '/dev/disk/by-uuid/' in line or '/dev/mmc' in line or '/dev/mtdblock' in line:
|
||||
pathmp.append(line.split()[1].replace('\\040', ' ') + '/')
|
||||
pathmp.append('/usr/share/enigma2/')
|
||||
pathmp.append('/etc/enigma2/')
|
||||
pathmp.append('/tmp/')
|
||||
return pathmp
|
||||
pathmp = []
|
||||
if os.path.isfile('/proc/mounts'):
|
||||
for line in open('/proc/mounts'):
|
||||
if '/dev/sd' in line or '/dev/disk/by-uuid/' in line or '/dev/mmc' in line or '/dev/mtdblock' in line:
|
||||
pathmp.append(line.split()[1].replace('\\040', ' ') + '/')
|
||||
pathmp.append('/usr/share/enigma2/')
|
||||
pathmp.append('/etc/enigma2/')
|
||||
pathmp.append('/tmp/')
|
||||
return pathmp
|
||||
|
||||
|
||||
def getSupportedTuners():
|
||||
@@ -94,10 +95,10 @@ def getSupportedTuners():
|
||||
def getFreespace(dev):
|
||||
statdev = os.statvfs(dev)
|
||||
space = statdev.f_bavail * statdev.f_frsize / 1024
|
||||
print("[NeoBoot] Free space on %s = %i kilobytes") % (dev, space)
|
||||
print(("[NeoBoot] Free space on %s = %i kilobytes") % (dev, space))
|
||||
return space
|
||||
|
||||
#check install
|
||||
# check install
|
||||
|
||||
|
||||
def getCheckInstal1():
|
||||
@@ -133,7 +134,7 @@ def getCheckInstal3():
|
||||
|
||||
return neocheckinstal
|
||||
|
||||
#check imageATV
|
||||
# check imageATV
|
||||
|
||||
|
||||
def getImageATv():
|
||||
@@ -146,7 +147,7 @@ def getImageATv():
|
||||
atvimage = 'okfeedCAMatv'
|
||||
return atvimage
|
||||
|
||||
#check install
|
||||
# check install
|
||||
|
||||
|
||||
def getNeoLocation():
|
||||
@@ -160,11 +161,11 @@ def getNeoLocation():
|
||||
elif os.path.exists('/media/usb/ImageBoot'):
|
||||
locatinoneo = '/media/usb/'
|
||||
else:
|
||||
locatinoneo = locatino
|
||||
locatinoneo = locatino
|
||||
return locatinoneo
|
||||
|
||||
|
||||
#check ext
|
||||
# check ext
|
||||
def getFormat():
|
||||
neoformat = 'UNKNOWN'
|
||||
if os.path.exists('/proc/mounts'):
|
||||
@@ -200,7 +201,7 @@ def getNEO_filesystems():
|
||||
|
||||
return neo_filesystems
|
||||
|
||||
#typ procesora arm lub mips
|
||||
# typ procesora arm lub mips
|
||||
|
||||
|
||||
def getCPUtype():
|
||||
@@ -215,7 +216,7 @@ def getCPUtype():
|
||||
cpu = 'MIPS'
|
||||
return cpu
|
||||
|
||||
#check install
|
||||
# check install
|
||||
|
||||
|
||||
def getFSTAB():
|
||||
@@ -282,44 +283,44 @@ def getINSTALLNeo():
|
||||
neoinstall = '/dev/sdh1'
|
||||
elif lines.find('/dev/sdh2') != -1:
|
||||
neoinstall = '/dev/sdh2'
|
||||
|
||||
|
||||
return neoinstall
|
||||
|
||||
|
||||
def getLocationMultiboot():
|
||||
LocationMultiboot = 'UNKNOWN'
|
||||
if os.path.exists('/media/sda1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sda1'
|
||||
LocationMultiboot = '/dev/sda1'
|
||||
if os.path.exists('/media/sda2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sda2'
|
||||
LocationMultiboot = '/dev/sda2'
|
||||
if os.path.exists('/media/sdb1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdb1'
|
||||
LocationMultiboot = '/dev/sdb1'
|
||||
if os.path.exists('/media/sdb2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdb2'
|
||||
LocationMultiboot = '/dev/sdb2'
|
||||
if os.path.exists('/media/sdc1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdc1'
|
||||
LocationMultiboot = '/dev/sdc1'
|
||||
if os.path.exists('/media/sdc2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdc2'
|
||||
LocationMultiboot = '/dev/sdc2'
|
||||
if os.path.exists('/media/sdd1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdd1'
|
||||
LocationMultiboot = '/dev/sdd1'
|
||||
if os.path.exists('/media/sdd2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdd2'
|
||||
LocationMultiboot = '/dev/sdd2'
|
||||
if os.path.exists('/media/sde1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sde1'
|
||||
LocationMultiboot = '/dev/sde1'
|
||||
if os.path.exists('/media/sde2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sde2'
|
||||
LocationMultiboot = '/dev/sde2'
|
||||
if os.path.exists('/media/sdf1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdf1'
|
||||
LocationMultiboot = '/dev/sdf1'
|
||||
if os.path.exists('/media/sdf2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdf2'
|
||||
LocationMultiboot = '/dev/sdf2'
|
||||
if os.path.exists('/media/sdg1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdg1'
|
||||
LocationMultiboot = '/dev/sdg1'
|
||||
if os.path.exists('/media/sdg2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdg2'
|
||||
LocationMultiboot = '/dev/sdg2'
|
||||
if os.path.exists('/media/sdh1/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdh1'
|
||||
LocationMultiboot = '/dev/sdh1'
|
||||
if os.path.exists('/media/sdh2/ImageBoot'):
|
||||
LocationMultiboot = '/dev/sdh2'
|
||||
LocationMultiboot = '/dev/sdh2'
|
||||
|
||||
return LocationMultiboot
|
||||
|
||||
@@ -334,7 +335,7 @@ def getLabelDisck():
|
||||
label = 'LABEL='
|
||||
return label
|
||||
|
||||
#checking device neo
|
||||
# checking device neo
|
||||
|
||||
|
||||
def getNeoMountDisc():
|
||||
@@ -345,7 +346,7 @@ def getNeoMountDisc():
|
||||
f.close()
|
||||
|
||||
return lines_mount
|
||||
|
||||
|
||||
|
||||
def getNeoMount():
|
||||
neo = 'UNKNOWN'
|
||||
@@ -385,8 +386,8 @@ def getNeoMount():
|
||||
neo = 'hdd_install_/dev/sdh2'
|
||||
|
||||
return neo
|
||||
|
||||
|
||||
|
||||
|
||||
def getNeoMount2():
|
||||
neo = 'UNKNOWN'
|
||||
if os.path.exists('/proc/mounts'):
|
||||
@@ -428,7 +429,7 @@ def getNeoMount2():
|
||||
elif lines.find('/dev/sdg1 /media/usb2') != -1:
|
||||
neo = 'usb_install_/dev/sdg1'
|
||||
elif lines.find('/dev/sdh1 /media/usb2') != -1:
|
||||
neo = 'usb_install_/dev/sdh1'
|
||||
neo = 'usb_install_/dev/sdh1'
|
||||
|
||||
return neo
|
||||
|
||||
@@ -472,7 +473,7 @@ def getNeoMount5():
|
||||
return neo
|
||||
|
||||
|
||||
#zwraca typ chipa prcesora
|
||||
# zwraca typ chipa prcesora
|
||||
def getCPUSoC():
|
||||
chipset = 'UNKNOWN'
|
||||
if os.path.exists('/proc/stb/info/chipset'):
|
||||
@@ -480,7 +481,7 @@ def getCPUSoC():
|
||||
chipset = f.readline().strip()
|
||||
f.close()
|
||||
if chipset == '7405(with 3D)':
|
||||
chipset = '7405'
|
||||
chipset = '7405'
|
||||
return chipset
|
||||
|
||||
|
||||
@@ -492,7 +493,7 @@ def getCPUSoCModel():
|
||||
f.close()
|
||||
return devicetree
|
||||
|
||||
#zwraca wybrane image w neoboot do uruchomienia
|
||||
# zwraca wybrane image w neoboot do uruchomienia
|
||||
|
||||
|
||||
def getImageNeoBoot():
|
||||
@@ -503,7 +504,7 @@ def getImageNeoBoot():
|
||||
f.close()
|
||||
return imagefile
|
||||
|
||||
#zwraca model vuplus
|
||||
# zwraca model vuplus
|
||||
|
||||
|
||||
def getBoxVuModel():
|
||||
@@ -525,10 +526,11 @@ def getVuModel():
|
||||
f = open("/proc/stb/info/vumodel", 'r')
|
||||
procmodel = f.readline().strip()
|
||||
f.close()
|
||||
model = procmodel.title().replace("olose", "olo SE").replace("olo2se", "olo2 SE").replace("2", "²")
|
||||
model = procmodel.title().replace("olose", "olo SE").replace(
|
||||
"olo2se", "olo2 SE").replace("2", "²")
|
||||
return model
|
||||
|
||||
#zwraca nazwe stb z pliku hostname
|
||||
# zwraca nazwe stb z pliku hostname
|
||||
|
||||
|
||||
def getBoxHostName():
|
||||
@@ -538,10 +540,10 @@ def getBoxHostName():
|
||||
f.close()
|
||||
return myboxname
|
||||
|
||||
#zwraca vuplus/vumodel
|
||||
# zwraca vuplus/vumodel
|
||||
|
||||
|
||||
def getTunerModel(): #< neoboot.py
|
||||
def getTunerModel(): # < neoboot.py
|
||||
BOX_NAME = ''
|
||||
if os.path.isfile('/proc/stb/info/vumodel') and not os.path.isfile("/proc/stb/info/boxtype"):
|
||||
BOX_NAME = open('/proc/stb/info/vumodel').read().strip()
|
||||
@@ -552,7 +554,7 @@ def getTunerModel(): #< neoboot.py
|
||||
BOX_NAME = open('/proc/stb/info/model').read().strip()
|
||||
return BOX_NAME
|
||||
|
||||
#zwraca strukture folderu zip - vuplus/vumodel
|
||||
# zwraca strukture folderu zip - vuplus/vumodel
|
||||
|
||||
|
||||
def getImageFolder():
|
||||
@@ -561,7 +563,7 @@ def getImageFolder():
|
||||
ImageFolder = 'vuplus/' + BOX_NAME
|
||||
return ImageFolder
|
||||
|
||||
#zwraca nazwe kernela z /lib/modules
|
||||
# zwraca nazwe kernela z /lib/modules
|
||||
|
||||
|
||||
def getKernelVersion():
|
||||
@@ -576,7 +578,7 @@ def getKernelVersion():
|
||||
def runCMDS(cmdsList):
|
||||
clearMemory()
|
||||
if isinstance(cmdsList, (list, tuple)):
|
||||
myCMD = '\n'.join(cmdsList)# + '\n'
|
||||
myCMD = '\n'.join(cmdsList) # + '\n'
|
||||
ret = os.system(myCMD)
|
||||
return rett
|
||||
|
||||
@@ -585,47 +587,47 @@ def getImageDistroN():
|
||||
image = 'Internal storage'
|
||||
|
||||
if fileExists('/.multinfo') and fileExists('%sImageBoot/.imagedistro' % getNeoLocation()):
|
||||
with open('%sImageBoot/.imagedistro' % getNeoLocation(), 'r') as f:
|
||||
image = f.readline().strip()
|
||||
f.close()
|
||||
with open('%sImageBoot/.imagedistro' % getNeoLocation(), 'r') as f:
|
||||
image = f.readline().strip()
|
||||
f.close()
|
||||
|
||||
elif not fileExists('/.multinfo') and fileExists('/etc/vtiversion.info'):
|
||||
f = open("/etc/vtiversion.info", 'r')
|
||||
imagever = f.readline().strip().replace("Release ", " ")
|
||||
f.close()
|
||||
image = imagever
|
||||
f = open("/etc/vtiversion.info", 'r')
|
||||
imagever = f.readline().strip().replace("Release ", " ")
|
||||
f.close()
|
||||
image = imagever
|
||||
|
||||
elif not fileExists('/.multinfo') and fileExists('/etc/bhversion'):
|
||||
f = open("/etc/bhversion", 'r')
|
||||
imagever = f.readline().strip()
|
||||
f.close()
|
||||
image = imagever
|
||||
f = open("/etc/bhversion", 'r')
|
||||
imagever = f.readline().strip()
|
||||
f.close()
|
||||
image = imagever
|
||||
|
||||
# elif not fileExists('/.multinfo') and fileExists('/etc/vtiversion.info'):
|
||||
# image = 'VTI Team Image '
|
||||
|
||||
elif fileExists('/.multinfo') and fileExists('/etc/bhversion'):
|
||||
image = 'Flash ' + ' ' + getBoxHostName()
|
||||
image = 'Flash ' + ' ' + getBoxHostName()
|
||||
|
||||
elif fileExists('/.multinfo') and fileExists('/etc/vtiversion.info'):
|
||||
image = 'Flash ' + ' ' + getBoxHostName()
|
||||
image = 'Flash ' + ' ' + getBoxHostName()
|
||||
|
||||
elif fileExists('/usr/lib/enigma2/python/boxbranding.so') and not fileExists('/.multinfo'):
|
||||
from boxbranding import getImageDistro
|
||||
image = getImageDistro()
|
||||
from boxbranding import getImageDistro
|
||||
image = getImageDistro()
|
||||
|
||||
elif fileExists('/media/InternalFlash/etc/issue.net') and fileExists('/.multinfo') and not fileExists('%sImageBoot/.imagedistro' % getNeoLocation()):
|
||||
obraz = open('/media/InternalFlash/etc/issue.net', 'r').readlines()
|
||||
imagetype = obraz[0][:-3]
|
||||
image = imagetype
|
||||
obraz = open('/media/InternalFlash/etc/issue.net', 'r').readlines()
|
||||
imagetype = obraz[0][:-3]
|
||||
image = imagetype
|
||||
|
||||
elif fileExists('/etc/issue.net') and not fileExists('/.multinfo'):
|
||||
obraz = open('/etc/issue.net', 'r').readlines()
|
||||
imagetype = obraz[0][:-3]
|
||||
image = imagetype
|
||||
obraz = open('/etc/issue.net', 'r').readlines()
|
||||
imagetype = obraz[0][:-3]
|
||||
image = imagetype
|
||||
|
||||
else:
|
||||
image = 'Inernal Flash ' + ' ' + getBoxHostName()
|
||||
image = 'Inernal Flash ' + ' ' + getBoxHostName()
|
||||
|
||||
return image
|
||||
|
||||
@@ -644,7 +646,8 @@ def getKernelVersionString():
|
||||
def getKernelImageVersion():
|
||||
try:
|
||||
from glob import glob
|
||||
lines = open(glob('/var/lib/opkg/info/kernel-*.control')[0], 'r').readlines()
|
||||
lines = open(glob('/var/lib/opkg/info/kernel-*.control')
|
||||
[0], 'r').readlines()
|
||||
kernelimage = lines[1][:-1]
|
||||
except:
|
||||
kernelimage = getKernelVersionString
|
||||
@@ -909,146 +912,198 @@ def getMachineProcModel():
|
||||
|
||||
|
||||
def getMountPointAll():
|
||||
os.system('touch ' + LinkNeoBoot + '/files/mountpoint.sh; echo "#!/bin/sh\n" >> ' + LinkNeoBoot + '/files/mountpoint.sh; chmod 0755 ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
if getNeoMount() == 'hdd_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/hdd\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/hdd\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sda2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sda2\n/bin/mount /dev/sda2 /media/hdd\n/bin/mount /dev/sda2 /media/sda2" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sdb2\n/bin/mount /dev/sdb2 /media/hdd\n/bin/mount /dev/sdb2 /media/sdb2" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
if getNeoMount2() == 'usb_install_/dev/sdb1':
|
||||
os.system('echo "\numount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/usb\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/sda1\n/bin/mount /dev/sda1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdb2\n/bin/mount /dev/sdb2 /media/sdb2\n/bin/mount /dev/sdb2 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdc1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdc1\n/bin/mount /dev/sdc1 /media/sdb2\n/bin/mount /dev/sdc1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdd1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdd1\n/bin/mount /dev/sdd1 /media/sdd1\n/bin/mount /dev/sdd1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sde1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sde1\n/bin/mount /dev/sde1 /media/sde1\n/bin/mount /dev/sde1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdf1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdf1\n/bin/mount /dev/sdf1 /media/sdf1\n/bin/mount /dev/sdf1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdg1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdg1\n/bin/mount /dev/sdg1 /media/sdg1\n/bin/mount /dev/sdg1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdh1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdh1\n/bin/mount /dev/sdh1 /media/sdh1\n/bin/mount /dev/sdh1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
elif getNeoMount3() == 'cf_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\nmkdir -p /media/sdb1\n/bin/mount /dev/sda1 /media/cf\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount3() == 'cf_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/cf\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
elif getNeoMount4() == 'card_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/card\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount4() == 'card_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/card\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/mmc\n/bin/mount /dev/sda1 /media/sda1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/mmc\n/bin/mount /dev/sdb1 /media/sdb1" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
os.system('echo "\n\nexit 0" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
os.system('touch ' + LinkNeoBoot + '/files/mountpoint.sh; echo "#!/bin/sh\n" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh; chmod 0755 ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
if getNeoMount() == 'hdd_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/hdd\n/bin/mount /dev/sda1 /media/sda1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/hdd\n/bin/mount /dev/sdb1 /media/sdb1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sda2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sda2\n/bin/mount /dev/sda2 /media/hdd\n/bin/mount /dev/sda2 /media/sda2" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\nmkdir -p /media/sdb2\n/bin/mount /dev/sdb2 /media/hdd\n/bin/mount /dev/sdb2 /media/sdb2" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
if getNeoMount2() == 'usb_install_/dev/sdb1':
|
||||
os.system('echo "\numount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/usb\n/bin/mount /dev/sdb1 /media/sdb1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/sda1\n/bin/mount /dev/sda1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdb2\n/bin/mount /dev/sdb2 /media/sdb2\n/bin/mount /dev/sdb2 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdc1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdc1\n/bin/mount /dev/sdc1 /media/sdb2\n/bin/mount /dev/sdc1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdd1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdd1\n/bin/mount /dev/sdd1 /media/sdd1\n/bin/mount /dev/sdd1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sde1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sde1\n/bin/mount /dev/sde1 /media/sde1\n/bin/mount /dev/sde1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdf1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdf1\n/bin/mount /dev/sdf1 /media/sdf1\n/bin/mount /dev/sdf1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdg1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdg1\n/bin/mount /dev/sdg1 /media/sdg1\n/bin/mount /dev/sdg1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdh1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\nmkdir -p /media/sdh1\n/bin/mount /dev/sdh1 /media/sdh1\n/bin/mount /dev/sdh1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
elif getNeoMount3() == 'cf_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\nmkdir -p /media/sdb1\n/bin/mount /dev/sda1 /media/cf\n/bin/mount /dev/sda1 /media/sda1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount3() == 'cf_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/cf\n/bin/mount /dev/sdb1 /media/sdb1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
elif getNeoMount4() == 'card_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/card\n/bin/mount /dev/sda1 /media/sda1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount4() == 'card_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/card\n/bin/mount /dev/sdb1 /media/sdb1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\nmkdir -p /media/sda1\n/bin/mount /dev/sda1 /media/mmc\n/bin/mount /dev/sda1 /media/sda1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\nmkdir -p /media/sdb1\n/bin/mount /dev/sdb1 /media/mmc\n/bin/mount /dev/sdb1 /media/sdb1" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
os.system('echo "\n\nexit 0" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
|
||||
|
||||
def getMountPointNeo():
|
||||
os.system('' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
os.system('echo ' + getLocationMultiboot() + ' > ' + LinkNeoBoot + '/bin/install; chmod 0755 ' + LinkNeoBoot + '/bin/install')
|
||||
if getLocationMultiboot() == '/dev/sda1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sda1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdb1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdb1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sda2':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sda2 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdb2':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdb2 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdc1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdc1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdd1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdd1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sde1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sde1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdf1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdf1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdg1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdg1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdh1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdh1 ' + getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
|
||||
os.system('chmod 755 ' + LinkNeoBoot + '/files/neo.sh')
|
||||
os.system('' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
os.system('echo ' + getLocationMultiboot() + ' > ' + LinkNeoBoot +
|
||||
'/bin/install; chmod 0755 ' + LinkNeoBoot + '/bin/install')
|
||||
if getLocationMultiboot() == '/dev/sda1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sda1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdb1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdb1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sda2':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sda2 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdb2':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdb2 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdc1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdc1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdd1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdd1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sde1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sde1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdf1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdf1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdg1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdg1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
elif getLocationMultiboot() == '/dev/sdh1':
|
||||
out = open('' + LinkNeoBoot + '/files/neo.sh', 'w')
|
||||
out.write('#!/bin/sh\n\n/bin/mount /dev/sdh1 ' +
|
||||
getNeoLocation() + ' \n\nexit 0')
|
||||
out.close()
|
||||
|
||||
os.system('chmod 755 ' + LinkNeoBoot + '/files/neo.sh')
|
||||
|
||||
|
||||
def getMountPointNeo2():
|
||||
#---------------------------------------------
|
||||
os.system('touch ' + LinkNeoBoot + '/files/mountpoint.sh; echo "#!/bin/sh" > ' + LinkNeoBoot + '/files/mountpoint.sh; chmod 0755 ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
if getNeoMount() == 'hdd_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda1 /media/hdd" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sdb1 /media/hdd" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sda2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda2 /media/hdd" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda2 /media/hdd" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
if getNeoMount2() == 'usb_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdb1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sda1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdb2 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdc1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdc1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdd1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdd1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sde1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sde1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdf1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdf1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdg1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdg1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdh1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdh1 /media/usb" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
elif getNeoMount3() == 'cf_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\n/bin/mount /dev/sda1 /media/cf" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount3() == 'cf_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\n/bin/mount /dev/sdb1 /media/cf" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
elif getNeoMount4() == 'card_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\n/bin/mount /dev/sda1 /media/card" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount4() == 'card_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\n/bin/mount /dev/sdb1 /media/card" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
#---------------------------------------------
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\n/bin/mount /dev/sda1 /media/mmc" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\n/bin/mount /dev/sdb1 /media/mmc" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
os.system('echo "\n\nexit 0" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
|
||||
# ---------------------------------------------
|
||||
os.system('touch ' + LinkNeoBoot + '/files/mountpoint.sh; echo "#!/bin/sh" > ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh; chmod 0755 ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
if getNeoMount() == 'hdd_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda1 /media/hdd" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sdb1 /media/hdd" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sda2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda2 /media/hdd" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount() == 'hdd_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda2 /media/hdd" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
if getNeoMount2() == 'usb_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdb1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sda1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdb2':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdb2 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdc1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdc1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdd1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdd1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sde1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sde1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdf1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdf1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdg1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdg1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount2() == 'usb_install_/dev/sdh1':
|
||||
os.system('echo "umount -l /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdh1 /media/usb" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
elif getNeoMount3() == 'cf_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\n/bin/mount /dev/sda1 /media/cf" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount3() == 'cf_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/cf\nmkdir -p /media/cf\n/bin/mount /dev/sdb1 /media/cf" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
elif getNeoMount4() == 'card_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\n/bin/mount /dev/sda1 /media/card" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount4() == 'card_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/card\nmkdir -p /media/card\n/bin/mount /dev/sdb1 /media/card" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
# ---------------------------------------------
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sda1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\n/bin/mount /dev/sda1 /media/mmc" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
elif getNeoMount5() == 'mmc_install_/dev/sdb1':
|
||||
os.system('echo "umount -l /media/mmc\nmkdir -p /media/mmc\n/bin/mount /dev/sdb1 /media/mmc" >> ' +
|
||||
LinkNeoBoot + '/files/mountpoint.sh')
|
||||
os.system('echo "\n\nexit 0" >> ' + LinkNeoBoot + '/files/mountpoint.sh')
|
||||
|
||||
|
||||
def getBoxMacAddres():
|
||||
ethernetmac = 'UNKNOWN'
|
||||
if not fileExists('/etc/.nameneo'):
|
||||
@@ -1058,19 +1113,21 @@ def getBoxMacAddres():
|
||||
ethernetmac = f.readline().strip()
|
||||
f.close()
|
||||
os.system('cp -r /etc/.nameneo /tmp/.mymac')
|
||||
#return ethernetmac
|
||||
# return ethernetmac
|
||||
|
||||
elif fileExists('/tmp/.mymac'):
|
||||
f = open("/tmp/.mymac", 'r')
|
||||
myboxmac = f.readline().strip().replace("eth0 Link encap:Ethernet HWaddr ", "")
|
||||
f.close()
|
||||
ethernetmac = myboxmac
|
||||
writefile = open('/tmp/.mymac' , 'w')
|
||||
writefile.write(myboxmac)
|
||||
writefile.close()
|
||||
f = open("/tmp/.mymac", 'r')
|
||||
myboxmac = f.readline().strip().replace(
|
||||
"eth0 Link encap:Ethernet HWaddr ", "")
|
||||
f.close()
|
||||
ethernetmac = myboxmac
|
||||
writefile = open('/tmp/.mymac', 'w')
|
||||
writefile.write(myboxmac)
|
||||
writefile.close()
|
||||
elif not fileExists('/tmp/.mymac'):
|
||||
ethernetmac = '12:34:56:78:91:02'
|
||||
return ethernetmac
|
||||
ethernetmac = '12:34:56:78:91:02'
|
||||
return ethernetmac
|
||||
|
||||
|
||||
def getCheckActivateVip():
|
||||
supportedvip = ''
|
||||
@@ -1081,56 +1138,78 @@ def getCheckActivateVip():
|
||||
if lines.find("%s" % getBoxMacAddres()) != -1:
|
||||
supportedvip = '%s' % getBoxMacAddres()
|
||||
return supportedvip
|
||||
|
||||
|
||||
|
||||
def getMountDiskSTB():
|
||||
neo_disk = ' '
|
||||
if os.path.exists('/proc/mounts'):
|
||||
with open('/proc/mounts', 'r') as f:
|
||||
lines = f.read()
|
||||
f.close()
|
||||
f.close()
|
||||
if lines.find('/dev/sda1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sda1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sda1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sdb1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sdb1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdb1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sda2 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sda2; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sda2; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sdb2 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sdb2; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdb2; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sdc1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sdc1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdc1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sdd1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sdd1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdd1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sde1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sde1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sde1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sdf1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sdf1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdf1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sdg1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sdg1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdg1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
if lines.find('/dev/sdh1 /media/hdd') != -1:
|
||||
os.system('touch /tmp/disk/sdh1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
#---------------------------------------------
|
||||
os.system(
|
||||
'touch /tmp/disk/sdh1; touch /tmp/disk/#---Select_the_disk_HDD:')
|
||||
# ---------------------------------------------
|
||||
if lines.find('/dev/sda1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sda1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sda1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sdb1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sdb1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdb1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sda2 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sda2; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sda2; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sdb2 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sdb2; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdb2; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sdc1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sdc1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdc1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sdd1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sdd1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdd1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sde1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sde1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sde1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sdf1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sdf1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdf1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sdg1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sdg1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdg1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
if lines.find('/dev/sdh1 /media/usb') != -1:
|
||||
os.system('touch /tmp/disk/sdh1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
os.system(
|
||||
'touch /tmp/disk/sdh1; touch /tmp/disk/#---Select_the_disk_USB:')
|
||||
|
||||
return neo_disk
|
||||
|
||||
return neo_disk
|
||||
|
||||
def getCheckExtDisk():
|
||||
os.system("cat /proc/mounts | egrep -o '.ext.' | sort | uniq > /tmp/.myext")
|
||||
@@ -1138,8 +1217,9 @@ def getCheckExtDisk():
|
||||
with open('/tmp/.myext', 'r') as f:
|
||||
myboxEXT = f.readline().strip()
|
||||
f.close()
|
||||
return myboxEXT
|
||||
|
||||
return myboxEXT
|
||||
|
||||
|
||||
def getCheckExt():
|
||||
neoExt = 'UNKNOWN'
|
||||
if os.path.exists('/proc/mounts'):
|
||||
@@ -1157,9 +1237,10 @@ def getCheckExt():
|
||||
elif lines.find('/media/usb ext3') != -1:
|
||||
neoExt = 'ext3'
|
||||
elif lines.find('/media/usb ext4') != -1:
|
||||
neoExt = 'ext4'
|
||||
neoExt = 'ext4'
|
||||
return neoExt
|
||||
|
||||
|
||||
def getExtCheckHddUsb():
|
||||
neoExt = 'UNKNOWN'
|
||||
if os.path.exists('/proc/mounts'):
|
||||
@@ -1169,12 +1250,13 @@ def getExtCheckHddUsb():
|
||||
if lines.find('/media/hdd ext4') != -1 or lines.find('/media/hdd type ext4') != -1 and os.path.exists('/media/hdd/ImageBoot'):
|
||||
neoExt = 'ext4'
|
||||
if lines.find('/media/usb ext4') != -1 or lines.find('/media/usb type ext4') != -1 and os.path.exists('/media/usb/ImageBoot'):
|
||||
neoExt = 'ext4'
|
||||
neoExt = 'ext4'
|
||||
return neoExt
|
||||
|
||||
|
||||
def getNandWrite():
|
||||
NandWrite = 'NandWrite'
|
||||
if fileExists('/usr/lib/python2.7'):
|
||||
if fileExists('/usr/lib/python2.7'):
|
||||
if os.path.exists('/usr/sbin/nandwrite'):
|
||||
with open('/usr/sbin/nandwrite', 'r') as f:
|
||||
lines = f.read()
|
||||
@@ -1183,12 +1265,14 @@ def getNandWrite():
|
||||
NandWrite = 'nandwrite'
|
||||
else:
|
||||
NandWrite = 'no_nandwrite'
|
||||
|
||||
|
||||
return NandWrite
|
||||
|
||||
|
||||
def getMyUUID():
|
||||
#os.system("tune2fs -l /dev/sd?? | awk '/UUID/ {print $NF}' > /tmp/.myuuid")
|
||||
os.system("tune2fs -l %s | awk '/UUID/ {print $NF}' > /tmp/.myuuid" % (getLocationMultiboot()))
|
||||
# os.system("tune2fs -l /dev/sd?? | awk '/UUID/ {print $NF}' > /tmp/.myuuid")
|
||||
os.system(
|
||||
"tune2fs -l %s | awk '/UUID/ {print $NF}' > /tmp/.myuuid" % (getLocationMultiboot()))
|
||||
try:
|
||||
if os.path.isfile('/tmp/.myuuid'):
|
||||
return open('/tmp/.myuuid').read().strip().upper()
|
||||
@@ -1197,27 +1281,30 @@ def getMyUUID():
|
||||
|
||||
return _('unavailable')
|
||||
|
||||
|
||||
def getImageBootNow():
|
||||
imagefile = 'UNKNOWN'
|
||||
if os.path.exists('/.multinfo'):
|
||||
with open('/.multinfo' , 'r') as f:
|
||||
with open('/.multinfo', 'r') as f:
|
||||
imagefile = f.readline().strip()
|
||||
f.close()
|
||||
return imagefile
|
||||
|
||||
def getNeoActivatedtest():
|
||||
neoactivated = 'NEOBOOT MULTIBOOT'
|
||||
if not fileExists('/.multinfo'):
|
||||
if getCheckActivateVip() != getBoxMacAddres():
|
||||
neoactivated = 'Ethernet MAC not found.'
|
||||
elif not fileExists('/usr/lib/periodon/.kodn'):
|
||||
neoactivated = 'VIP Pin code missing.'
|
||||
elif getTestToTest() != UPDATEVERSION :
|
||||
neoactivated = _('Update %s is available.') % getTestToTest()
|
||||
else:
|
||||
if getCheckActivateVip() == getBoxMacAddres() and fileExists('/usr/lib/periodon/.kodn') and getTestToTest() == UPDATEVERSION :
|
||||
neoactivated = 'NEOBOOT VIP ACTIVATED'
|
||||
|
||||
return neoactivated
|
||||
def getNeoActivatedtest():
|
||||
neoactivated = 'NEOBOOT MULTIBOOT'
|
||||
if not fileExists('/.multinfo'):
|
||||
if getCheckActivateVip() != getBoxMacAddres():
|
||||
neoactivated = 'Ethernet MAC not found.'
|
||||
elif not fileExists('/usr/lib/periodon/.kodn'):
|
||||
neoactivated = 'VIP Pin code missing.'
|
||||
elif getTestToTest() != UPDATEVERSION:
|
||||
neoactivated = _('Update %s is available.') % getTestToTest()
|
||||
else:
|
||||
if getCheckActivateVip() == getBoxMacAddres() and fileExists('/usr/lib/periodon/.kodn') and getTestToTest() == UPDATEVERSION:
|
||||
neoactivated = 'NEOBOOT VIP ACTIVATED'
|
||||
|
||||
return neoactivated
|
||||
|
||||
|
||||
boxbrand = sys.modules[__name__]
|
||||
|
||||
@@ -10,8 +10,8 @@ from Tools.Directories import fileExists, SCOPE_PLUGINS
|
||||
|
||||
def getAccesDate():
|
||||
timego = ''
|
||||
dana = getTestOutTime() # etc Nie! Szukana liczba jest wieksza!
|
||||
strzal = getTestInTime() # tmp Nie! Szukana liczba jest mniejsza!
|
||||
dana = getTestOutTime() # etc Nie! Szukana liczba jest wieksza!
|
||||
strzal = getTestInTime() # tmp Nie! Szukana liczba jest mniejsza!
|
||||
if strzal == dana:
|
||||
timego = 'access'
|
||||
elif strzal < dana:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ from Components.Pixmap import Pixmap
|
||||
import os
|
||||
# biko73 = ./neoskins/biko/skin_biko73.py
|
||||
|
||||
### ImageChooseFULLHD - biko73
|
||||
# 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" />
|
||||
|
||||
@@ -4,7 +4,7 @@ from Components.Pixmap import Pixmap
|
||||
import os
|
||||
# biko73 = ./neoskins/biko/skin_biko73.py
|
||||
|
||||
### ImageChooseFULLHD - biko73
|
||||
# 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" />
|
||||
|
||||
@@ -4,7 +4,7 @@ from Screens.Screen import Screen
|
||||
from Components.Pixmap import Pixmap
|
||||
import os
|
||||
|
||||
### ImageChooseFULLHD
|
||||
# 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" />
|
||||
|
||||
@@ -4,7 +4,7 @@ from Components.Pixmap import Pixmap
|
||||
import os
|
||||
# darog69 = ./neoskins/darog69/skin_darog69.py
|
||||
|
||||
### ImageChooseFULLHD - darog69
|
||||
# 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" />
|
||||
|
||||
@@ -4,7 +4,7 @@ from Components.Pixmap import Pixmap
|
||||
import os
|
||||
# darog69 = ./neoskins/darog69_Ustym4kpro/skin_darog69_Ustym4kpro.py
|
||||
|
||||
### ImageChooseFULLHD - darog69_Ustym4kpro
|
||||
# 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" />
|
||||
|
||||
@@ -4,17 +4,17 @@ 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"
|
||||
# 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'
|
||||
@@ -23,14 +23,14 @@ import os
|
||||
# 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
|
||||
# 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___
|
||||
# ____ 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 +88,7 @@ ImageChooseFULLHD = """
|
||||
"""
|
||||
|
||||
|
||||
###____ Skin Ultra HD - ImageChooseULTRAHD ___ mod. gutosie___
|
||||
# ____ 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 +137,7 @@ ImageChooseULTRAHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin HD - ImageChoose ___mod. gutosie ___
|
||||
# ____ 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 +189,7 @@ ImageChooseHD = """
|
||||
"""
|
||||
|
||||
|
||||
###____ Skin FULLHD - MyUpgradeFULLHD ___mod. gutosie ___
|
||||
# ____ 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 +208,7 @@ MyUpgradeFULLHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin UltraHD - MyUpgradeUltraHD ___mod. gutosie ___
|
||||
# ____ 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 +225,7 @@ MyUpgradeUltraHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin MyUpgradeHD - MyUpgradeHD ___mod. gutosie ___
|
||||
# ____ 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 +244,7 @@ MyUpgradeHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin NeoBootInstallationFULLHD - NeoBootInstallationFULLHD ___mod. gutosie ___
|
||||
# ____ 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 +269,7 @@ 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 ___
|
||||
# ____ 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" />
|
||||
@@ -305,7 +305,7 @@ NeoBootInstallationUltraHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin NeoBootInstallationHD - NeoBootInstallationHD ___mod. gutosie ___
|
||||
# ____ 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" />
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
|
||||
# mercus = /neoskins/mercus/mercus_skin.py
|
||||
|
||||
### ImageChooseFULLHD - mercus
|
||||
# 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" />
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
|
||||
# skin /neoskins/matrix/matrix_skin.py - mod.gutosie
|
||||
|
||||
### ImageChooseFULLHD
|
||||
# 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" />
|
||||
|
||||
@@ -5,27 +5,27 @@ 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"
|
||||
# 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:
|
||||
# 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
|
||||
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" />
|
||||
@@ -121,4 +121,4 @@ ImageChooseFULLHD = """
|
||||
"""
|
||||
|
||||
|
||||
###ImageChoose-HD
|
||||
# ImageChoose-HD
|
||||
|
||||
@@ -4,7 +4,7 @@ from Screens.Screen import Screen
|
||||
from Components.Pixmap import Pixmap
|
||||
import os
|
||||
|
||||
### ImageChooseFULLHD
|
||||
# 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" />
|
||||
|
||||
@@ -4,7 +4,7 @@ from Components.Pixmap import Pixmap
|
||||
import os
|
||||
|
||||
|
||||
###____ Skin HD - ImageChoose ___mod. gutosie ___
|
||||
# ____ 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" />
|
||||
|
||||
1720
NeoBoot/plugin.py
1720
NeoBoot/plugin.py
File diff suppressed because it is too large
Load Diff
@@ -101,6 +101,9 @@
|
||||
"maxytecmulti"
|
||||
"multibox"
|
||||
"multiboxse"
|
||||
"novaler4k"
|
||||
"novaler4kse"
|
||||
"novaler4kpro"
|
||||
"viper4k"
|
||||
"et1x000"
|
||||
"gbquad4k"quad4k"
|
||||
@@ -173,6 +176,5 @@ WWIO BRE2ZE 4K : bcm7251s
|
||||
Axas HIS Twin : Hisilicon 3716MV410 (ARM v7)
|
||||
Qviart Lunix 4K : 72604
|
||||
gigablue X3 4k : BCM 72604
|
||||
|
||||
#END
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#from __init__ import _
|
||||
# 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 enigma import getDesktop
|
||||
@@ -70,7 +70,7 @@ class StartImage(Screen):
|
||||
self['list'] = List(self.list)
|
||||
self.select()
|
||||
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
|
||||
'back': self.close})
|
||||
'back': self.close})
|
||||
self['label1'] = Label(_('Start the chosen system now ?'))
|
||||
self['label2'] = Label(_('Select OK to run the image.'))
|
||||
|
||||
@@ -86,25 +86,29 @@ class StartImage(Screen):
|
||||
|
||||
def KeyOk(self):
|
||||
if getImageNeoBoot() != 'Flash':
|
||||
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot()))
|
||||
self.StartImageInNeoBoot()
|
||||
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')
|
||||
#---------------------------------------------
|
||||
# ---------------------------------------------
|
||||
|
||||
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()))
|
||||
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')
|
||||
os.system(' ' + LinkNeoBoot +
|
||||
'/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash; sleep 1')
|
||||
|
||||
self.sel = self['list'].getCurrent()
|
||||
if self.sel:
|
||||
@@ -113,78 +117,91 @@ class StartImage(Screen):
|
||||
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;')
|
||||
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;')
|
||||
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;')
|
||||
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;')
|
||||
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;')
|
||||
os.system(
|
||||
'rm -f /media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh;')
|
||||
# else:
|
||||
# pass
|
||||
#_____ARM procesor____
|
||||
# _____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'):
|
||||
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)
|
||||
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)
|
||||
self.session.open(TryQuitMainloop, 2)
|
||||
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'):
|
||||
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)
|
||||
self.close()
|
||||
self.session.open(TryQuitMainloop, 2)
|
||||
elif not fileExists('/.multinfo'):
|
||||
cmd = 'ln -sfn /sbin/init.sysvinit /sbin/init'
|
||||
rc = os.system(cmd)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
self.close()
|
||||
|
||||
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()
|
||||
|
||||
@@ -69,7 +69,7 @@ class StartImage(Screen):
|
||||
self['list'] = List(self.list)
|
||||
self.select()
|
||||
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
|
||||
'back': self.close})
|
||||
'back': self.close})
|
||||
self['label1'] = Label(_('Start the chosen system now ?'))
|
||||
self['label2'] = Label(_('Select OK to run the image.'))
|
||||
|
||||
@@ -85,60 +85,70 @@ class StartImage(Screen):
|
||||
|
||||
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()))
|
||||
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()
|
||||
# ---------------------------------------------
|
||||
getMountPointNeo2()
|
||||
system('touch /tmp/.init_reboot')
|
||||
#---------------------------------------------
|
||||
# ---------------------------------------------
|
||||
|
||||
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()))
|
||||
system('touch %sImageBoot/%s/.control_boot_new_image ' %
|
||||
(getNeoLocation(), getImageNeoBoot()))
|
||||
|
||||
#system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh')
|
||||
# system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh')
|
||||
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;')
|
||||
os.system(
|
||||
'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'):
|
||||
getTurnOffOnSystem()
|
||||
elif not fileExists('/.multinfo'):
|
||||
cmd = 'ln -sfn /sbin/neoinitmips /sbin/init'
|
||||
rc = os.system(cmd)
|
||||
getTurnOffOnSystem()
|
||||
else:
|
||||
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)
|
||||
self.close()
|
||||
if getImageNeoBoot() == 'Flash':
|
||||
cmd = 'ln -sfn /sbin/init.sysvinit /sbin/init'
|
||||
rc = os.system(cmd)
|
||||
getTurnOffOnSystem()
|
||||
elif getImageNeoBoot() != 'Flash':
|
||||
if fileExists('/.multinfo'):
|
||||
getTurnOffOnSystem()
|
||||
elif not fileExists('/.multinfo'):
|
||||
cmd = 'ln -sfn /sbin/neoinitmips /sbin/init'
|
||||
rc = os.system(cmd)
|
||||
getTurnOffOnSystem()
|
||||
else:
|
||||
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)
|
||||
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)
|
||||
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()))
|
||||
os.system('echo 3 > /proc/sys/vm/drop_caches; shutdown now -r; reboot -f -d -h -i')
|
||||
|
||||
|
||||
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()))
|
||||
os.system(
|
||||
'echo 3 > /proc/sys/vm/drop_caches; shutdown now -r; reboot -f -d -h -i')
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#from __init__ import _
|
||||
# from __init__ import _
|
||||
from Plugins.Extensions.NeoBoot.__init__ import _
|
||||
#from __future__ import print_function
|
||||
# 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 enigma import getDesktop
|
||||
from enigma import eTimer
|
||||
@@ -33,15 +33,17 @@ import os
|
||||
import time
|
||||
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'
|
||||
mmcblockdevice = 'mmcblk0p1'
|
||||
elif getBoxHostName() == 'vuzero4k' and getBoxVuModel() == 'zero4k' and getCPUSoC() == '72604' and getBoxHostName() != "ustym4kpro":
|
||||
mmcblockdevice = 'mmcblk0p4'
|
||||
mmcblockdevice = 'mmcblk0p4'
|
||||
elif getBoxHostName() == 'vuduo4k' or getBoxHostName() == 'vuduo4kse' and getBoxHostName() != "vuultimo4k" and getBoxHostName() != "ustym4kpro":
|
||||
mmcblockdevice = 'mmcblk0p6'
|
||||
return mmcblockdevice
|
||||
mmcblockdevice = 'mmcblk0p6'
|
||||
return mmcblockdevice
|
||||
|
||||
|
||||
class StartImage(Screen):
|
||||
screenwidth = getDesktop(0).size().width()
|
||||
@@ -80,7 +82,7 @@ class StartImage(Screen):
|
||||
self['list'] = List(self.list)
|
||||
self.select()
|
||||
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
|
||||
'back': self.close})
|
||||
'back': self.close})
|
||||
self['label1'] = Label(_('Start the chosen system now ?'))
|
||||
self['label2'] = Label(_('Select OK to run the image.'))
|
||||
|
||||
@@ -96,105 +98,141 @@ class StartImage(Screen):
|
||||
|
||||
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()))
|
||||
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()
|
||||
# ---------------------------------------------
|
||||
getMountPointNeo2()
|
||||
system('touch /tmp/.init_reboot')
|
||||
#---------------------------------------------
|
||||
# ---------------------------------------------
|
||||
|
||||
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()))
|
||||
system('touch %sImageBoot/%s/.control_boot_new_image ' %
|
||||
(getNeoLocation(), getImageNeoBoot()))
|
||||
|
||||
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')
|
||||
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"')
|
||||
|
||||
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')
|
||||
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"')
|
||||
|
||||
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;')
|
||||
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" ')
|
||||
|
||||
# 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()))
|
||||
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...')
|
||||
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() + ''
|
||||
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'
|
||||
elif not fileExists("/.multinfo"):
|
||||
cmd = "echo -e '\n\n%s '" % _('...............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'
|
||||
elif getImageNeoBoot() != "Flash":
|
||||
if not fileExists("/.multinfo"):
|
||||
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())):
|
||||
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'
|
||||
elif fileExists("/.multinfo"):
|
||||
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() + ''
|
||||
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())):
|
||||
cmd = "echo -e '\n\n%s '" % _('...............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'
|
||||
|
||||
self.session.open(Console, _('NeoBoot ARM VU+....'), [cmd, cmd1, cmd2, cmd3, cmd4])
|
||||
self.close()
|
||||
|
||||
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()))
|
||||
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...')
|
||||
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() + ''
|
||||
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'
|
||||
elif not fileExists("/.multinfo"):
|
||||
cmd = "echo -e '\n\n%s '" % _(
|
||||
'...............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'
|
||||
elif getImageNeoBoot() != "Flash":
|
||||
if not fileExists("/.multinfo"):
|
||||
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())):
|
||||
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'
|
||||
elif fileExists("/.multinfo"):
|
||||
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() + ''
|
||||
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())):
|
||||
cmd = "echo -e '\n\n%s '" % _(
|
||||
'...............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'
|
||||
|
||||
self.session.open(Console, _(
|
||||
'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)
|
||||
self.close()
|
||||
|
||||
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):
|
||||
self.session.open(MessageBox, message, MessageBox.TYPE_INFO)
|
||||
self.close()
|
||||
|
||||
|
||||
@@ -31,16 +31,19 @@ import os
|
||||
import time
|
||||
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()))
|
||||
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'
|
||||
mmcblockdevice = 'mtd2'
|
||||
return mmcblockdevice
|
||||
|
||||
|
||||
class StartImage(Screen):
|
||||
screenwidth = getDesktop(0).size().width()
|
||||
if screenwidth and screenwidth == 1920:
|
||||
@@ -78,7 +81,7 @@ class StartImage(Screen):
|
||||
self['list'] = List(self.list)
|
||||
self.select()
|
||||
self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
|
||||
'back': self.close})
|
||||
'back': self.close})
|
||||
self['label1'] = Label(_('Start the chosen system now ?'))
|
||||
self['label2'] = Label(_('Select OK to run the image.'))
|
||||
|
||||
@@ -94,26 +97,29 @@ class StartImage(Screen):
|
||||
|
||||
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()))
|
||||
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
|
||||
(getNeoLocation(), getImageNeoBoot()))
|
||||
self.StartImageInNeoBoot()
|
||||
|
||||
if getNandWrite() == 'nandwrite':
|
||||
os.system('echo "nandwrite" > /tmp/check_nandwrite')
|
||||
#---------------------------------------------
|
||||
else:
|
||||
os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' %
|
||||
(getNeoLocation(), getImageNeoBoot()))
|
||||
self.StartImageInNeoBoot()
|
||||
|
||||
if getNandWrite() == 'nandwrite':
|
||||
os.system('echo "nandwrite" > /tmp/check_nandwrite')
|
||||
# ---------------------------------------------
|
||||
getMountPointNeo2()
|
||||
system('touch /tmp/.init_reboot')
|
||||
#---------------------------------------------
|
||||
# ---------------------------------------------
|
||||
|
||||
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()))
|
||||
|
||||
system('touch %sImageBoot/%s/.control_boot_new_image ' %
|
||||
(getNeoLocation(), getImageNeoBoot()))
|
||||
|
||||
system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/*')
|
||||
|
||||
self.sel = self['list'].getCurrent()
|
||||
@@ -121,91 +127,123 @@ class StartImage(Screen):
|
||||
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;')
|
||||
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" ')
|
||||
#################_____mips___##########################
|
||||
################# _____mips___##########################
|
||||
|
||||
#VUPLUS MIPS vu_dev_mtd1.sh
|
||||
# VUPLUS MIPS vu_dev_mtd1.sh
|
||||
if "vu" + getBoxVuModel() == getBoxHostName():
|
||||
getMmcBlockDevice()
|
||||
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()))
|
||||
else:
|
||||
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'
|
||||
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'
|
||||
|
||||
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'
|
||||
getMmcBlockDevice()
|
||||
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()))
|
||||
else:
|
||||
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'
|
||||
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'
|
||||
|
||||
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'
|
||||
|
||||
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 '
|
||||
|
||||
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'
|
||||
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'
|
||||
|
||||
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'
|
||||
|
||||
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'
|
||||
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'
|
||||
|
||||
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'
|
||||
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'
|
||||
|
||||
self.session.open(Console, _('NeoBoot MIPS....'), [
|
||||
cmd, cmd1, cmd2, cmd3, cmd4])
|
||||
self.close()
|
||||
|
||||
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 '
|
||||
|
||||
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'
|
||||
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'
|
||||
|
||||
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'
|
||||
|
||||
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'
|
||||
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'
|
||||
|
||||
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'
|
||||
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'
|
||||
|
||||
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)
|
||||
self.close()
|
||||
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):
|
||||
self.session.open(MessageBox, message, MessageBox.TYPE_INFO)
|
||||
self.close()
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
|
||||
__version__ = '1.1'
|
||||
__all__ = ['ArgumentParser',
|
||||
'ArgumentError',
|
||||
'ArgumentTypeError',
|
||||
'FileType',
|
||||
'HelpFormatter',
|
||||
'ArgumentDefaultsHelpFormatter',
|
||||
'RawDescriptionHelpFormatter',
|
||||
'RawTextHelpFormatter',
|
||||
'Namespace',
|
||||
'Action',
|
||||
'ONE_OR_MORE',
|
||||
'OPTIONAL',
|
||||
'PARSER',
|
||||
'REMAINDER',
|
||||
'SUPPRESS',
|
||||
'ZERO_OR_MORE']
|
||||
'ArgumentError',
|
||||
'ArgumentTypeError',
|
||||
'FileType',
|
||||
'HelpFormatter',
|
||||
'ArgumentDefaultsHelpFormatter',
|
||||
'RawDescriptionHelpFormatter',
|
||||
'RawTextHelpFormatter',
|
||||
'Namespace',
|
||||
'Action',
|
||||
'ONE_OR_MORE',
|
||||
'OPTIONAL',
|
||||
'PARSER',
|
||||
'REMAINDER',
|
||||
'SUPPRESS',
|
||||
'ZERO_OR_MORE']
|
||||
import collections as _collections
|
||||
import copy as _copy
|
||||
import os as _os
|
||||
@@ -122,9 +122,9 @@ class HelpFormatter(object):
|
||||
else:
|
||||
heading = ''
|
||||
return join(['\n',
|
||||
heading,
|
||||
item_help,
|
||||
'\n'])
|
||||
heading,
|
||||
item_help,
|
||||
'\n'])
|
||||
return
|
||||
|
||||
def _add_item(self, func, args):
|
||||
@@ -148,9 +148,9 @@ class HelpFormatter(object):
|
||||
def add_usage(self, usage, actions, groups, prefix=None):
|
||||
if usage is not SUPPRESS:
|
||||
args = (usage,
|
||||
actions,
|
||||
groups,
|
||||
prefix)
|
||||
actions,
|
||||
groups,
|
||||
prefix)
|
||||
self._add_item(self._format_usage, args)
|
||||
|
||||
def add_argument(self, action):
|
||||
@@ -162,7 +162,8 @@ class HelpFormatter(object):
|
||||
|
||||
invocation_length = max([len(s) for s in invocations])
|
||||
action_length = invocation_length + self._current_indent
|
||||
self._action_max_length = max(self._action_max_length, action_length)
|
||||
self._action_max_length = max(
|
||||
self._action_max_length, action_length)
|
||||
self._add_item(self._format_action, [action])
|
||||
|
||||
def add_arguments(self, actions):
|
||||
@@ -325,7 +326,8 @@ class HelpFormatter(object):
|
||||
return self._fill_text(text, text_width, indent) + '\n\n'
|
||||
|
||||
def _format_action(self, action):
|
||||
help_position = min(self._action_max_length + 2, self._max_help_position)
|
||||
help_position = min(self._action_max_length +
|
||||
2, self._max_help_position)
|
||||
help_width = self._width - help_position
|
||||
action_width = help_position - self._current_indent - 2
|
||||
action_header = self._format_action_invocation(action)
|
||||
@@ -334,9 +336,9 @@ class HelpFormatter(object):
|
||||
action_header = '%*s%s\n' % tup
|
||||
elif len(action_header) <= action_width:
|
||||
tup = (self._current_indent,
|
||||
'',
|
||||
action_width,
|
||||
action_header)
|
||||
'',
|
||||
action_width,
|
||||
action_header)
|
||||
action_header = '%*s%-*s ' % tup
|
||||
indent_first = 0
|
||||
else:
|
||||
@@ -521,14 +523,14 @@ class Action(_AttributeHolder):
|
||||
|
||||
def _get_kwargs(self):
|
||||
names = ['option_strings',
|
||||
'dest',
|
||||
'nargs',
|
||||
'const',
|
||||
'default',
|
||||
'type',
|
||||
'choices',
|
||||
'help',
|
||||
'metavar']
|
||||
'dest',
|
||||
'nargs',
|
||||
'const',
|
||||
'default',
|
||||
'type',
|
||||
'choices',
|
||||
'help',
|
||||
'metavar']
|
||||
return [(name, getattr(self, name)) for name in names]
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -539,10 +541,12 @@ class _StoreAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None):
|
||||
if nargs == 0:
|
||||
raise ValueError('nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriate')
|
||||
raise ValueError(
|
||||
'nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriate')
|
||||
if const is not None and nargs != OPTIONAL:
|
||||
raise ValueError('nargs must be %r to supply const' % OPTIONAL)
|
||||
super(_StoreAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const, default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
super(_StoreAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const,
|
||||
default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
return
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -552,7 +556,8 @@ class _StoreAction(Action):
|
||||
class _StoreConstAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None, metavar=None):
|
||||
super(_StoreConstAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, const=const, default=default, required=required, help=help)
|
||||
super(_StoreConstAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, nargs=0, const=const, default=default, required=required, help=help)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
setattr(namespace, self.dest, self.const)
|
||||
@@ -561,23 +566,27 @@ class _StoreConstAction(Action):
|
||||
class _StoreTrueAction(_StoreConstAction):
|
||||
|
||||
def __init__(self, option_strings, dest, default=False, required=False, help=None):
|
||||
super(_StoreTrueAction, self).__init__(option_strings=option_strings, dest=dest, const=True, default=default, required=required, help=help)
|
||||
super(_StoreTrueAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, const=True, default=default, required=required, help=help)
|
||||
|
||||
|
||||
class _StoreFalseAction(_StoreConstAction):
|
||||
|
||||
def __init__(self, option_strings, dest, default=True, required=False, help=None):
|
||||
super(_StoreFalseAction, self).__init__(option_strings=option_strings, dest=dest, const=False, default=default, required=required, help=help)
|
||||
super(_StoreFalseAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, const=False, default=default, required=required, help=help)
|
||||
|
||||
|
||||
class _AppendAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None):
|
||||
if nargs == 0:
|
||||
raise ValueError('nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriate')
|
||||
raise ValueError(
|
||||
'nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriate')
|
||||
if const is not None and nargs != OPTIONAL:
|
||||
raise ValueError('nargs must be %r to supply const' % OPTIONAL)
|
||||
super(_AppendAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const, default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
super(_AppendAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const,
|
||||
default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
return
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -589,7 +598,8 @@ class _AppendAction(Action):
|
||||
class _AppendConstAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None, metavar=None):
|
||||
super(_AppendConstAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, const=const, default=default, required=required, help=help, metavar=metavar)
|
||||
super(_AppendConstAction, self).__init__(option_strings=option_strings, dest=dest,
|
||||
nargs=0, const=const, default=default, required=required, help=help, metavar=metavar)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
items = _copy.copy(_ensure_value(namespace, self.dest, []))
|
||||
@@ -600,7 +610,8 @@ class _AppendConstAction(Action):
|
||||
class _CountAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, default=None, required=False, help=None):
|
||||
super(_CountAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, default=default, required=required, help=help)
|
||||
super(_CountAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, nargs=0, default=default, required=required, help=help)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
new_count = _ensure_value(namespace, self.dest, 0) + 1
|
||||
@@ -610,7 +621,8 @@ class _CountAction(Action):
|
||||
class _HelpAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest=SUPPRESS, default=SUPPRESS, help=None):
|
||||
super(_HelpAction, self).__init__(option_strings=option_strings, dest=dest, default=default, nargs=0, help=help)
|
||||
super(_HelpAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, default=default, nargs=0, help=help)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
parser.print_help()
|
||||
@@ -620,7 +632,8 @@ class _HelpAction(Action):
|
||||
class _VersionAction(Action):
|
||||
|
||||
def __init__(self, option_strings, version=None, dest=SUPPRESS, default=SUPPRESS, help="show program's version number and exit"):
|
||||
super(_VersionAction, self).__init__(option_strings=option_strings, dest=dest, default=default, nargs=0, help=help)
|
||||
super(_VersionAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, default=default, nargs=0, help=help)
|
||||
self.version = version
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -646,7 +659,8 @@ class _SubParsersAction(Action):
|
||||
self._parser_class = parser_class
|
||||
self._name_parser_map = _collections.OrderedDict()
|
||||
self._choices_actions = []
|
||||
super(_SubParsersAction, self).__init__(option_strings=option_strings, dest=dest, nargs=PARSER, choices=self._name_parser_map, help=help, metavar=metavar)
|
||||
super(_SubParsersAction, self).__init__(option_strings=option_strings, dest=dest,
|
||||
nargs=PARSER, choices=self._name_parser_map, help=help, metavar=metavar)
|
||||
|
||||
def add_parser(self, name, **kwargs):
|
||||
if kwargs.get('prog') is None:
|
||||
@@ -674,7 +688,8 @@ class _SubParsersAction(Action):
|
||||
msg = _('unknown parser %r (choices: %s)') % tup
|
||||
raise ArgumentError(self, msg)
|
||||
|
||||
namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)
|
||||
namespace, arg_strings = parser.parse_known_args(
|
||||
arg_strings, namespace)
|
||||
if arg_strings:
|
||||
vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
|
||||
getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)
|
||||
@@ -799,7 +814,8 @@ class _ActionsContainer(object):
|
||||
try:
|
||||
self._get_formatter()._format_args(action, None)
|
||||
except TypeError:
|
||||
raise ValueError('length of metavar tuple does not match nargs')
|
||||
raise ValueError(
|
||||
'length of metavar tuple does not match nargs')
|
||||
|
||||
return self._add_action(action)
|
||||
|
||||
@@ -841,12 +857,14 @@ class _ActionsContainer(object):
|
||||
group_map = {}
|
||||
for group in container._action_groups:
|
||||
if group.title not in title_group_map:
|
||||
title_group_map[group.title] = self.add_argument_group(title=group.title, description=group.description, conflict_handler=group.conflict_handler)
|
||||
title_group_map[group.title] = self.add_argument_group(
|
||||
title=group.title, description=group.description, conflict_handler=group.conflict_handler)
|
||||
for action in group._group_actions:
|
||||
group_map[action] = title_group_map[group.title]
|
||||
|
||||
for group in container._mutually_exclusive_groups:
|
||||
mutex_group = self.add_mutually_exclusive_group(required=group.required)
|
||||
mutex_group = self.add_mutually_exclusive_group(
|
||||
required=group.required)
|
||||
for action in group._group_actions:
|
||||
group_map[action] = mutex_group
|
||||
|
||||
@@ -915,7 +933,8 @@ class _ActionsContainer(object):
|
||||
|
||||
def _handle_conflict_error(self, action, conflicting_actions):
|
||||
message = _('conflicting option string(s): %s')
|
||||
conflict_string = ', '.join([option_string for option_string, action in conflicting_actions])
|
||||
conflict_string = ', '.join(
|
||||
[option_string for option_string, action in conflicting_actions])
|
||||
raise ArgumentError(action, message % conflict_string)
|
||||
|
||||
def _handle_conflict_resolve(self, action, conflicting_actions):
|
||||
@@ -981,9 +1000,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
def __init__(self, prog=None, usage=None, description=None, epilog=None, version=None, parents=[], formatter_class=HelpFormatter, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True):
|
||||
if version is not None:
|
||||
import warnings
|
||||
warnings.warn('The "version" argument to ArgumentParser is deprecated. Please use "add_argument(..., action=\'version\', version="N", ...)" instead', DeprecationWarning)
|
||||
warnings.warn(
|
||||
'The "version" argument to ArgumentParser is deprecated. Please use "add_argument(..., action=\'version\', version="N", ...)" instead', DeprecationWarning)
|
||||
superinit = super(ArgumentParser, self).__init__
|
||||
superinit(description=description, prefix_chars=prefix_chars, argument_default=argument_default, conflict_handler=conflict_handler)
|
||||
superinit(description=description, prefix_chars=prefix_chars,
|
||||
argument_default=argument_default, conflict_handler=conflict_handler)
|
||||
if prog is None:
|
||||
prog = _os.path.basename(_sys.argv[0])
|
||||
self.prog = prog
|
||||
@@ -1004,9 +1025,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
self.register('type', None, identity)
|
||||
default_prefix = '-' if '-' in prefix_chars else prefix_chars[0]
|
||||
if self.add_help:
|
||||
self.add_argument(default_prefix + 'h', default_prefix * 2 + 'help', action='help', default=SUPPRESS, help=_('show this help message and exit'))
|
||||
self.add_argument(default_prefix + 'h', default_prefix * 2 + 'help',
|
||||
action='help', default=SUPPRESS, help=_('show this help message and exit'))
|
||||
if self.version:
|
||||
self.add_argument(default_prefix + 'v', default_prefix * 2 + 'version', action='version', default=SUPPRESS, version=self.version, help=_("show program's version number and exit"))
|
||||
self.add_argument(default_prefix + 'v', default_prefix * 2 + 'version', action='version',
|
||||
default=SUPPRESS, version=self.version, help=_("show program's version number and exit"))
|
||||
for parent in parents:
|
||||
self._add_container_actions(parent)
|
||||
try:
|
||||
@@ -1020,12 +1043,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def _get_kwargs(self):
|
||||
names = ['prog',
|
||||
'usage',
|
||||
'description',
|
||||
'version',
|
||||
'formatter_class',
|
||||
'conflict_handler',
|
||||
'add_help']
|
||||
'usage',
|
||||
'description',
|
||||
'version',
|
||||
'formatter_class',
|
||||
'conflict_handler',
|
||||
'add_help']
|
||||
return [(name, getattr(self, name)) for name in names]
|
||||
|
||||
def add_subparsers(self, **kwargs):
|
||||
@@ -1079,7 +1102,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
if not hasattr(namespace, action.dest):
|
||||
if action.default is not SUPPRESS:
|
||||
default = action.default
|
||||
if isinstance(action.default, basestring):
|
||||
if isinstance(action.default, str):
|
||||
default = self._get_value(action, default)
|
||||
setattr(namespace, action.dest, default)
|
||||
|
||||
@@ -1213,7 +1236,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
else:
|
||||
max_option_string_index = -1
|
||||
while start_index <= max_option_string_index:
|
||||
next_option_string_index = min([index for index in option_string_indices if index >= start_index])
|
||||
next_option_string_index = min(
|
||||
[index for index in option_string_indices if index >= start_index])
|
||||
if start_index != next_option_string_index:
|
||||
positionals_end_index = consume_positionals(start_index)
|
||||
if positionals_end_index > start_index:
|
||||
@@ -1243,7 +1267,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
if action in seen_non_default_actions:
|
||||
break
|
||||
else:
|
||||
names = [_get_action_name(action) for action in group._group_actions if action.help is not SUPPRESS]
|
||||
names = [_get_action_name(
|
||||
action) for action in group._group_actions if action.help is not SUPPRESS]
|
||||
msg = _('one of the arguments %s is required')
|
||||
self.error(msg % ' '.join(names))
|
||||
|
||||
@@ -1282,8 +1307,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
match = _re.match(nargs_pattern, arg_strings_pattern)
|
||||
if match is None:
|
||||
nargs_errors = {None: _('expected one argument'),
|
||||
OPTIONAL: _('expected at most one argument'),
|
||||
ONE_OR_MORE: _('expected at least one argument')}
|
||||
OPTIONAL: _('expected at most one argument'),
|
||||
ONE_OR_MORE: _('expected at least one argument')}
|
||||
default = _('expected %s argument(s)') % action.nargs
|
||||
msg = nargs_errors.get(action.nargs, default)
|
||||
raise ArgumentError(action, msg)
|
||||
@@ -1293,7 +1318,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
result = []
|
||||
for i in range(len(actions), 0, -1):
|
||||
actions_slice = actions[:i]
|
||||
pattern = ''.join([self._get_nargs_pattern(action) for action in actions_slice])
|
||||
pattern = ''.join([self._get_nargs_pattern(action)
|
||||
for action in actions_slice])
|
||||
match = _re.match(pattern, arg_strings_pattern)
|
||||
if match is not None:
|
||||
result.extend([len(string) for string in match.groups()])
|
||||
@@ -1319,7 +1345,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
return (action, option_string, explicit_arg)
|
||||
option_tuples = self._get_option_tuples(arg_string)
|
||||
if len(option_tuples) > 1:
|
||||
options = ', '.join([option_string for action, option_string, explicit_arg in option_tuples])
|
||||
options = ', '.join(
|
||||
[option_string for action, option_string, explicit_arg in option_tuples])
|
||||
tup = (arg_string, options)
|
||||
self.error(_('ambiguous option: %s could match %s') % tup)
|
||||
elif len(option_tuples) == 1:
|
||||
@@ -1396,7 +1423,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
value = action.const
|
||||
else:
|
||||
value = action.default
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, str):
|
||||
value = self._get_value(action, value)
|
||||
self._check_value(action, value)
|
||||
elif not arg_strings and action.nargs == ZERO_OR_MORE and not action.option_strings:
|
||||
@@ -1448,12 +1475,14 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def format_usage(self):
|
||||
formatter = self._get_formatter()
|
||||
formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_groups)
|
||||
formatter.add_usage(self.usage, self._actions,
|
||||
self._mutually_exclusive_groups)
|
||||
return formatter.format_help()
|
||||
|
||||
def format_help(self):
|
||||
formatter = self._get_formatter()
|
||||
formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_groups)
|
||||
formatter.add_usage(self.usage, self._actions,
|
||||
self._mutually_exclusive_groups)
|
||||
formatter.add_text(self.description)
|
||||
for action_group in self._action_groups:
|
||||
formatter.start_section(action_group.title)
|
||||
@@ -1466,7 +1495,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def format_version(self):
|
||||
import warnings
|
||||
warnings.warn('The format_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
warnings.warn(
|
||||
'The format_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
formatter = self._get_formatter()
|
||||
formatter.add_text(self.version)
|
||||
return formatter.format_help()
|
||||
@@ -1488,7 +1518,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def print_version(self, file=None):
|
||||
import warnings
|
||||
warnings.warn('The print_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
warnings.warn(
|
||||
'The print_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
self._print_message(self.format_version(), file)
|
||||
|
||||
def _print_message(self, message, file=None):
|
||||
|
||||
@@ -17,16 +17,18 @@ class ubi:
|
||||
self._block_count = len(self.blocks)
|
||||
if self._block_count <= 0:
|
||||
raise Exception('No blocks found.')
|
||||
layout_list, data_list, int_vol_list, unknown_list = sort.by_type(self.blocks)
|
||||
layout_list, data_list, int_vol_list, unknown_list = sort.by_type(
|
||||
self.blocks)
|
||||
self._layout_blocks_list = layout_list
|
||||
self._data_blocks_list = data_list
|
||||
self._int_vol_blocks_list = int_vol_list
|
||||
self._unknown_blocks_list = unknown_list
|
||||
arbitrary_block = self.blocks.itervalues().next()
|
||||
arbitrary_block = next(iter(self.blocks.values()))
|
||||
self._min_io_size = arbitrary_block.ec_hdr.vid_hdr_offset
|
||||
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)
|
||||
layout_infos = layout.associate_blocks(
|
||||
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]))
|
||||
|
||||
@@ -17,10 +17,12 @@ class description(object):
|
||||
self.vtbl_recs = []
|
||||
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])
|
||||
self.vid_hdr = extract_vid_hdr(
|
||||
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(block_buf[self.ec_hdr.data_offset:])
|
||||
self.vtbl_recs = extract_vtbl_rec(
|
||||
block_buf[self.ec_hdr.data_offset:])
|
||||
self.leb_num = self.vid_hdr.lnum
|
||||
self.is_vtbl = bool(self.vtbl_recs) or False
|
||||
self.is_valid = not self.ec_hdr.errors and not self.vid_hdr.errors
|
||||
|
||||
@@ -18,7 +18,8 @@ def group_pairs(blocks, layout_blocks_list):
|
||||
def associate_blocks(blocks, layout_pairs, start_peb_num):
|
||||
seq_blocks = []
|
||||
for layout_pair in layout_pairs:
|
||||
seq_blocks = sort.by_image_seq(blocks, blocks[layout_pair[0]].ec_hdr.image_seq)
|
||||
seq_blocks = sort.by_image_seq(
|
||||
blocks, blocks[layout_pair[0]].ec_hdr.image_seq)
|
||||
layout_pair.append(seq_blocks)
|
||||
|
||||
return layout_pairs
|
||||
|
||||
@@ -18,7 +18,7 @@ def by_image_seq(blocks, image_seq):
|
||||
|
||||
|
||||
def by_range(blocks, block_range):
|
||||
peb_range = range(block_range[0], block_range[1])
|
||||
peb_range = list(range(block_range[0], block_range[1]))
|
||||
return [i for i in blocks if i in peb_range]
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ def by_leb(blocks):
|
||||
slist[blocks[block].leb_num] = block
|
||||
|
||||
return slist
|
||||
return sorted(blocks.iterkeys(), key=lambda x: blocks[x].leb_num)
|
||||
return sorted(iter(blocks.keys()), key=lambda x: blocks[x].leb_num)
|
||||
|
||||
|
||||
def by_vol_id(blocks, slist=None):
|
||||
@@ -79,6 +79,6 @@ def by_type(blocks, slist=None):
|
||||
unknown.append(i)
|
||||
|
||||
return (layout,
|
||||
data,
|
||||
int_vol,
|
||||
unknown)
|
||||
data,
|
||||
int_vol,
|
||||
unknown)
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
#!/usr/bin/python
|
||||
import struct
|
||||
UBI_CRC32_INIT = 4294967295L
|
||||
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']
|
||||
'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']
|
||||
'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']
|
||||
'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
|
||||
@@ -55,9 +55,9 @@ UBI_COMPAT_RO = 2
|
||||
UBI_COMPAT_PRESERVE = 4
|
||||
UBI_COMPAT_REJECT = 5
|
||||
PRINT_COMPAT_LIST = [0,
|
||||
'Delete',
|
||||
'Read Only',
|
||||
0,
|
||||
'Preserve',
|
||||
'Reject']
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
'Delete',
|
||||
'Read Only',
|
||||
0,
|
||||
'Preserve',
|
||||
'Reject']
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
|
||||
@@ -3,77 +3,79 @@ from ubi.defines import PRINT_COMPAT_LIST, PRINT_VOL_TYPE_LIST, UBI_VTBL_AUTORES
|
||||
|
||||
|
||||
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(('%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)
|
||||
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
|
||||
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'
|
||||
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)
|
||||
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
|
||||
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
|
||||
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)
|
||||
|
||||
print '\n'
|
||||
print('\n')
|
||||
|
||||
|
||||
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)
|
||||
print(('%s%s: %r' % (tab, key, value)))
|
||||
|
||||
|
||||
def vid_hdr(vid_hdr, tab=''):
|
||||
@@ -90,7 +92,7 @@ def vid_hdr(vid_hdr, tab=''):
|
||||
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=''):
|
||||
@@ -106,4 +108,4 @@ def vol_rec(vol_rec, tab=''):
|
||||
value = 'autoresize'
|
||||
elif key == 'name':
|
||||
value = value.strip('\x00')
|
||||
print '%s%s: %s' % (tab, key, value)
|
||||
print(('%s%s: %s' % (tab, key, value)))
|
||||
|
||||
@@ -7,7 +7,8 @@ from ubi.headers import errors
|
||||
class ec_hdr(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(EC_HDR_FIELDS, struct.unpack(EC_HDR_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(EC_HDR_FIELDS, struct.unpack(EC_HDR_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -25,7 +26,8 @@ class ec_hdr(object):
|
||||
class vid_hdr(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(VID_HDR_FIELDS, struct.unpack(VID_HDR_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(VID_HDR_FIELDS, struct.unpack(VID_HDR_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -43,7 +45,8 @@ class vid_hdr(object):
|
||||
class vtbl_rec(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(VTBL_REC_FIELDS, struct.unpack(VTBL_REC_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(VTBL_REC_FIELDS, struct.unpack(VTBL_REC_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ from ubi.defines import *
|
||||
|
||||
|
||||
def ec_hdr(ec_hdr, buf):
|
||||
if ec_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295L:
|
||||
if ec_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
|
||||
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]) & 4294967295L:
|
||||
if vid_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
|
||||
vid_hdr.errors.append('crc')
|
||||
return vid_hdr
|
||||
|
||||
@@ -22,7 +22,7 @@ def vtbl_rec(vtbl_rec, buf):
|
||||
likely_vtbl = False
|
||||
elif vtbl_rec.vol_type not in (1, 2):
|
||||
likely_vtbl = False
|
||||
if vtbl_rec.crc != ~crc32(buf[:-4]) & 4294967295L:
|
||||
if vtbl_rec.crc != ~crc32(buf[:-4]) & 4294967295:
|
||||
vtbl_rec.errors.append('crc')
|
||||
if not likely_vtbl:
|
||||
vtbl_rec.errors = ['False']
|
||||
|
||||
@@ -18,7 +18,7 @@ class description(object):
|
||||
return 'Image: %s' % self.image_seq
|
||||
|
||||
def get_blocks(self, blocks):
|
||||
return get_blocks_in_list(blocks, 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]
|
||||
|
||||
@@ -63,6 +63,7 @@ def get_volumes(blocks, layout_info):
|
||||
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])
|
||||
volumes[vol_name] = description(
|
||||
vol_rec.rec_index, vol_rec, vol_blocks_lists[vol_rec.rec_index])
|
||||
|
||||
return volumes
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
#import argparse_neo
|
||||
# import argparse_neo
|
||||
try:
|
||||
import argparse
|
||||
except:
|
||||
@@ -12,19 +12,26 @@ from ubifs import ubifs
|
||||
from ubi_io import ubi_file, leb_virtual_file
|
||||
from ui.common import extract_files, output_dir
|
||||
if __name__ == '__main__':
|
||||
os.system('echo "\n[NeoBoot] Zip file unzipped.\nInstallation in progress, please wait ..."')
|
||||
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)
|
||||
try:
|
||||
parser = argparse.ArgumentParser(usage=usage, description=description)
|
||||
except:
|
||||
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 = 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.')
|
||||
if len(sys.argv) == 1:
|
||||
parser.print_help()
|
||||
@@ -61,13 +68,14 @@ if __name__ == '__main__':
|
||||
if not os.path.exists(vol_out_path):
|
||||
os.makedirs(vol_out_path)
|
||||
elif os.listdir(vol_out_path):
|
||||
parser.error('Volume output directory is not empty. %s' % vol_out_path)
|
||||
parser.error(
|
||||
'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)
|
||||
|
||||
@@ -68,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)
|
||||
buf = self._fhandle.read(
|
||||
block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad)
|
||||
return buf
|
||||
|
||||
|
||||
@@ -91,7 +92,8 @@ class leb_virtual_file:
|
||||
self.seek(self.tell() + i)
|
||||
return self._last_buf[offset:offset + i]
|
||||
else:
|
||||
buf = self._ubi.file.read_block_data(self._ubi.blocks[self._blocks[leb]])
|
||||
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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import struct
|
||||
UBIFS_NODE_MAGIC = '1\x18\x10\x06'
|
||||
UBIFS_CRC32_INIT = 4294967295L
|
||||
UBIFS_CRC32_INIT = 4294967295
|
||||
UBIFS_MIN_COMPR_LEN = 128
|
||||
UBIFS_MIN_COMPRESS_DIFF = 64
|
||||
UBIFS_ROOT_INO = 1
|
||||
@@ -88,12 +88,12 @@ 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']
|
||||
'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'
|
||||
@@ -101,121 +101,121 @@ 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']
|
||||
'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']
|
||||
'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']
|
||||
'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']
|
||||
'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_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']
|
||||
'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']
|
||||
'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']
|
||||
'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']
|
||||
'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_SZ = struct.calcsize(UBIFS_IDX_NODE_FORMAT)
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
|
||||
@@ -19,7 +19,7 @@ class log:
|
||||
f.write('%s\n' % s)
|
||||
f.close()
|
||||
else:
|
||||
print '%s' % s
|
||||
print(('%s' % s))
|
||||
if self.exit_on_except:
|
||||
sys.exit()
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
#!/usr/bin/python
|
||||
#import lzo
|
||||
# import lzo
|
||||
import struct
|
||||
import zlib
|
||||
from ubifs.defines import *
|
||||
ino_types = ['file',
|
||||
'dir',
|
||||
'lnk',
|
||||
'blk',
|
||||
'chr',
|
||||
'fifo',
|
||||
'sock']
|
||||
'dir',
|
||||
'lnk',
|
||||
'blk',
|
||||
'chr',
|
||||
'fifo',
|
||||
'sock']
|
||||
node_types = ['ino',
|
||||
'data',
|
||||
'dent',
|
||||
'xent',
|
||||
'trun',
|
||||
'pad',
|
||||
'sb',
|
||||
'mst',
|
||||
'ref',
|
||||
'idx',
|
||||
'cs',
|
||||
'orph']
|
||||
'data',
|
||||
'dent',
|
||||
'xent',
|
||||
'trun',
|
||||
'pad',
|
||||
'sb',
|
||||
'mst',
|
||||
'ref',
|
||||
'idx',
|
||||
'cs',
|
||||
'orph']
|
||||
key_types = ['ino',
|
||||
'data',
|
||||
'dent',
|
||||
'xent']
|
||||
'data',
|
||||
'dent',
|
||||
'xent']
|
||||
|
||||
|
||||
def parse_key(key):
|
||||
@@ -34,13 +34,13 @@ def parse_key(key):
|
||||
key_type = lkey >> UBIFS_S_KEY_BLOCK_BITS
|
||||
khash = lkey
|
||||
return {'type': key_type,
|
||||
'ino_num': ino_num,
|
||||
'khash': khash}
|
||||
'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_LZO:
|
||||
# return lzo.decompress(''.join(('\xf0', struct.pack('>I', unc_len), data)))
|
||||
if ctype == UBIFS_COMPR_ZLIB:
|
||||
return zlib.decompress(data, -11)
|
||||
else:
|
||||
|
||||
@@ -7,7 +7,8 @@ from ubifs.misc import parse_key
|
||||
class common_hdr(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_COMMON_HDR_FIELDS, struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf)))
|
||||
fields = dict(list(zip(UBIFS_COMMON_HDR_FIELDS,
|
||||
struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -25,7 +26,8 @@ class common_hdr(object):
|
||||
class sb_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -41,7 +43,8 @@ class sb_node(object):
|
||||
class mst_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -57,7 +60,8 @@ class mst_node(object):
|
||||
class dent_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
if key == 'key':
|
||||
setattr(self, key, parse_key(fields[key]))
|
||||
@@ -78,7 +82,8 @@ class dent_node(object):
|
||||
class data_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
if key == 'key':
|
||||
setattr(self, key, parse_key(fields[key]))
|
||||
@@ -100,7 +105,8 @@ class data_node(object):
|
||||
class idx_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -118,7 +124,8 @@ class idx_node(object):
|
||||
class ino_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
if key == 'key':
|
||||
setattr(self, key, parse_key(fields[key]))
|
||||
@@ -139,7 +146,8 @@ class ino_node(object):
|
||||
class branch(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ def dents(ubifs, inodes, dent_node, path='', perms=False):
|
||||
try:
|
||||
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:
|
||||
|
||||
@@ -17,7 +17,8 @@ def index(ubifs, lnum, offset, inodes={}):
|
||||
inodes[ino_num] = {}
|
||||
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)
|
||||
datn = extract.data_node(
|
||||
ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ, chdr.len)
|
||||
ino_num = datn.key['ino_num']
|
||||
if ino_num not in inodes:
|
||||
inodes[ino_num] = {}
|
||||
|
||||
@@ -4,13 +4,15 @@ 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):
|
||||
try:
|
||||
inodes = {}
|
||||
walk.index(ubifs, ubifs.master_node.root_lnum, ubifs.master_node.root_offs, inodes)
|
||||
walk.index(ubifs, ubifs.master_node.root_lnum,
|
||||
ubifs.master_node.root_offs, inodes)
|
||||
for dent in inodes[1]['dent']:
|
||||
output.dents(ubifs, inodes, dent, out_path, perms)
|
||||
|
||||
@@ -22,23 +24,23 @@ def extract_files(ubifs, out_path, perms=False):
|
||||
|
||||
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'}
|
||||
'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 = {}
|
||||
@@ -56,7 +58,8 @@ def get_ubi_params(ubi):
|
||||
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_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])
|
||||
@@ -83,7 +86,7 @@ def get_ubi_params(ubi):
|
||||
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]}
|
||||
'args': ubi_args[img_seq][volume],
|
||||
'ini': ini_params[img_seq][volume]}
|
||||
|
||||
return ubi_params
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
|
||||
__version__ = '1.1'
|
||||
__all__ = ['ArgumentParser',
|
||||
'ArgumentError',
|
||||
'ArgumentTypeError',
|
||||
'FileType',
|
||||
'HelpFormatter',
|
||||
'ArgumentDefaultsHelpFormatter',
|
||||
'RawDescriptionHelpFormatter',
|
||||
'RawTextHelpFormatter',
|
||||
'Namespace',
|
||||
'Action',
|
||||
'ONE_OR_MORE',
|
||||
'OPTIONAL',
|
||||
'PARSER',
|
||||
'REMAINDER',
|
||||
'SUPPRESS',
|
||||
'ZERO_OR_MORE']
|
||||
'ArgumentError',
|
||||
'ArgumentTypeError',
|
||||
'FileType',
|
||||
'HelpFormatter',
|
||||
'ArgumentDefaultsHelpFormatter',
|
||||
'RawDescriptionHelpFormatter',
|
||||
'RawTextHelpFormatter',
|
||||
'Namespace',
|
||||
'Action',
|
||||
'ONE_OR_MORE',
|
||||
'OPTIONAL',
|
||||
'PARSER',
|
||||
'REMAINDER',
|
||||
'SUPPRESS',
|
||||
'ZERO_OR_MORE']
|
||||
import collections as _collections
|
||||
import copy as _copy
|
||||
import os as _os
|
||||
@@ -122,9 +122,9 @@ class HelpFormatter(object):
|
||||
else:
|
||||
heading = ''
|
||||
return join(['\n',
|
||||
heading,
|
||||
item_help,
|
||||
'\n'])
|
||||
heading,
|
||||
item_help,
|
||||
'\n'])
|
||||
return
|
||||
|
||||
def _add_item(self, func, args):
|
||||
@@ -148,9 +148,9 @@ class HelpFormatter(object):
|
||||
def add_usage(self, usage, actions, groups, prefix=None):
|
||||
if usage is not SUPPRESS:
|
||||
args = (usage,
|
||||
actions,
|
||||
groups,
|
||||
prefix)
|
||||
actions,
|
||||
groups,
|
||||
prefix)
|
||||
self._add_item(self._format_usage, args)
|
||||
|
||||
def add_argument(self, action):
|
||||
@@ -162,7 +162,8 @@ class HelpFormatter(object):
|
||||
|
||||
invocation_length = max([len(s) for s in invocations])
|
||||
action_length = invocation_length + self._current_indent
|
||||
self._action_max_length = max(self._action_max_length, action_length)
|
||||
self._action_max_length = max(
|
||||
self._action_max_length, action_length)
|
||||
self._add_item(self._format_action, [action])
|
||||
|
||||
def add_arguments(self, actions):
|
||||
@@ -325,7 +326,8 @@ class HelpFormatter(object):
|
||||
return self._fill_text(text, text_width, indent) + '\n\n'
|
||||
|
||||
def _format_action(self, action):
|
||||
help_position = min(self._action_max_length + 2, self._max_help_position)
|
||||
help_position = min(self._action_max_length +
|
||||
2, self._max_help_position)
|
||||
help_width = self._width - help_position
|
||||
action_width = help_position - self._current_indent - 2
|
||||
action_header = self._format_action_invocation(action)
|
||||
@@ -334,9 +336,9 @@ class HelpFormatter(object):
|
||||
action_header = '%*s%s\n' % tup
|
||||
elif len(action_header) <= action_width:
|
||||
tup = (self._current_indent,
|
||||
'',
|
||||
action_width,
|
||||
action_header)
|
||||
'',
|
||||
action_width,
|
||||
action_header)
|
||||
action_header = '%*s%-*s ' % tup
|
||||
indent_first = 0
|
||||
else:
|
||||
@@ -521,14 +523,14 @@ class Action(_AttributeHolder):
|
||||
|
||||
def _get_kwargs(self):
|
||||
names = ['option_strings',
|
||||
'dest',
|
||||
'nargs',
|
||||
'const',
|
||||
'default',
|
||||
'type',
|
||||
'choices',
|
||||
'help',
|
||||
'metavar']
|
||||
'dest',
|
||||
'nargs',
|
||||
'const',
|
||||
'default',
|
||||
'type',
|
||||
'choices',
|
||||
'help',
|
||||
'metavar']
|
||||
return [(name, getattr(self, name)) for name in names]
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -539,10 +541,12 @@ class _StoreAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None):
|
||||
if nargs == 0:
|
||||
raise ValueError('nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriate')
|
||||
raise ValueError(
|
||||
'nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriate')
|
||||
if const is not None and nargs != OPTIONAL:
|
||||
raise ValueError('nargs must be %r to supply const' % OPTIONAL)
|
||||
super(_StoreAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const, default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
super(_StoreAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const,
|
||||
default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
return
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -552,7 +556,8 @@ class _StoreAction(Action):
|
||||
class _StoreConstAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None, metavar=None):
|
||||
super(_StoreConstAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, const=const, default=default, required=required, help=help)
|
||||
super(_StoreConstAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, nargs=0, const=const, default=default, required=required, help=help)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
setattr(namespace, self.dest, self.const)
|
||||
@@ -561,23 +566,27 @@ class _StoreConstAction(Action):
|
||||
class _StoreTrueAction(_StoreConstAction):
|
||||
|
||||
def __init__(self, option_strings, dest, default=False, required=False, help=None):
|
||||
super(_StoreTrueAction, self).__init__(option_strings=option_strings, dest=dest, const=True, default=default, required=required, help=help)
|
||||
super(_StoreTrueAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, const=True, default=default, required=required, help=help)
|
||||
|
||||
|
||||
class _StoreFalseAction(_StoreConstAction):
|
||||
|
||||
def __init__(self, option_strings, dest, default=True, required=False, help=None):
|
||||
super(_StoreFalseAction, self).__init__(option_strings=option_strings, dest=dest, const=False, default=default, required=required, help=help)
|
||||
super(_StoreFalseAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, const=False, default=default, required=required, help=help)
|
||||
|
||||
|
||||
class _AppendAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None):
|
||||
if nargs == 0:
|
||||
raise ValueError('nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriate')
|
||||
raise ValueError(
|
||||
'nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriate')
|
||||
if const is not None and nargs != OPTIONAL:
|
||||
raise ValueError('nargs must be %r to supply const' % OPTIONAL)
|
||||
super(_AppendAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const, default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
super(_AppendAction, self).__init__(option_strings=option_strings, dest=dest, nargs=nargs, const=const,
|
||||
default=default, type=type, choices=choices, required=required, help=help, metavar=metavar)
|
||||
return
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -589,7 +598,8 @@ class _AppendAction(Action):
|
||||
class _AppendConstAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None, metavar=None):
|
||||
super(_AppendConstAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, const=const, default=default, required=required, help=help, metavar=metavar)
|
||||
super(_AppendConstAction, self).__init__(option_strings=option_strings, dest=dest,
|
||||
nargs=0, const=const, default=default, required=required, help=help, metavar=metavar)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
items = _copy.copy(_ensure_value(namespace, self.dest, []))
|
||||
@@ -600,7 +610,8 @@ class _AppendConstAction(Action):
|
||||
class _CountAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest, default=None, required=False, help=None):
|
||||
super(_CountAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, default=default, required=required, help=help)
|
||||
super(_CountAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, nargs=0, default=default, required=required, help=help)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
new_count = _ensure_value(namespace, self.dest, 0) + 1
|
||||
@@ -610,7 +621,8 @@ class _CountAction(Action):
|
||||
class _HelpAction(Action):
|
||||
|
||||
def __init__(self, option_strings, dest=SUPPRESS, default=SUPPRESS, help=None):
|
||||
super(_HelpAction, self).__init__(option_strings=option_strings, dest=dest, default=default, nargs=0, help=help)
|
||||
super(_HelpAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, default=default, nargs=0, help=help)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
parser.print_help()
|
||||
@@ -620,7 +632,8 @@ class _HelpAction(Action):
|
||||
class _VersionAction(Action):
|
||||
|
||||
def __init__(self, option_strings, version=None, dest=SUPPRESS, default=SUPPRESS, help="show program's version number and exit"):
|
||||
super(_VersionAction, self).__init__(option_strings=option_strings, dest=dest, default=default, nargs=0, help=help)
|
||||
super(_VersionAction, self).__init__(option_strings=option_strings,
|
||||
dest=dest, default=default, nargs=0, help=help)
|
||||
self.version = version
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
@@ -646,7 +659,8 @@ class _SubParsersAction(Action):
|
||||
self._parser_class = parser_class
|
||||
self._name_parser_map = _collections.OrderedDict()
|
||||
self._choices_actions = []
|
||||
super(_SubParsersAction, self).__init__(option_strings=option_strings, dest=dest, nargs=PARSER, choices=self._name_parser_map, help=help, metavar=metavar)
|
||||
super(_SubParsersAction, self).__init__(option_strings=option_strings, dest=dest,
|
||||
nargs=PARSER, choices=self._name_parser_map, help=help, metavar=metavar)
|
||||
|
||||
def add_parser(self, name, **kwargs):
|
||||
if kwargs.get('prog') is None:
|
||||
@@ -674,7 +688,8 @@ class _SubParsersAction(Action):
|
||||
msg = _('unknown parser %r (choices: %s)') % tup
|
||||
raise ArgumentError(self, msg)
|
||||
|
||||
namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)
|
||||
namespace, arg_strings = parser.parse_known_args(
|
||||
arg_strings, namespace)
|
||||
if arg_strings:
|
||||
vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
|
||||
getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)
|
||||
@@ -799,7 +814,8 @@ class _ActionsContainer(object):
|
||||
try:
|
||||
self._get_formatter()._format_args(action, None)
|
||||
except TypeError:
|
||||
raise ValueError('length of metavar tuple does not match nargs')
|
||||
raise ValueError(
|
||||
'length of metavar tuple does not match nargs')
|
||||
|
||||
return self._add_action(action)
|
||||
|
||||
@@ -841,12 +857,14 @@ class _ActionsContainer(object):
|
||||
group_map = {}
|
||||
for group in container._action_groups:
|
||||
if group.title not in title_group_map:
|
||||
title_group_map[group.title] = self.add_argument_group(title=group.title, description=group.description, conflict_handler=group.conflict_handler)
|
||||
title_group_map[group.title] = self.add_argument_group(
|
||||
title=group.title, description=group.description, conflict_handler=group.conflict_handler)
|
||||
for action in group._group_actions:
|
||||
group_map[action] = title_group_map[group.title]
|
||||
|
||||
for group in container._mutually_exclusive_groups:
|
||||
mutex_group = self.add_mutually_exclusive_group(required=group.required)
|
||||
mutex_group = self.add_mutually_exclusive_group(
|
||||
required=group.required)
|
||||
for action in group._group_actions:
|
||||
group_map[action] = mutex_group
|
||||
|
||||
@@ -915,7 +933,8 @@ class _ActionsContainer(object):
|
||||
|
||||
def _handle_conflict_error(self, action, conflicting_actions):
|
||||
message = _('conflicting option string(s): %s')
|
||||
conflict_string = ', '.join([option_string for option_string, action in conflicting_actions])
|
||||
conflict_string = ', '.join(
|
||||
[option_string for option_string, action in conflicting_actions])
|
||||
raise ArgumentError(action, message % conflict_string)
|
||||
|
||||
def _handle_conflict_resolve(self, action, conflicting_actions):
|
||||
@@ -981,9 +1000,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
def __init__(self, prog=None, usage=None, description=None, epilog=None, version=None, parents=[], formatter_class=HelpFormatter, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True):
|
||||
if version is not None:
|
||||
import warnings
|
||||
warnings.warn('The "version" argument to ArgumentParser is deprecated. Please use "add_argument(..., action=\'version\', version="N", ...)" instead', DeprecationWarning)
|
||||
warnings.warn(
|
||||
'The "version" argument to ArgumentParser is deprecated. Please use "add_argument(..., action=\'version\', version="N", ...)" instead', DeprecationWarning)
|
||||
superinit = super(ArgumentParser, self).__init__
|
||||
superinit(description=description, prefix_chars=prefix_chars, argument_default=argument_default, conflict_handler=conflict_handler)
|
||||
superinit(description=description, prefix_chars=prefix_chars,
|
||||
argument_default=argument_default, conflict_handler=conflict_handler)
|
||||
if prog is None:
|
||||
prog = _os.path.basename(_sys.argv[0])
|
||||
self.prog = prog
|
||||
@@ -1004,9 +1025,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
self.register('type', None, identity)
|
||||
default_prefix = '-' if '-' in prefix_chars else prefix_chars[0]
|
||||
if self.add_help:
|
||||
self.add_argument(default_prefix + 'h', default_prefix * 2 + 'help', action='help', default=SUPPRESS, help=_('show this help message and exit'))
|
||||
self.add_argument(default_prefix + 'h', default_prefix * 2 + 'help',
|
||||
action='help', default=SUPPRESS, help=_('show this help message and exit'))
|
||||
if self.version:
|
||||
self.add_argument(default_prefix + 'v', default_prefix * 2 + 'version', action='version', default=SUPPRESS, version=self.version, help=_("show program's version number and exit"))
|
||||
self.add_argument(default_prefix + 'v', default_prefix * 2 + 'version', action='version',
|
||||
default=SUPPRESS, version=self.version, help=_("show program's version number and exit"))
|
||||
for parent in parents:
|
||||
self._add_container_actions(parent)
|
||||
try:
|
||||
@@ -1020,12 +1043,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def _get_kwargs(self):
|
||||
names = ['prog',
|
||||
'usage',
|
||||
'description',
|
||||
'version',
|
||||
'formatter_class',
|
||||
'conflict_handler',
|
||||
'add_help']
|
||||
'usage',
|
||||
'description',
|
||||
'version',
|
||||
'formatter_class',
|
||||
'conflict_handler',
|
||||
'add_help']
|
||||
return [(name, getattr(self, name)) for name in names]
|
||||
|
||||
def add_subparsers(self, **kwargs):
|
||||
@@ -1079,7 +1102,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
if not hasattr(namespace, action.dest):
|
||||
if action.default is not SUPPRESS:
|
||||
default = action.default
|
||||
if isinstance(action.default, basestring):
|
||||
if isinstance(action.default, str):
|
||||
default = self._get_value(action, default)
|
||||
setattr(namespace, action.dest, default)
|
||||
|
||||
@@ -1213,7 +1236,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
else:
|
||||
max_option_string_index = -1
|
||||
while start_index <= max_option_string_index:
|
||||
next_option_string_index = min([index for index in option_string_indices if index >= start_index])
|
||||
next_option_string_index = min(
|
||||
[index for index in option_string_indices if index >= start_index])
|
||||
if start_index != next_option_string_index:
|
||||
positionals_end_index = consume_positionals(start_index)
|
||||
if positionals_end_index > start_index:
|
||||
@@ -1243,7 +1267,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
if action in seen_non_default_actions:
|
||||
break
|
||||
else:
|
||||
names = [_get_action_name(action) for action in group._group_actions if action.help is not SUPPRESS]
|
||||
names = [_get_action_name(
|
||||
action) for action in group._group_actions if action.help is not SUPPRESS]
|
||||
msg = _('one of the arguments %s is required')
|
||||
self.error(msg % ' '.join(names))
|
||||
|
||||
@@ -1282,8 +1307,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
match = _re.match(nargs_pattern, arg_strings_pattern)
|
||||
if match is None:
|
||||
nargs_errors = {None: _('expected one argument'),
|
||||
OPTIONAL: _('expected at most one argument'),
|
||||
ONE_OR_MORE: _('expected at least one argument')}
|
||||
OPTIONAL: _('expected at most one argument'),
|
||||
ONE_OR_MORE: _('expected at least one argument')}
|
||||
default = _('expected %s argument(s)') % action.nargs
|
||||
msg = nargs_errors.get(action.nargs, default)
|
||||
raise ArgumentError(action, msg)
|
||||
@@ -1293,7 +1318,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
result = []
|
||||
for i in range(len(actions), 0, -1):
|
||||
actions_slice = actions[:i]
|
||||
pattern = ''.join([self._get_nargs_pattern(action) for action in actions_slice])
|
||||
pattern = ''.join([self._get_nargs_pattern(action)
|
||||
for action in actions_slice])
|
||||
match = _re.match(pattern, arg_strings_pattern)
|
||||
if match is not None:
|
||||
result.extend([len(string) for string in match.groups()])
|
||||
@@ -1319,7 +1345,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
return (action, option_string, explicit_arg)
|
||||
option_tuples = self._get_option_tuples(arg_string)
|
||||
if len(option_tuples) > 1:
|
||||
options = ', '.join([option_string for action, option_string, explicit_arg in option_tuples])
|
||||
options = ', '.join(
|
||||
[option_string for action, option_string, explicit_arg in option_tuples])
|
||||
tup = (arg_string, options)
|
||||
self.error(_('ambiguous option: %s could match %s') % tup)
|
||||
elif len(option_tuples) == 1:
|
||||
@@ -1396,7 +1423,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
value = action.const
|
||||
else:
|
||||
value = action.default
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, str):
|
||||
value = self._get_value(action, value)
|
||||
self._check_value(action, value)
|
||||
elif not arg_strings and action.nargs == ZERO_OR_MORE and not action.option_strings:
|
||||
@@ -1448,12 +1475,14 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def format_usage(self):
|
||||
formatter = self._get_formatter()
|
||||
formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_groups)
|
||||
formatter.add_usage(self.usage, self._actions,
|
||||
self._mutually_exclusive_groups)
|
||||
return formatter.format_help()
|
||||
|
||||
def format_help(self):
|
||||
formatter = self._get_formatter()
|
||||
formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_groups)
|
||||
formatter.add_usage(self.usage, self._actions,
|
||||
self._mutually_exclusive_groups)
|
||||
formatter.add_text(self.description)
|
||||
for action_group in self._action_groups:
|
||||
formatter.start_section(action_group.title)
|
||||
@@ -1466,7 +1495,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def format_version(self):
|
||||
import warnings
|
||||
warnings.warn('The format_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
warnings.warn(
|
||||
'The format_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
formatter = self._get_formatter()
|
||||
formatter.add_text(self.version)
|
||||
return formatter.format_help()
|
||||
@@ -1488,7 +1518,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
|
||||
def print_version(self, file=None):
|
||||
import warnings
|
||||
warnings.warn('The print_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
warnings.warn(
|
||||
'The print_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.', DeprecationWarning)
|
||||
self._print_message(self.format_version(), file)
|
||||
|
||||
def _print_message(self, message, file=None):
|
||||
|
||||
@@ -17,16 +17,18 @@ class ubi:
|
||||
self._block_count = len(self.blocks)
|
||||
if self._block_count <= 0:
|
||||
raise Exception('No blocks found.')
|
||||
layout_list, data_list, int_vol_list, unknown_list = sort.by_type(self.blocks)
|
||||
layout_list, data_list, int_vol_list, unknown_list = sort.by_type(
|
||||
self.blocks)
|
||||
self._layout_blocks_list = layout_list
|
||||
self._data_blocks_list = data_list
|
||||
self._int_vol_blocks_list = int_vol_list
|
||||
self._unknown_blocks_list = unknown_list
|
||||
arbitrary_block = self.blocks.itervalues().next()
|
||||
arbitrary_block = next(iter(self.blocks.values()))
|
||||
self._min_io_size = arbitrary_block.ec_hdr.vid_hdr_offset
|
||||
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)
|
||||
layout_infos = layout.associate_blocks(
|
||||
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]))
|
||||
|
||||
@@ -17,10 +17,12 @@ class description(object):
|
||||
self.vtbl_recs = []
|
||||
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])
|
||||
self.vid_hdr = extract_vid_hdr(
|
||||
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(block_buf[self.ec_hdr.data_offset:])
|
||||
self.vtbl_recs = extract_vtbl_rec(
|
||||
block_buf[self.ec_hdr.data_offset:])
|
||||
self.leb_num = self.vid_hdr.lnum
|
||||
self.is_vtbl = bool(self.vtbl_recs) or False
|
||||
self.is_valid = not self.ec_hdr.errors and not self.vid_hdr.errors
|
||||
|
||||
@@ -18,7 +18,8 @@ def group_pairs(blocks, layout_blocks_list):
|
||||
def associate_blocks(blocks, layout_pairs, start_peb_num):
|
||||
seq_blocks = []
|
||||
for layout_pair in layout_pairs:
|
||||
seq_blocks = sort.by_image_seq(blocks, blocks[layout_pair[0]].ec_hdr.image_seq)
|
||||
seq_blocks = sort.by_image_seq(
|
||||
blocks, blocks[layout_pair[0]].ec_hdr.image_seq)
|
||||
layout_pair.append(seq_blocks)
|
||||
|
||||
return layout_pairs
|
||||
|
||||
@@ -18,7 +18,7 @@ def by_image_seq(blocks, image_seq):
|
||||
|
||||
|
||||
def by_range(blocks, block_range):
|
||||
peb_range = range(block_range[0], block_range[1])
|
||||
peb_range = list(range(block_range[0], block_range[1]))
|
||||
return [i for i in blocks if i in peb_range]
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ def by_leb(blocks):
|
||||
slist[blocks[block].leb_num] = block
|
||||
|
||||
return slist
|
||||
return sorted(blocks.iterkeys(), key=lambda x: blocks[x].leb_num)
|
||||
return sorted(iter(blocks.keys()), key=lambda x: blocks[x].leb_num)
|
||||
|
||||
|
||||
def by_vol_id(blocks, slist=None):
|
||||
@@ -79,6 +79,6 @@ def by_type(blocks, slist=None):
|
||||
unknown.append(i)
|
||||
|
||||
return (layout,
|
||||
data,
|
||||
int_vol,
|
||||
unknown)
|
||||
data,
|
||||
int_vol,
|
||||
unknown)
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
#!/usr/bin/python
|
||||
import struct
|
||||
UBI_CRC32_INIT = 4294967295L
|
||||
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']
|
||||
'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']
|
||||
'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']
|
||||
'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
|
||||
@@ -55,9 +55,9 @@ UBI_COMPAT_RO = 2
|
||||
UBI_COMPAT_PRESERVE = 4
|
||||
UBI_COMPAT_REJECT = 5
|
||||
PRINT_COMPAT_LIST = [0,
|
||||
'Delete',
|
||||
'Read Only',
|
||||
0,
|
||||
'Preserve',
|
||||
'Reject']
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
'Delete',
|
||||
'Read Only',
|
||||
0,
|
||||
'Preserve',
|
||||
'Reject']
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
|
||||
@@ -3,77 +3,77 @@ from ubi.defines import PRINT_COMPAT_LIST, PRINT_VOL_TYPE_LIST, UBI_VTBL_AUTORES
|
||||
|
||||
|
||||
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(('%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)
|
||||
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
|
||||
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'
|
||||
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)
|
||||
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
|
||||
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
|
||||
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)
|
||||
|
||||
print '\n'
|
||||
print('\n')
|
||||
|
||||
|
||||
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)
|
||||
print(('%s%s: %r' % (tab, key, value)))
|
||||
|
||||
|
||||
def vid_hdr(vid_hdr, tab=''):
|
||||
@@ -90,7 +90,7 @@ def vid_hdr(vid_hdr, tab=''):
|
||||
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=''):
|
||||
@@ -106,4 +106,4 @@ def vol_rec(vol_rec, tab=''):
|
||||
value = 'autoresize'
|
||||
elif key == 'name':
|
||||
value = value.strip('\x00')
|
||||
print '%s%s: %s' % (tab, key, value)
|
||||
print(('%s%s: %s' % (tab, key, value)))
|
||||
|
||||
@@ -7,7 +7,8 @@ from ubi.headers import errors
|
||||
class ec_hdr(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(EC_HDR_FIELDS, struct.unpack(EC_HDR_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(EC_HDR_FIELDS, struct.unpack(EC_HDR_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -25,7 +26,8 @@ class ec_hdr(object):
|
||||
class vid_hdr(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(VID_HDR_FIELDS, struct.unpack(VID_HDR_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(VID_HDR_FIELDS, struct.unpack(VID_HDR_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -43,7 +45,8 @@ class vid_hdr(object):
|
||||
class vtbl_rec(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(VTBL_REC_FIELDS, struct.unpack(VTBL_REC_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(VTBL_REC_FIELDS, struct.unpack(VTBL_REC_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ from ubi.defines import *
|
||||
|
||||
|
||||
def ec_hdr(ec_hdr, buf):
|
||||
if ec_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295L:
|
||||
if ec_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
|
||||
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]) & 4294967295L:
|
||||
if vid_hdr.hdr_crc != ~crc32(buf[:-4]) & 4294967295:
|
||||
vid_hdr.errors.append('crc')
|
||||
return vid_hdr
|
||||
|
||||
@@ -22,7 +22,7 @@ def vtbl_rec(vtbl_rec, buf):
|
||||
likely_vtbl = False
|
||||
elif vtbl_rec.vol_type not in (1, 2):
|
||||
likely_vtbl = False
|
||||
if vtbl_rec.crc != ~crc32(buf[:-4]) & 4294967295L:
|
||||
if vtbl_rec.crc != ~crc32(buf[:-4]) & 4294967295:
|
||||
vtbl_rec.errors.append('crc')
|
||||
if not likely_vtbl:
|
||||
vtbl_rec.errors = ['False']
|
||||
|
||||
@@ -18,7 +18,7 @@ class description(object):
|
||||
return 'Image: %s' % self.image_seq
|
||||
|
||||
def get_blocks(self, blocks):
|
||||
return get_blocks_in_list(blocks, 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]
|
||||
|
||||
@@ -63,6 +63,7 @@ def get_volumes(blocks, layout_info):
|
||||
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])
|
||||
volumes[vol_name] = description(
|
||||
vol_rec.rec_index, vol_rec, vol_blocks_lists[vol_rec.rec_index])
|
||||
|
||||
return volumes
|
||||
|
||||
@@ -16,12 +16,18 @@ if __name__ == '__main__':
|
||||
try:
|
||||
parser = argparse.ArgumentParser(usage=usage, description=description)
|
||||
except:
|
||||
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 = 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.')
|
||||
if len(sys.argv) == 1:
|
||||
parser.print_help()
|
||||
@@ -58,13 +64,14 @@ if __name__ == '__main__':
|
||||
if not os.path.exists(vol_out_path):
|
||||
os.makedirs(vol_out_path)
|
||||
elif os.listdir(vol_out_path):
|
||||
parser.error('Volume output directory is not empty. %s' % vol_out_path)
|
||||
parser.error(
|
||||
'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)
|
||||
|
||||
@@ -68,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)
|
||||
buf = self._fhandle.read(
|
||||
block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad)
|
||||
return buf
|
||||
|
||||
|
||||
@@ -91,7 +92,8 @@ class leb_virtual_file:
|
||||
self.seek(self.tell() + i)
|
||||
return self._last_buf[offset:offset + i]
|
||||
else:
|
||||
buf = self._ubi.file.read_block_data(self._ubi.blocks[self._blocks[leb]])
|
||||
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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import struct
|
||||
UBIFS_NODE_MAGIC = '1\x18\x10\x06'
|
||||
UBIFS_CRC32_INIT = 4294967295L
|
||||
UBIFS_CRC32_INIT = 4294967295
|
||||
UBIFS_MIN_COMPR_LEN = 128
|
||||
UBIFS_MIN_COMPRESS_DIFF = 64
|
||||
UBIFS_ROOT_INO = 1
|
||||
@@ -88,12 +88,12 @@ 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']
|
||||
'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'
|
||||
@@ -101,121 +101,121 @@ 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']
|
||||
'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']
|
||||
'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']
|
||||
'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']
|
||||
'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_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']
|
||||
'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']
|
||||
'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']
|
||||
'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']
|
||||
'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_SZ = struct.calcsize(UBIFS_IDX_NODE_FORMAT)
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
FILE_CHUNK_SZ = 5242880
|
||||
|
||||
@@ -19,7 +19,7 @@ class log:
|
||||
f.write('%s\n' % s)
|
||||
f.close()
|
||||
else:
|
||||
print '%s' % s
|
||||
print(('%s' % s))
|
||||
if self.exit_on_except:
|
||||
sys.exit()
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
#!/usr/bin/python
|
||||
import lzo
|
||||
from . import lzo
|
||||
import struct
|
||||
import zlib
|
||||
from ubifs.defines import *
|
||||
ino_types = ['file',
|
||||
'dir',
|
||||
'lnk',
|
||||
'blk',
|
||||
'chr',
|
||||
'fifo',
|
||||
'sock']
|
||||
'dir',
|
||||
'lnk',
|
||||
'blk',
|
||||
'chr',
|
||||
'fifo',
|
||||
'sock']
|
||||
node_types = ['ino',
|
||||
'data',
|
||||
'dent',
|
||||
'xent',
|
||||
'trun',
|
||||
'pad',
|
||||
'sb',
|
||||
'mst',
|
||||
'ref',
|
||||
'idx',
|
||||
'cs',
|
||||
'orph']
|
||||
'data',
|
||||
'dent',
|
||||
'xent',
|
||||
'trun',
|
||||
'pad',
|
||||
'sb',
|
||||
'mst',
|
||||
'ref',
|
||||
'idx',
|
||||
'cs',
|
||||
'orph']
|
||||
key_types = ['ino',
|
||||
'data',
|
||||
'dent',
|
||||
'xent']
|
||||
'data',
|
||||
'dent',
|
||||
'xent']
|
||||
|
||||
|
||||
def parse_key(key):
|
||||
@@ -34,8 +34,8 @@ def parse_key(key):
|
||||
key_type = lkey >> UBIFS_S_KEY_BLOCK_BITS
|
||||
khash = lkey
|
||||
return {'type': key_type,
|
||||
'ino_num': ino_num,
|
||||
'khash': khash}
|
||||
'ino_num': ino_num,
|
||||
'khash': khash}
|
||||
|
||||
|
||||
def decompress(ctype, unc_len, data):
|
||||
|
||||
@@ -7,7 +7,8 @@ from ubifs.misc import parse_key
|
||||
class common_hdr(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_COMMON_HDR_FIELDS, struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf)))
|
||||
fields = dict(list(zip(UBIFS_COMMON_HDR_FIELDS,
|
||||
struct.unpack(UBIFS_COMMON_HDR_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -25,7 +26,8 @@ class common_hdr(object):
|
||||
class sb_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_SB_NODE_FIELDS, struct.unpack(UBIFS_SB_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -41,7 +43,8 @@ class sb_node(object):
|
||||
class mst_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_MST_NODE_FIELDS, struct.unpack(UBIFS_MST_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -57,7 +60,8 @@ class mst_node(object):
|
||||
class dent_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_DENT_NODE_FIELDS, struct.unpack(UBIFS_DENT_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
if key == 'key':
|
||||
setattr(self, key, parse_key(fields[key]))
|
||||
@@ -78,7 +82,8 @@ class dent_node(object):
|
||||
class data_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_DATA_NODE_FIELDS, struct.unpack(UBIFS_DATA_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
if key == 'key':
|
||||
setattr(self, key, parse_key(fields[key]))
|
||||
@@ -100,7 +105,8 @@ class data_node(object):
|
||||
class idx_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_IDX_NODE_FIELDS, struct.unpack(UBIFS_IDX_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
@@ -118,7 +124,8 @@ class idx_node(object):
|
||||
class ino_node(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_INO_NODE_FIELDS, struct.unpack(UBIFS_INO_NODE_FORMAT, buf))))
|
||||
for key in fields:
|
||||
if key == 'key':
|
||||
setattr(self, key, parse_key(fields[key]))
|
||||
@@ -139,7 +146,8 @@ class ino_node(object):
|
||||
class branch(object):
|
||||
|
||||
def __init__(self, buf):
|
||||
fields = dict(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf)))
|
||||
fields = dict(
|
||||
list(zip(UBIFS_BRANCH_FIELDS, struct.unpack(UBIFS_BRANCH_FORMAT, buf))))
|
||||
for key in fields:
|
||||
setattr(self, key, fields[key])
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ def dents(ubifs, inodes, dent_node, path='', perms=False):
|
||||
try:
|
||||
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:
|
||||
|
||||
@@ -17,7 +17,8 @@ def index(ubifs, lnum, offset, inodes={}):
|
||||
inodes[ino_num] = {}
|
||||
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)
|
||||
datn = extract.data_node(
|
||||
ubifs, lnum, offset + UBIFS_COMMON_HDR_SZ, chdr.len)
|
||||
ino_num = datn.key['ino_num']
|
||||
if ino_num not in inodes:
|
||||
inodes[ino_num] = {}
|
||||
|
||||
@@ -4,13 +4,15 @@ 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):
|
||||
try:
|
||||
inodes = {}
|
||||
walk.index(ubifs, ubifs.master_node.root_lnum, ubifs.master_node.root_offs, inodes)
|
||||
walk.index(ubifs, ubifs.master_node.root_lnum,
|
||||
ubifs.master_node.root_offs, inodes)
|
||||
for dent in inodes[1]['dent']:
|
||||
output.dents(ubifs, inodes, dent, out_path, perms)
|
||||
|
||||
@@ -22,23 +24,23 @@ def extract_files(ubifs, out_path, perms=False):
|
||||
|
||||
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'}
|
||||
'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 = {}
|
||||
@@ -56,7 +58,8 @@ def get_ubi_params(ubi):
|
||||
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_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])
|
||||
@@ -83,7 +86,7 @@ def get_ubi_params(ubi):
|
||||
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]}
|
||||
'args': ubi_args[img_seq][volume],
|
||||
'ini': ini_params[img_seq][volume]}
|
||||
|
||||
return ubi_params
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#from __init__ import _
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
# 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 enigma import getDesktop
|
||||
@@ -77,7 +77,7 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
<widget name="key_blue" position="1233,760" zPosition="1" size="272,56" font="baslk; 35" halign="center" valign="center" backgroundColor="#0000FF" transparent="1" foregroundColor="blue" />\
|
||||
</screen>"""
|
||||
else:
|
||||
skin = """<screen position="0,0" size="1280,720" title="NeoBoot - Installation">
|
||||
skin = """<screen position="0,0" size="1280,720" title="NeoBoot - Installation">
|
||||
<ePixmap position="0,0" zPosition="-1" size="1280,720" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/1frame_base-fs8.png" />
|
||||
<eLabel text="NeoBoot opcje dla instalowanego obrazu" font="Regular; 28" position="10,30" size="700,30" halign="center" foregroundColor="#58ccff" backgroundColor="black" transparent="1" />
|
||||
<widget name="config" position="0,150" size="780,450" font="Regular; 22" itemHeight="32" scrollbarMode="showOnDemand" transparent="1" backgroundColor="transpBlack" />
|
||||
@@ -126,7 +126,7 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
if fn.find('.tar') != -1:
|
||||
fn = fn.replace('.tar.gz', '')
|
||||
sourcelist.append((fn, fn))
|
||||
continue
|
||||
continue
|
||||
if fn.find('.mb') != -1:
|
||||
fn = fn.replace('.mb', '')
|
||||
sourcelist.append((fn, fn))
|
||||
@@ -139,17 +139,17 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
sourcelist = [('None', 'None')]
|
||||
self.source = ConfigSelection(choices=sourcelist)
|
||||
self.target = ConfigText(fixed_size=False)
|
||||
self.CopyFiles = ConfigYesNo(default=True)
|
||||
self.CopyFiles = ConfigYesNo(default=True)
|
||||
if "vu" + getBoxVuModel() == getBoxHostName():
|
||||
self.CopyKernel = ConfigYesNo(default=True)
|
||||
self.CopyKernel = ConfigYesNo(default=True)
|
||||
else:
|
||||
self.CopyKernel = ConfigYesNo(default=False)
|
||||
self.TvList = ConfigYesNo(default=False)
|
||||
self.LanWlan = ConfigYesNo(default=False)
|
||||
if "vu" + getBoxVuModel() == getBoxHostName():
|
||||
if "vu" + getBoxVuModel() == getBoxHostName():
|
||||
self.Sterowniki = ConfigYesNo(default=False)
|
||||
else:
|
||||
self.Sterowniki = ConfigYesNo(default=True)
|
||||
self.Sterowniki = ConfigYesNo(default=True)
|
||||
self.Montowanie = ConfigYesNo(default=False)
|
||||
self.InstallSettings = ConfigYesNo(default=False)
|
||||
self.ZipDelete = ConfigYesNo(default=False)
|
||||
@@ -157,13 +157,13 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
self.SoftCam = ConfigYesNo(default=False)
|
||||
self.MediaPortal = ConfigYesNo(default=False)
|
||||
self.PiconR = ConfigYesNo(default=False)
|
||||
self.Kodi = ConfigYesNo(default=False)
|
||||
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 not "dm500hd" in line and not "dm800se" in line and not "dm800" in line and not "dm8000" in line:
|
||||
self.Nandsim = ConfigYesNo(default=True)
|
||||
else:
|
||||
self.Nandsim = ConfigYesNo(default=False)
|
||||
else:
|
||||
self.Nandsim = ConfigYesNo(default=False)
|
||||
self.target.value = ''
|
||||
self.curselimage = ''
|
||||
try:
|
||||
@@ -177,13 +177,13 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
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)
|
||||
'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'))
|
||||
@@ -193,27 +193,43 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
|
||||
def createSetup(self):
|
||||
self.list = []
|
||||
self.list.append(getConfigListEntry(_('Source Image file'), self.source))
|
||||
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))
|
||||
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(
|
||||
_('Use Nandsim to install image ?'), self.Nandsim))
|
||||
|
||||
def HelpInstall(self):
|
||||
self.session.open(HelpInstall)
|
||||
self.session.open(HelpInstall)
|
||||
|
||||
def typeChange(self, value):
|
||||
self.createSetup()
|
||||
@@ -230,7 +246,8 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
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)
|
||||
self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title=self['config'].getCurrent()[
|
||||
0], text=self['config'].getCurrent()[1].value)
|
||||
return
|
||||
|
||||
def VirtualKeyBoardCallback(self, callback=None):
|
||||
@@ -240,56 +257,62 @@ class InstallImage(Screen, ConfigListScreen):
|
||||
return
|
||||
|
||||
def imageInstall(self):
|
||||
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.')
|
||||
continue
|
||||
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.')
|
||||
continue
|
||||
|
||||
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':
|
||||
myerror = _('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.')
|
||||
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 += "'"
|
||||
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])
|
||||
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':
|
||||
myerror = _(
|
||||
'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.')
|
||||
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 += "'"
|
||||
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])
|
||||
|
||||
def cancel(self):
|
||||
self.close()
|
||||
@@ -312,11 +335,11 @@ class HelpInstall(Screen):
|
||||
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})
|
||||
'ok': self.close,
|
||||
'up': self['lab1'].pageUp,
|
||||
'left': self['lab1'].pageUp,
|
||||
'down': self['lab1'].pageDown,
|
||||
'right': self['lab1'].pageDown})
|
||||
self['lab1'].hide()
|
||||
self.updatetext()
|
||||
|
||||
|
||||
@@ -4,17 +4,17 @@ 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"
|
||||
# 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'
|
||||
@@ -23,14 +23,14 @@ import os
|
||||
# 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
|
||||
# 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___
|
||||
# ____ 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 +88,7 @@ ImageChooseFULLHD = """
|
||||
"""
|
||||
|
||||
|
||||
###____ Skin Ultra HD - ImageChooseULTRAHD ___ mod. gutosie___
|
||||
# ____ 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 +137,7 @@ ImageChooseULTRAHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin HD - ImageChoose ___mod. gutosie ___
|
||||
# ____ 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 +184,7 @@ ImageChooseHD = """
|
||||
"""
|
||||
|
||||
|
||||
###____ Skin FULLHD - MyUpgradeFULLHD ___mod. gutosie ___
|
||||
# ____ 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 +203,7 @@ MyUpgradeFULLHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin UltraHD - MyUpgradeUltraHD ___mod. gutosie ___
|
||||
# ____ 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 +220,7 @@ MyUpgradeUltraHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin MyUpgradeHD - MyUpgradeHD ___mod. gutosie ___
|
||||
# ____ 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 +239,7 @@ MyUpgradeHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin NeoBootInstallationFULLHD - NeoBootInstallationFULLHD ___mod. gutosie ___
|
||||
# ____ 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 +264,7 @@ 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 ___
|
||||
# ____ 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 +296,7 @@ NeoBootInstallationUltraHD = """
|
||||
</screen>"""
|
||||
|
||||
|
||||
###____ Skin NeoBootInstallationHD - NeoBootInstallationHD ___mod. gutosie ___
|
||||
# ____ 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" />
|
||||
|
||||
Reference in New Issue
Block a user