예제 #1
0
	def __init__(self, session, updatebackup=False):
		Screen.__init__(self, session)
		self.Console = Console()
		self.BackupDevice = config.imagemanager.backuplocation.value
		print "[ImageManager] Device: " + self.BackupDevice
		self.BackupDirectory = config.imagemanager.backuplocation.value + 'imagebackups/'
		print "[ImageManager] Directory: " + self.BackupDirectory
		self.BackupDate = getImageVersion() + '.' + getImageBuild() + '-' + strftime('%Y%m%d_%H%M%S', localtime())
		self.WORKDIR = self.BackupDirectory + config.imagemanager.folderprefix.value + '-temp'
		self.TMPDIR = self.BackupDirectory + config.imagemanager.folderprefix.value + '-mount'
		if updatebackup:
			self.MAINDESTROOT = self.BackupDirectory + config.imagemanager.folderprefix.value + '-SoftwareUpdate-' + self.BackupDate
		else:
			self.MAINDESTROOT = self.BackupDirectory + config.imagemanager.folderprefix.value + '-' + self.BackupDate
		self.kernelMTD = getMachineMtdKernel()
		self.kernelFILE = getMachineKernelFile()
		self.rootMTD = getMachineMtdRoot()
		self.rootFILE = getMachineRootFile()
		self.MAINDEST = self.MAINDESTROOT + '/' + getImageFolder() + '/'
		print 'MTD: Kernel:',self.kernelMTD
		print 'MTD: Root:',self.rootMTD
		if getImageFileSystem() == 'ubi':
			self.ROOTFSTYPE = 'ubifs'
		else:
			self.ROOTFSTYPE= 'jffs2'
		self.swapdevice = ""
		self.RamChecked = False
		self.SwapCreated = False
		self.Stage1Completed = False
		self.Stage2Completed = False
		self.Stage3Completed = False
		self.Stage4Completed = False
		self.Stage5Completed = False
예제 #2
0
	def keyResstore3(self, result, retval, extra_args=None):
		if retval == 0:
			kernelMTD = getMachineMtdKernel()
			kernelFILE = getMachineKernelFile()
			rootMTD = getMachineMtdRoot()
			rootFILE = getMachineRootFile()
			MAINDEST = '/tmp/imagerestore/' + getImageFolder() + '/'

			config.imagemanager.restoreimage.setValue(self.sel)
			self.Console.ePopen('ofgwrite -r -k -r' + rootMTD + ' -k' + kernelMTD + ' ' + MAINDEST)
예제 #3
0
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.selection = 0
		self.list = self.list_files("/boot")
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINEBUILD = getMachineBuild()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		self.IMAGEFOLDER = getImageFolder()
		self.UBINIZE_ARGS = getMachineUBINIZE()
		self.MKUBIFS_ARGS = getMachineMKUBIFS()
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()
		self.ROOTFSBIN = getMachineRootFile()
		self.KERNELBIN = getMachineKernelFile()
		self.ROOTFSTYPE = getImageFileSystem()
		print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD
		print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL
		print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM
		print "[FULL BACKUP] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER
		print "[FULL BACKUP] UBINIZE = >%s<" %self.UBINIZE_ARGS
		print "[FULL BACKUP] MKUBIFS = >%s<" %self.MKUBIFS_ARGS
		print "[FULL BACKUP] MTDKERNEL = >%s<" %self.MTDKERNEL
		print "[FULL BACKUP] MTDROOTFS = >%s<" %self.MTDROOTFS
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE

		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = Button(_("STARTUP"))
			self["info-multi"] = Label(_("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install."))
		else:
			self["key_yellow"] = Button("")
			self["info-multi"] = Label(" ")

		self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], 
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
예제 #4
0
    def imageInstall(self):
        if self.check_free_space():
            pluginpath = '/usr/lib/enigma2/python/Plugins/Extensions/NFR4XBoot'
            myerror = ''
            source = self.source.value.replace(' ', '')
            target = self.target.value.replace(' ', '')
            for fn in os.listdir('/media/nfr4xboot/NFR4XBootI'):
                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: /media/nfr4xboot/NFR4XBootUpload 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) > 35:
                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 '\n\n"
                message += _('NFR4XBoot will install the new image.\n\n')
                message += _('Please: DO NOT reboot your STB and turn off the power.\n\n')
                message += _('The new image will be installed and auto booted in few minutes.\n\n')
                message += "'"
                if fileExists(pluginpath + '/ex_init.py'):
                    cmd1 = 'python ' + pluginpath + '/ex_init.py'
                else:
                    cmd1 = 'python ' + pluginpath + '/ex_init.pyo'
                cmd = '%s %s %s %s %s %s %s %s' % (cmd1,
                 source,
                 target.replace(' ', '.'),
                 str(self.sett.value),
                 str(self.bootquest.value),
                 str(self.zipdelete.value),
                 getImageFolder(),
                 getMachineRootFile())
                print '[NFR4X-BOOT]: ', cmd
                self.session.open(Console, _('NFR4XBoot: Install new image'), [message, cmd])
예제 #5
0
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINEBUILD = getMachineBuild()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		self.IMAGEFOLDER = getImageFolder()
		self.UBINIZE_ARGS = getMachineUBINIZE()
		self.MKUBIFS_ARGS = getMachineMKUBIFS()
		self.MTDKERNEL = getMachineMtdKernel()
		self.ROOTFSBIN = getMachineRootFile()
		self.KERNELBIN = getMachineKernelFile()
		self.ROOTFSTYPE = getImageFileSystem()
		print "[ImageBackup] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD
		print "[ImageBackup] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[ImageBackup] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[ImageBackup] BOX MODEL = >%s<" %self.MODEL
		print "[ImageBackup] OEM MODEL = >%s<" %self.OEM
		print "[ImageBackup] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER
		print "[ImageBackup] UBINIZE = >%s<" %self.UBINIZE_ARGS
		print "[ImageBackup] MKUBIFS = >%s<" %self.MKUBIFS_ARGS
		print "[ImageBackup] MTDKERNEL = >%s<" %self.MTDKERNEL
		print "[ImageBackup] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE

		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		self["key_yellow"] = Button("")
		self["info-usb"] = Label(_("USB = Do you want to create a fullbackup on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to create a fullbackup on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
예제 #6
0
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Screens.Screen import Screen
from Screens.Console import Console
from Screens.HelpMenu import HelpableScreen
from Screens.TaskView import JobView
from Tools.Downloader import downloadWithProgress
from enigma import fbClass
import urllib2
import os
import shutil
import math
from boxbranding import getBoxType,  getImageDistro, getMachineName, getMachineBrand, getImageVersion, getMachineKernelFile, getMachineRootFile
distro =  getImageDistro()
ImageVersion = getImageVersion()
ROOTFSBIN = getMachineRootFile()
KERNELBIN = getMachineKernelFile()

#############################################################################################################
image = 0 # 0=openATV / 1=openMips
if distro.lower() == "openmips":
	image = 1
elif distro.lower() == "openatv":
	image = 0
feedurl_atv = 'http://images.mynonpublic.com/openatv/%s' %ImageVersion

if ImageVersion == '5.3':
	ImageVersion2= '5.4'
else:
	ImageVersion2= '5.3'
feedurl_atv2= 'http://images.mynonpublic.com/openatv/%s' %ImageVersion2
예제 #7
0
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Screens.Screen import Screen
from Screens.Console import Console
from Screens.HelpMenu import HelpableScreen
from Screens.TaskView import JobView
from Tools.Downloader import downloadWithProgress
from enigma import fbClass
import urllib2
import os
import shutil
import math
from boxbranding import getBoxType, getImageDistro, getMachineName, getMachineBrand, getImageVersion, getMachineKernelFile, getMachineRootFile, getMachineBuild, getMachineMtdKernel, getMachineMtdRoot
distro = getImageDistro()
ImageVersion = getImageVersion()
ROOTFSBIN = getMachineRootFile()
KERNELBIN = getMachineKernelFile()
MTDKERNEL = getMachineMtdKernel()
MTDROOTFS = getMachineMtdRoot()

#############################################################################################################
# Create a List of imagetypes
# 0 = Name Of Image, 1 = link to file
images = []
global imagesCounter
imagesCounter = 0
#images.append(["Team", "http://teamimages.hdfreaks.cc"])
#images.append(["Latest", "http://images.hdfreaks.cc"])
#images.append(["V5.5", "http://v55.hdfreaks.cc"])
#images.append(["V6.0", "http://beta6.hdfreaks.cc"])
images.append(["switch to V5.5", "http://teamimages.hdfreaks.cc"])
예제 #8
0
    def __init__(self, session, args=0):
        Screen.__init__(self, session)
        self.session = session
        self.selection = 0
        self.MODEL = getBoxType()
        self.OEM = getBrandOEM()
        self.MACHINEBUILD = getMachineBuild()
        self.MACHINENAME = getMachineName()
        self.MACHINEBRAND = getMachineBrand()
        self.IMAGEFOLDER = getImageFolder()
        self.UBINIZE_ARGS = getMachineUBINIZE()
        self.MKUBIFS_ARGS = getMachineMKUBIFS()
        self.MTDKERNEL = getMachineMtdKernel()
        self.MTDROOTFS = getMachineMtdRoot()
        self.ROOTFSBIN = getMachineRootFile()
        self.KERNELBIN = getMachineKernelFile()
        self.ROOTFSTYPE = getImageFileSystem().strip()

        if self.MACHINEBUILD in ("hd51", "vs1500", "h7", "8100s"):
            self.MTDBOOT = "mmcblk0p1"
            self.EMMCIMG = "disk.img"
        elif self.MACHINEBUILD in ("xc7439", "osmio4k"):
            self.MTDBOOT = "mmcblk1p1"
            self.EMMCIMG = "emmc.img"
#		elif self.MACHINEBUILD in ("cc1","sf8008","ustym4kpr"):
#			self.MTDBOOT = "none"
#			self.EMMCIMG = "usb_update.bin"
        else:
            self.MTDBOOT = "none"
            self.EMMCIMG = "none"

        print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" % self.MACHINEBUILD
        print "[FULL BACKUP] BOX MACHINENAME = >%s<" % self.MACHINENAME
        print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" % self.MACHINEBRAND
        print "[FULL BACKUP] BOX MODEL = >%s<" % self.MODEL
        print "[FULL BACKUP] OEM MODEL = >%s<" % self.OEM
        print "[FULL BACKUP] IMAGEFOLDER = >%s<" % self.IMAGEFOLDER
        print "[FULL BACKUP] UBINIZE = >%s<" % self.UBINIZE_ARGS
        print "[FULL BACKUP] MKUBIFS = >%s<" % self.MKUBIFS_ARGS
        print "[FULL BACKUP] MTDBOOT = >%s<" % self.MTDBOOT
        print "[FULL BACKUP] MTDKERNEL = >%s<" % self.MTDKERNEL
        print "[FULL BACKUP] MTDROOTFS = >%s<" % self.MTDROOTFS
        print "[FULL BACKUP] ROOTFSBIN = >%s<" % self.ROOTFSBIN
        print "[FULL BACKUP] KERNELBIN = >%s<" % self.KERNELBIN
        print "[FULL BACKUP] ROOTFSTYPE = >%s<" % self.ROOTFSTYPE
        print "[FULL BACKUP] EMMCIMG = >%s<" % self.EMMCIMG

        self.error_files = ''
        self.list = self.list_files("/boot")
        self["key_green"] = StaticText("USB")
        self["key_red"] = StaticText("HDD")
        self["key_blue"] = StaticText(_("Exit"))
        if SystemInfo["HaveMultiBoot"]:
            self["key_yellow"] = StaticText(_("STARTUP"))
            self["info-multi"] = Label(
                _("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install."
                  ))
            self.read_current_multiboot()
        else:
            self["key_yellow"] = StaticText("")
            self["info-multi"] = Label(" ")
        self["info-usb"] = Label(
            _("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."
              ))
        self["info-hdd"] = Label(
            _("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."
              ))
        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "blue": self.quit,
                "yellow": self.yellow,
                "green": self.green,
                "red": self.red,
                "cancel": self.quit,
            }, -2)
        self.onShown.append(self.show_Errors)
예제 #9
0
from Components.ActionMap import ActionMap
from Components.Button import Button
from Components.FileList import FileList
from Components.Language import language
from Components.Harddisk import harddiskmanager
from Components.Label import Label
from Components.ScrollLabel import ScrollLabel
from Components.Sources.StaticText import StaticText
from Plugins.Plugin import PluginDescriptor
from Tools.Directories import resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS
from os import environ
from enigma import getDesktop, getBoxType, getBoxBrand
from boxbranding import getMachineBuild, getMachineRootFile, getMachineKernelFile

brand = getBoxBrand()
rootfile = getMachineRootFile()
kernelfile = getMachineKernelFile()

lang = language.getLanguage()
environ["LANGUAGE"] = lang[:2]
gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
gettext.textdomain("enigma2")
gettext.bindtextdomain("BackupSuite", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/BackupSuite/locale"))

def _(txt):
	t = gettext.dgettext("BackupSuite", txt)
	if t == txt:
		t = gettext.gettext(txt)
	return t

######################################################################################################
예제 #10
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.setTitle(_("Open Vision information"))

		OpenVisionInformationText = _("Open Vision information") + "\n"

		OpenVisionInformationText += "\n"

		if config.misc.OVupdatecheck.value is True:
			try:
				if boxbranding.getVisionVersion().startswith("10"):
					ovurl = "https://raw.githubusercontent.com/OpenVisionE2/openvision-development-platform/python3/meta-openvision/conf/distro/revision.conf"
				else:
					ovurl = "https://raw.githubusercontent.com/OpenVisionE2/openvision-oe/develop/meta-openvision/conf/distro/revision.conf"
				ovresponse = urllib.request.urlopen(ovurl)
				ovrevision = ovresponse.read().decode()
				ovrevisionupdate = ovrevision.split('r')[1][:3]
			except Exception as e:
				ovrevisionupdate = _("Requires internet connection")
		else:
			ovrevisionupdate = _("Disabled in configuration")

		if fileExists("/etc/openvision/visionversion"):
			visionversion = open("/etc/openvision/visionversion", "r").read().strip()
			OpenVisionInformationText += _("Open Vision version: ") + visionversion + "\n"
		else:
			OpenVisionInformationText += _("Open Vision version: ") + boxbranding.getVisionVersion() + "\n"

		if fileExists("/etc/openvision/visionrevision"):
			visionrevision = open("/etc/openvision/visionrevision", "r").read().strip()
			OpenVisionInformationText += _("Open Vision revision: ") + visionrevision + " " + _("(Latest revision on github: ") + str(ovrevisionupdate) + ")" + "\n"
		else:
			OpenVisionInformationText += _("Open Vision revision: ") + boxbranding.getVisionRevision() + " " + _("(Latest revision on github: ") + str(ovrevisionupdate) + ")" + "\n"

		if fileExists("/etc/openvision/visionlanguage"):
			visionlanguage = open("/etc/openvision/visionlanguage", "r").read().strip()
			OpenVisionInformationText += _("Open Vision language: ") + visionlanguage + "\n"

		OpenVisionInformationText += _("Open Vision module: ") + about.getVisionModule() + "\n"
		OpenVisionInformationText += _("Flash type: ") + about.getFlashType() + "\n"

		OpenVisionInformationText += "\n"

		boxrctype = getBoxRCType()
		if boxrctype is not None and boxrctype != "unknown":
			OpenVisionInformationText += _("Factory RC type: ") + boxrctype + "\n"
		if boxrctype is not None and boxrctype == "unknown":
			if fileExists("/usr/bin/remotecfg"):
				OpenVisionInformationText += _("RC type: ") + _("Amlogic remote") + "\n"
			elif fileExists("/usr/sbin/lircd"):
				OpenVisionInformationText += _("RC type: ") + _("LIRC remote") + "\n"

		OpenVisionInformationText += _("Open Vision RC type: ") + boxbranding.getRCType() + "\n"
		OpenVisionInformationText += _("Open Vision RC name: ") + boxbranding.getRCName() + "\n"
		OpenVisionInformationText += _("Open Vision RC ID number: ") + boxbranding.getRCIDNum() + "\n"

		OpenVisionInformationText += "\n"

		if SystemInfo["HiSilicon"]:
			OpenVisionInformationText += _("HiSilicon dedicated information") + "\n"

			grab = os.popen("opkg list-installed | grep -- -grab | cut -f4 -d'-'").read().strip()
			if grab != "" and grab != "r0":
				OpenVisionInformationText += _("Grab: ") + grab + "\n"

			hihalt = os.popen("opkg list-installed | grep -- -hihalt | cut -f4 -d'-'").read().strip()
			if hihalt != "":
				OpenVisionInformationText += _("Halt: ") + hihalt + "\n"

			libs = os.popen("opkg list-installed | grep -- -libs | cut -f4 -d'-'").read().strip()
			if libs != "":
				OpenVisionInformationText += _("Libs: ") + libs + "\n"

			partitions = os.popen("opkg list-installed | grep -- -partitions | cut -f4 -d'-'").read().strip()
			if partitions != "":
				OpenVisionInformationText += _("Partitions: ") + partitions + "\n"

			reader = os.popen("opkg list-installed | grep -- -reader | cut -f4 -d'-'").read().strip()
			if reader != "":
				OpenVisionInformationText += _("Reader: ") + reader + "\n"

			showiframe = os.popen("opkg list-installed | grep -- -showiframe | cut -f4 -d'-'").read().strip()
			if showiframe != "":
				OpenVisionInformationText += _("Showiframe: ") + showiframe + "\n"

			OpenVisionInformationText += "\n"

		OpenVisionInformationText += _("Image architecture: ") + boxbranding.getImageArch() + "\n"
		if boxbranding.getImageFolder() != "":
			OpenVisionInformationText += _("Image folder: ") + boxbranding.getImageFolder() + "\n"
		if boxbranding.getImageFileSystem() != "":
			OpenVisionInformationText += _("Image file system: ") + boxbranding.getImageFileSystem() + "\n"
		OpenVisionInformationText += _("Image: ") + boxbranding.getImageDistro() + "\n"
		OpenVisionInformationText += _("Feed URL: ") + boxbranding.getFeedsUrl() + "\n"

		OpenVisionInformationText += _("Compiled by: ") + boxbranding.getDeveloperName() + "\n"
		OpenVisionInformationText += _("Build date: ") + about.getBuildDateString() + "\n"

		OpenVisionInformationText += _("OE: ") + boxbranding.getImageBuild() + "\n"

		OpenVisionInformationText += "\n"

		if boxbranding.getImageFPU() != "":
			OpenVisionInformationText += _("FPU: ") + boxbranding.getImageFPU() + "\n"

		if boxbranding.getImageArch() == "aarch64":
			if boxbranding.getHaveMultiLib() == "True":
				OpenVisionInformationText += _("MultiLib: ") + _("Yes") + "\n"
			else:
				OpenVisionInformationText += _("MultiLib: ") + _("No") + "\n"

		OpenVisionInformationText += "\n"

		if boxbranding.getMachineMtdBoot() != "":
			OpenVisionInformationText += _("MTD boot: ") + boxbranding.getMachineMtdBoot() + "\n"
		if boxbranding.getMachineMtdRoot() != "":
			OpenVisionInformationText += _("MTD root: ") + boxbranding.getMachineMtdRoot() + "\n"
		if boxbranding.getMachineMtdKernel() != "":
			OpenVisionInformationText += _("MTD kernel: ") + boxbranding.getMachineMtdKernel() + "\n"

		if boxbranding.getMachineRootFile() != "":
			OpenVisionInformationText += _("Root file: ") + boxbranding.getMachineRootFile() + "\n"
		if boxbranding.getMachineKernelFile() != "":
			OpenVisionInformationText += _("Kernel file: ") + boxbranding.getMachineKernelFile() + "\n"

		if boxbranding.getMachineMKUBIFS() != "":
			OpenVisionInformationText += _("MKUBIFS: ") + boxbranding.getMachineMKUBIFS() + "\n"
		if boxbranding.getMachineUBINIZE() != "":
			OpenVisionInformationText += _("UBINIZE: ") + boxbranding.getMachineUBINIZE() + "\n"

		OpenVisionInformationText += "\n"

		if fileExists("/proc/device-tree/amlogic-dt-id"):
			devicetid = open("/proc/device-tree/amlogic-dt-id", "r").read().strip()
			OpenVisionInformationText += _("Device id: ") + devicetid + "\n"

		if fileExists("/proc/device-tree/le-dt-id"):
			giventid = open("/proc/device-tree/le-dt-id", "r").read().strip()
			OpenVisionInformationText += _("Given device id: ") + giventid + "\n"

		self["AboutScrollLabel"] = ScrollLabel(OpenVisionInformationText)
		self["key_red"] = Button(_("Close"))

		self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"],
			{
				"cancel": self.close,
				"ok": self.close,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})
예제 #11
0
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.selection = 0
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINEBUILD = getMachineBuild()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		self.IMAGEFOLDER = getImageFolder()
		self.HDFIMAGEVERSION = getImageVersion()
		self.HDFIMAGEBUILD = getImageBuild()
		self.HDFIMAGENAME = getImageDistro()
		self.UBINIZE_ARGS = getMachineUBINIZE()
		self.MKUBIFS_ARGS = getMachineMKUBIFS()
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()
		self.ROOTFSBIN = getMachineRootFile()
		self.KERNELBIN = getMachineKernelFile()
		self.ROOTFSTYPE = getImageFileSystem().strip()

		if self.MACHINEBUILD in ("hd51","vs1500","h7","8100s"):
			self.MTDBOOT = "mmcblk0p1"
			self.EMMCIMG = "disk.img"
		elif self.MACHINEBUILD in ("xc7439","osmio4k"):
			self.MTDBOOT = "mmcblk1p1"
			self.EMMCIMG = "emmc.img"
		elif self.MACHINEBUILD in ("cc1","sf8008","ustym4kpr"):
			self.MTDBOOT = "none"
			self.EMMCIMG = "usb_update.bin"
		else:
			self.MTDBOOT = "none"
			self.EMMCIMG = "none"

		print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD
		print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL
		print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM
		print "[FULL BACKUP] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER
		print "[FULL BACKUP] UBINIZE = >%s<" %self.UBINIZE_ARGS
		print "[FULL BACKUP] MKUBIFS = >%s<" %self.MKUBIFS_ARGS
		print "[FULL BACKUP] MTDBOOT = >%s<" %self.MTDBOOT
		print "[FULL BACKUP] MTDKERNEL = >%s<" %self.MTDKERNEL
		print "[FULL BACKUP] MTDROOTFS = >%s<" %self.MTDROOTFS
		print "[FULL BACKUP] ROOTFSBIN = >%s<" %self.ROOTFSBIN
		print "[FULL BACKUP] KERNELBIN = >%s<" %self.KERNELBIN
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
		print "[FULL BACKUP] EMMCIMG = >%s<" %self.EMMCIMG
		if isDreamboxXZ:
			self.IMAGEFOLDER = self.MODEL
# fix me to xz
			self.ROOTFSTYPE = "tar.gz"
			self.ROOTFSBIN = "root.tar.gz"

		self.error_files = ''
		self.list = self.list_files("/boot")
		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = Button(_("Select Multiboot"))
			self["info-multi"] = Label(_("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install."))
			self.read_current_multiboot()
		else:
			self["key_yellow"] = Button("")
			self["info-multi"] = Label(" ")
		self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
		self.onShown.append(self.show_Errors)
import glob
import struct
from Components.Console import Console
from boxbranding import getBoxBrand, getImageDistro, getImageVersion, getImageFileSystem, getImageFolder, getMachineMtdKernel, getMachineKernelFile, getMachineMtdBoot, getMachineMtdRoot, getMachineRootFile, getMachineMKUBIFS, getMachineUBINIZE

OMB_GETBOXTYPE = getBoxType()
OMB_GETBRANDOEM = getBoxBrand()
OMB_GETIMAGEDISTRO = getImageDistro()
OMB_GETIMAGEVERSION = getImageVersion()
OMB_GETIMAGEFILESYSTEM = getImageFileSystem()  # needed
OMB_GETIMAGEFOLDER = getImageFolder()  # needed
OMB_GETMACHINEMTDKERNEL = getMachineMtdKernel()
OMB_GETMACHINEKERNELFILE = getMachineKernelFile()  # needed
OMB_GETMACHINEMTDBOOT = getMachineMtdBoot()
OMB_GETMACHINEMTDROOT = getMachineMtdRoot()
OMB_GETMACHINEROOTFILE = getMachineRootFile()  # needed
OMB_GETMACHINEMKUBIFS = getMachineMKUBIFS()
OMB_GETMACHINEUBINIZE = getMachineUBINIZE()


class OMBManagerInstall(Screen):
    skin = """
			<screen position="360,150" size="560,400">
				<widget name="info"
						position="10,10"
						size="540,50"
						font="Regular;18"
						zPosition="1" />
				<widget source="list"
						render="Listbox"
						position="10,60"
예제 #13
0
	def doFullBackup(self, answer):
		if answer is not None:
			if answer[1]:
				self.RECOVERY = answer[3]
				self.DIRECTORY = "%s/images" %answer[2]
				if not os.path.exists(self.DIRECTORY):
					try:
						os.makedirs(self.DIRECTORY)
					except:
						self.session.open(MessageBox, _("Cannot create backup directory"), MessageBox.TYPE_ERROR, timeout=10)
						return
				self.SLOT = answer[1]
				self.MODEL = GetBoxName()
				self.OEM = getBrandOEM()
				self.MACHINEBUILD = getMachineBuild()
				self.MACHINENAME = getMachineName()
				self.MACHINEBRAND = getMachineBrand()
				self.IMAGEFOLDER = getImageFolder()
				self.UBINIZE_ARGS = getMachineUBINIZE()
				self.MKUBIFS_ARGS = getMachineMKUBIFS()
				self.ROOTFSSUBDIR = "none"
				self.ROOTFSBIN = getMachineRootFile()
				self.KERNELBIN = getMachineKernelFile()
				self.ROOTFSTYPE = getImageFileSystem().strip()
				self.IMAGEDISTRO = getImageDistro()
				self.DISTROVERSION = getImageVersion()

				if SystemInfo["canRecovery"]:
					self.EMMCIMG = SystemInfo["canRecovery"][0]
					self.MTDBOOT = SystemInfo["canRecovery"][1]
				else:
					self.EMMCIMG = "none"
					self.MTDBOOT = "none"

				self.getImageList = self.saveImageList
				if SystemInfo["canMultiBoot"]:
					self.MTDKERNEL  = SystemInfo["canMultiBoot"][self.SLOT]["kernel"].split('/')[2]
					self.MTDROOTFS  = SystemInfo["canMultiBoot"][self.SLOT]["device"].split('/')[2]
					if SystemInfo["HasRootSubdir"]:
						self.ROOTFSSUBDIR = SystemInfo["canMultiBoot"][self.SLOT]['rootsubdir']
				else:
					self.MTDKERNEL = getMachineMtdKernel()
					self.MTDROOTFS = getMachineMtdRoot()

				print "[Image Backup] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD
				print "[Image Backup] BOX MACHINENAME = >%s<" %self.MACHINENAME
				print "[Image Backup] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
				print "[Image Backup] BOX MODEL = >%s<" %self.MODEL
				print "[Image Backup] OEM MODEL = >%s<" %self.OEM
				print "[Image Backup] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER
				print "[Image Backup] UBINIZE = >%s<" %self.UBINIZE_ARGS
				print "[Image Backup] MKUBIFS = >%s<" %self.MKUBIFS_ARGS
				print "[Image Backup] MTDBOOT = >%s<" %self.MTDBOOT
				print "[Image Backup] MTDKERNEL = >%s<" %self.MTDKERNEL
				print "[Image Backup] MTDROOTFS = >%s<" %self.MTDROOTFS
				print "[Image Backup] ROOTFSBIN = >%s<" %self.ROOTFSBIN
				print "[Image Backup] KERNELBIN = >%s<" %self.KERNELBIN
				print "[Image Backup] ROOTFSSUBDIR = >%s<" %self.ROOTFSSUBDIR
				print "[Image Backup] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
				print "[Image Backup] EMMCIMG = >%s<" %self.EMMCIMG
				print "[Image Backup] IMAGEDISTRO = >%s<" %self.IMAGEDISTRO
				print "[Image Backup] DISTROVERSION = >%s<" %self.DISTROVERSION
				print "[Image Backup] MTDBOOT = >%s<" %self.MTDBOOT
				print "[Image Backup] USB RECOVERY = >%s< " %self.RECOVERY
				print "[Image Backup] DESTINATION = >%s< " %self.DIRECTORY
				print "[Image Backup] SLOT = >%s< " %self.SLOT

				self.TITLE = _("Full back-up on %s") % (self.DIRECTORY)
				self.START = time()
				self.DATE = strftime("%Y%m%d_%H%M", localtime(self.START))
				self.IMAGEVERSION = self.imageInfo()
				self.MKFS_UBI = "/usr/sbin/mkfs.ubifs"
				self.MKFS_TAR = "/bin/tar"
				self.BZIP2 = "/usr/bin/bzip2"
				self.MKFS_JFFS2 = "/usr/sbin/mkfs.jffs2"
				self.UBINIZE = "/usr/sbin/ubinize"
				self.NANDDUMP = "/usr/sbin/nanddump"
				self.FASTBOOT = "/usr/bin/ext2simg"
				self.WORKDIR= "%s/bi" %self.DIRECTORY

				self.SHOWNAME = "%s %s" %(self.MACHINEBRAND, self.MODEL)
				self.MAINDEST = "%s/build_%s/%s" % (self.DIRECTORY, self.MODEL, self.IMAGEFOLDER)
				self.MAINDESTROOT = "%s/build_%s" % (self.DIRECTORY, self.MODEL)

				self.message = "echo -e '\n"
				if getMachineBrand().startswith('A') or getMachineBrand().startswith('E') or getMachineBrand().startswith('I') or getMachineBrand().startswith('O') or getMachineBrand().startswith('U') or getMachineBrand().startswith('Xt'):
					self.message += (_('Back-up Tool for an %s\n') % self.SHOWNAME).upper()
				else:
					self.message += (_('Back-up Tool for a %s\n') % self.SHOWNAME).upper()
				self.message += VERSION + '\n'
				self.message += "_________________________________________________\n\n"
				self.message += _("Please be patient, a backup will now be made,\n")
				self.message += _("because of the used filesystem the back-up\n")
				self.message += _("will take about 1-15 minutes for this system\n")
				self.message += "_________________________________________________\n\n"
				if self.RECOVERY:
					self.message += _("Backup Mode: USB Recovery\n")
				else:
					self.message += _("Backup Mode: Flash Online\n")
				self.message += "_________________________________________________\n"
				self.message += "'"


				## PREPARING THE BUILDING ENVIRONMENT
				os.system("rm -rf %s" %self.WORKDIR)
				self.backuproot = "/tmp/bi/root"
				if SystemInfo["HasRootSubdir"]:
					self.backuproot = "/tmp/bi/RootSubdir/"
				if not os.path.exists(self.WORKDIR):
					os.makedirs(self.WORKDIR)
				if not os.path.exists(self.backuproot):
					os.makedirs(self.backuproot)
				os.system("sync")
				if SystemInfo["canMultiBoot"]:
					if SystemInfo["HasRootSubdir"]:
						os.system("mount /dev/%s /tmp/bi/RootSubdir" %self.MTDROOTFS)
						self.backuproot = self.backuproot + self.ROOTFSSUBDIR
					else:
						os.system("mount /dev/%s %s" %(self.MTDROOTFS, self.backuproot))
				else:
					os.system("mount --bind / %s" %(self.backuproot))

				if "jffs2" in self.ROOTFSTYPE.split():
					cmd1 = "%s --root=%s --faketime --output=%s/root.jffs2 %s" % (self.MKFS_JFFS2,  self.backuproot, self.WORKDIR, self.MKUBIFS_ARGS)
					cmd2 = None
					cmd3 = None
				elif "ubi" in self.ROOTFSTYPE.split():
					f = open("%s/ubinize.cfg" %self.WORKDIR, "w")
					f.write("[ubifs]\n")
					f.write("mode=ubi\n")
					f.write("image=%s/root.ubi\n" %self.WORKDIR)
					f.write("vol_id=0\n")
					f.write("vol_type=dynamic\n")
					f.write("vol_name=rootfs\n")
					f.write("vol_flags=autoresize\n")
					f.close()
					ff = open("%s/root.ubi" %self.WORKDIR, "w")
					ff.close()
					cmd1 = "%s -r %s -o %s/root.ubi %s" % (self.MKFS_UBI,  self.backuproot, self.WORKDIR, self.MKUBIFS_ARGS)
					cmd2 = "%s -o %s/root.ubifs %s %s/ubinize.cfg" % (self.UBINIZE, self.WORKDIR, self.UBINIZE_ARGS, self.WORKDIR)
					cmd3 = "mv %s/root.ubifs %s/root.%s" %(self.WORKDIR, self.WORKDIR, self.ROOTFSTYPE)
				else:
					if self.RECOVERY:
						cmd1 = None
						cmd2 = None
					else:
						cmd1 = "%s -cf %s/rootfs.tar -C %s --exclude ./var/nmbd --exclude ./.resizerootfs --exclude ./.resize-rootfs --exclude ./.resize-linuxrootfs --exclude ./.resize-userdata --exclude ./var/lib/samba/private/msg.sock --exclude ./var/lib/samba/msg.sock/* --exclude ./run/avahi-daemon/socket ." % (self.MKFS_TAR, self.WORKDIR, self.backuproot)
						cmd2 = "%s %s/rootfs.tar" % (self.BZIP2, self.WORKDIR)
					cmd3 = None

				cmdlist = []
				cmdlist.append(self.message)
				if cmd1:
					cmdlist.append('echo "' + _("Create:") + ' %s"' %self.ROOTFSBIN)
					cmdlist.append(cmd1)
				if cmd2:
					cmdlist.append(cmd2)
				if cmd3:
					cmdlist.append(cmd3)

				if self.MODEL in ("gbquad4k","gbue4k","gbx34k"):
					cmdlist.append('echo "' + _("Create:") + " boot dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p1 of=%s/boot.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " rescue dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p3 of=%s/rescue.bin" % self.WORKDIR)

				if self.MACHINEBUILD  in ("h9","i55plus"):
					cmdlist.append('echo "' + _("Create:") + " fastboot dump" + '"')
					cmdlist.append("dd if=/dev/mtd0 of=%s/fastboot.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " bootargs dump" + '"')
					cmdlist.append("dd if=/dev/mtd1 of=%s/bootargs.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " baseparam dump" + '"')
					cmdlist.append("dd if=/dev/mtd2 of=%s/baseparam.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " pq_param dump" + '"')
					cmdlist.append("dd if=/dev/mtd3 of=%s/pq_param.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " logo dump" + '"')
					cmdlist.append("dd if=/dev/mtd4 of=%s/logo.bin" % self.WORKDIR)

				if self.EMMCIMG == "usb_update.bin" and self.RECOVERY:
					SEEK_CONT = (Harddisk.getFolderSize(self.backuproot)/ 1024) + 100000

					cmdlist.append('echo "' + _("Create:") + " fastboot dump" + '"')
					cmdlist.append('cp -f /usr/share/fastboot.bin %s/fastboot.bin' %(self.WORKDIR))
					#cmdlist.append("dd if=/dev/mmcblk0p1 of=%s/fastboot.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " bootargs dump" + '"')
					cmdlist.append('cp -f /usr/share/bootargs.bin %s/bootargs.bin' %(self.WORKDIR))
					#cmdlist.append("dd if=/dev/mmcblk0p2 of=%s/bootargs.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " boot dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p3 of=%s/boot.img" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " baseparam dump" + '"')
					#cmdlist.append('cp -f /usr/share/bootargs.bin %s/baseparam.img' %(self.WORKDIR))
					cmdlist.append("dd if=/dev/mmcblk0p4 of=%s/baseparam.img" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " pq_param dump" + '"')
					#cmdlist.append('cp -f /usr/share/bootargs.bin %s/pq_param.bin' %(self.WORKDIR))
					cmdlist.append("dd if=/dev/mmcblk0p5 of=%s/pq_param.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " logo dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p6 of=%s/logo.img" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " deviceinfo dump" + '"')
					#cmdlist.append('cp -f /usr/share/bootargs.bin %s/deviceinfo.bin' %(self.WORKDIR))
					cmdlist.append("dd if=/dev/mmcblk0p7 of=%s/deviceinfo.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " apploader dump" + '"')
					cmdlist.append('cp -f /usr/share/apploader.bin %s/apploader.bin' %(self.WORKDIR))
					#cmdlist.append("dd if=/dev/mmcblk0p10 of=%s/apploader.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " rootfs dump" + '"')
					cmdlist.append("dd if=/dev/zero of=%s/rootfs.ext4 seek=%s count=60 bs=1024" % (self.WORKDIR, SEEK_CONT))
					cmdlist.append("mkfs.ext4 -F -i 4096 %s/rootfs.ext4" % (self.WORKDIR))
					cmdlist.append("mkdir -p %s/userdata" % self.WORKDIR)
					cmdlist.append("mount %s/rootfs.ext4 %s/userdata" %(self.WORKDIR,self.WORKDIR))
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs1" % self.WORKDIR)
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs2" % self.WORKDIR)
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs3" % self.WORKDIR)
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs4" % self.WORKDIR)
					cmdlist.append("rsync -aAX %s/ %s/userdata/linuxrootfs1/" % (self.backuproot,self.WORKDIR))
					cmdlist.append("umount %s/userdata" %(self.WORKDIR))

				cmdlist.append('echo "' + _("Create:") + " kerneldump" + '"')
				if SystemInfo["canMultiBoot"] or self.MTDKERNEL.startswith('mmcblk0'):
					cmdlist.append("dd if=/dev/%s of=%s/%s" % (self.MTDKERNEL ,self.WORKDIR, self.KERNELBIN))
				else:
					cmdlist.append("nanddump -a -f %s/vmlinux.gz /dev/%s" % (self.WORKDIR, self.MTDKERNEL))

				if self.EMMCIMG == "disk.img" and self.RECOVERY:
					EMMC_IMAGE = "%s/%s"% (self.WORKDIR,self.EMMCIMG)
					BLOCK_SIZE=512
					BLOCK_SECTOR=2
					IMAGE_ROOTFS_ALIGNMENT=1024
					BOOT_PARTITION_SIZE=3072
					KERNEL_PARTITION_SIZE=8192
					ROOTFS_PARTITION_SIZE=1048576
					EMMC_IMAGE_SIZE=3817472
					KERNEL_PARTITION_OFFSET = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					ROOTFS_PARTITION_OFFSET = int(KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					SECOND_KERNEL_PARTITION_OFFSET = int(ROOTFS_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					THRID_KERNEL_PARTITION_OFFSET = int(SECOND_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					FOURTH_KERNEL_PARTITION_OFFSET = int(THRID_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					MULTI_ROOTFS_PARTITION_OFFSET = int(FOURTH_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					EMMC_IMAGE_SEEK = int(EMMC_IMAGE_SIZE) * int(BLOCK_SECTOR)
					cmdlist.append('echo "' + _("Create: Recovery Fullbackup %s")% (self.EMMCIMG) + '"')
					cmdlist.append('dd if=/dev/zero of=%s bs=%s count=0 seek=%s' % (EMMC_IMAGE, BLOCK_SIZE , EMMC_IMAGE_SEEK))
					cmdlist.append('parted -s %s mklabel gpt' %EMMC_IMAGE)
					PARTED_END_BOOT = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart boot fat16 %s %s' % (EMMC_IMAGE, IMAGE_ROOTFS_ALIGNMENT, PARTED_END_BOOT ))
					PARTED_END_KERNEL1 = int(KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel %s %s' % (EMMC_IMAGE, KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL1 ))
					PARTED_END_ROOTFS1 = int(ROOTFS_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxrootfs ext4 %s %s' % (EMMC_IMAGE, ROOTFS_PARTITION_OFFSET, PARTED_END_ROOTFS1 ))
					PARTED_END_KERNEL2 = int(SECOND_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel2 %s %s' % (EMMC_IMAGE, SECOND_KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL2 ))
					PARTED_END_KERNEL3 = int(THRID_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel3 %s %s' % (EMMC_IMAGE, THRID_KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL3 ))
					PARTED_END_KERNEL4 = int(FOURTH_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel4 %s %s' % (EMMC_IMAGE, FOURTH_KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL4 ))
					rd = open("/proc/swaps", "r").read()
					if "mmcblk0p7" in rd:
						SWAP_PARTITION_OFFSET = int(FOURTH_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
						SWAP_PARTITION_SIZE = int(262144)
						MULTI_ROOTFS_PARTITION_OFFSET = int(SWAP_PARTITION_OFFSET) + int(SWAP_PARTITION_SIZE)
						cmdlist.append('parted -s %s unit KiB mkpart swap linux-swap %s %s' % (EMMC_IMAGE, SWAP_PARTITION_OFFSET, SWAP_PARTITION_OFFSET + SWAP_PARTITION_SIZE))
						cmdlist.append('parted -s %s unit KiB mkpart userdata ext4 %s 100%%' % (EMMC_IMAGE, MULTI_ROOTFS_PARTITION_OFFSET))
					else:
						cmdlist.append('parted -s %s unit KiB mkpart userdata ext4 %s 100%%' % (EMMC_IMAGE, MULTI_ROOTFS_PARTITION_OFFSET))
					BOOT_IMAGE_SEEK = int(IMAGE_ROOTFS_ALIGNMENT) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDBOOT, EMMC_IMAGE, BOOT_IMAGE_SEEK ))
					KERNAL_IMAGE_SEEK = int(KERNEL_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDKERNEL, EMMC_IMAGE, KERNAL_IMAGE_SEEK ))
					ROOTFS_IMAGE_SEEK = int(ROOTFS_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s ' % (self.MTDROOTFS, EMMC_IMAGE, ROOTFS_IMAGE_SEEK ))
				elif self.EMMCIMG == "emmc.img" and self.RECOVERY:
					EMMC_IMAGE = "%s/%s"% (self.WORKDIR,self.EMMCIMG)
					BLOCK_SECTOR=2
					IMAGE_ROOTFS_ALIGNMENT=1024
					BOOT_PARTITION_SIZE=3072
					KERNEL_PARTITION_SIZE=8192
					ROOTFS_PARTITION_SIZE=1898496
					EMMC_IMAGE_SIZE=7634944
					BOOTDD_VOLUME_ID = "boot"
					KERNEL1_PARTITION_OFFSET = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					ROOTFS1_PARTITION_OFFSET = int(KERNEL1_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					KERNEL2_PARTITION_OFFSET = int(ROOTFS1_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					ROOTFS2_PARTITION_OFFSET = int(KERNEL2_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					KERNEL3_PARTITION_OFFSET = int(ROOTFS2_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					ROOTFS3_PARTITION_OFFSET = int(KERNEL3_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					KERNEL4_PARTITION_OFFSET = int(ROOTFS3_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					ROOTFS4_PARTITION_OFFSET = int(KERNEL4_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					EMMC_IMAGE_SEEK = int(EMMC_IMAGE_SIZE) * int(IMAGE_ROOTFS_ALIGNMENT)
					cmdlist.append('echo "' + _("Create: Recovery Fullbackup %s")% (self.EMMCIMG) + '"')
					cmdlist.append('dd if=/dev/zero of=%s bs=1 count=0 seek=%s' % (EMMC_IMAGE, EMMC_IMAGE_SEEK))
					cmdlist.append('parted -s %s mklabel gpt' %EMMC_IMAGE)
					PARTED_END_BOOT = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart boot fat16 %s %s' % (EMMC_IMAGE, IMAGE_ROOTFS_ALIGNMENT, PARTED_END_BOOT ))
					cmdlist.append('parted -s %s set 1 boot on' %EMMC_IMAGE)
					PARTED_END_KERNEL1 = int(KERNEL1_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel1 %s %s' % (EMMC_IMAGE, KERNEL1_PARTITION_OFFSET, PARTED_END_KERNEL1 ))
					PARTED_END_ROOTFS1 = int(ROOTFS1_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs1 ext4 %s %s' % (EMMC_IMAGE, ROOTFS1_PARTITION_OFFSET, PARTED_END_ROOTFS1 ))
					PARTED_END_KERNEL2 = int(KERNEL2_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel2 %s %s' % (EMMC_IMAGE, KERNEL2_PARTITION_OFFSET, PARTED_END_KERNEL2 ))
					PARTED_END_ROOTFS2 = int(ROOTFS2_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs2 ext4 %s %s' % (EMMC_IMAGE, ROOTFS2_PARTITION_OFFSET, PARTED_END_ROOTFS2 ))
					PARTED_END_KERNEL3 = int(KERNEL3_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel3 %s %s' % (EMMC_IMAGE, KERNEL3_PARTITION_OFFSET, PARTED_END_KERNEL3 ))
					PARTED_END_ROOTFS3 = int(ROOTFS3_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs3 ext4 %s %s' % (EMMC_IMAGE, ROOTFS3_PARTITION_OFFSET, PARTED_END_ROOTFS3 ))
					PARTED_END_KERNEL4 = int(KERNEL4_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel4 %s %s' % (EMMC_IMAGE, KERNEL4_PARTITION_OFFSET, PARTED_END_KERNEL4 ))
					PARTED_END_ROOTFS4 = int(ROOTFS4_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs4 ext4 %s %s' % (EMMC_IMAGE, ROOTFS4_PARTITION_OFFSET, PARTED_END_ROOTFS4 ))
					BOOT_IMAGE_SEEK = int(IMAGE_ROOTFS_ALIGNMENT) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDBOOT, EMMC_IMAGE, BOOT_IMAGE_SEEK ))
					KERNAL_IMAGE_SEEK = int(KERNEL1_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDKERNEL, EMMC_IMAGE, KERNAL_IMAGE_SEEK ))
					ROOTFS_IMAGE_SEEK = int(ROOTFS1_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s ' % (self.MTDROOTFS, EMMC_IMAGE, ROOTFS_IMAGE_SEEK ))
				elif self.EMMCIMG == "usb_update.bin" and self.RECOVERY:
					cmdlist.append('echo "' + _("Create: Recovery Fullbackup %s")% (self.EMMCIMG) + '"')
					f = open("%s/emmc_partitions.xml" %self.WORKDIR, "w")
					f.write('<?xml version="1.0" encoding="GB2312" ?>\n')
					f.write('<Partition_Info>\n')
					f.write('<Part Sel="1" PartitionName="fastboot" FlashType="emmc" FileSystem="none" Start="0" Length="1M" SelectFile="fastboot.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="bootargs" FlashType="emmc" FileSystem="none" Start="1M" Length="1M" SelectFile="bootargs.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="bootoptions" FlashType="emmc" FileSystem="none" Start="2M" Length="1M" SelectFile="boot.img"/>\n')
					f.write('<Part Sel="1" PartitionName="baseparam" FlashType="emmc" FileSystem="none" Start="3M" Length="3M" SelectFile="baseparam.img"/>\n')
					f.write('<Part Sel="1" PartitionName="pqparam" FlashType="emmc" FileSystem="none" Start="6M" Length="4M" SelectFile="pq_param.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="logo" FlashType="emmc" FileSystem="none" Start="10M" Length="4M" SelectFile="logo.img"/>\n')
					f.write('<Part Sel="1" PartitionName="deviceinfo" FlashType="emmc" FileSystem="none" Start="14M" Length="4M" SelectFile="deviceinfo.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="loader" FlashType="emmc" FileSystem="none" Start="26M" Length="32M" SelectFile="apploader.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="linuxkernel1" FlashType="emmc" FileSystem="none" Start="66M" Length="16M" SelectFile="kernel.bin"/>\n')
					if self.MACHINEBUILD in ("sf8008m"):
						f.write('<Part Sel="1" PartitionName="userdata" FlashType="emmc" FileSystem="ext3/4" Start="130M" Length="3580M" SelectFile="rootfs.ext4"/>\n')
					else:
						f.write('<Part Sel="1" PartitionName="userdata" FlashType="emmc" FileSystem="ext3/4" Start="130M" Length="7000M" SelectFile="rootfs.ext4"/>\n')
					f.write('</Partition_Info>\n')
					f.close()
					cmdlist.append('mkupdate -s 00000003-00000001-01010101 -f %s/emmc_partitions.xml -d %s/%s' % (self.WORKDIR,self.WORKDIR,self.EMMCIMG))
				self.session.open(Console, title = self.TITLE, cmdlist = cmdlist, finishedCallback = self.doFullBackupCB, closeOnSuccess = True)
			else:
				self.close()
		else:
			self.close()
예제 #14
0
# Embedded file name: /usr/lib/enigma2/python/BoxBrandingTest.py
import boxbranding
print 'getMachineBuild=%s<' % boxbranding.getMachineBuild()
print 'getMachineMake=%s<' % boxbranding.getMachineMake()
print 'getMachineProcModel=%s<' % boxbranding.getMachineProcModel()
print 'getMachineBrand=%s<' % boxbranding.getMachineBrand()
print 'getMachineName=%s<' % boxbranding.getMachineName()
print 'getMachineMtdKernel=%s<' % boxbranding.getMachineMtdKernel()
print 'getMachineKernelFile=%s<' % boxbranding.getMachineKernelFile()
print 'getMachineMtdRoot=%s<' % boxbranding.getMachineMtdRoot()
print 'getMachineRootFile=%s<' % boxbranding.getMachineRootFile()
print 'getMachineMKUBIFS=%s<' % boxbranding.getMachineMKUBIFS()
print 'getMachineUBINIZE=%s<' % boxbranding.getMachineUBINIZE()
print 'getBoxType=%s<' % boxbranding.getBoxType()
print 'getBrandOEM=%s<' % boxbranding.getBrandOEM()
print 'getOEVersion=%s<' % boxbranding.getOEVersion()
print 'getDriverDate=%s<' % boxbranding.getDriverDate()
print 'getImageVersion=%s<' % boxbranding.getImageVersion()
print 'getImageBuild=%s<' % boxbranding.getImageBuild()
print 'getImageDevBuild=%s<' % boxbranding.getImageDevBuild()
print 'getImageType=%s<' % boxbranding.getImageType()
print 'getImageDistro=%s<' % boxbranding.getImageDistro()
print 'getImageFolder=%s<' % boxbranding.getImageFolder()
print 'getImageFileSystem=%s<' % boxbranding.getImageFileSystem()
print 'getImageDevBuild=%s<' % boxbranding.getImageDevBuild()
print 'getImageType=%s<' % boxbranding.getImageType()
print 'getMachineMake=%s<' % boxbranding.getMachineMake()
print 'getImageArch=%s<' % boxbranding.getImageArch()
print 'getFeedsUrl=%s<' % boxbranding.getFeedsUrl()
print 'getDisplayType=%s<' % boxbranding.getDisplayType()
print 'getHaveHDMI=%s<' % boxbranding.getHaveHDMI()
예제 #15
0
import boxbranding
print "getMachineBuild=%s" %boxbranding.getMachineBuild()
print "getMachineProcModel=%s" %boxbranding.getMachineProcModel()
print "getMachineBrand=%s" %boxbranding.getMachineBrand()
print "getMachineName=%s" %boxbranding.getMachineName()
print "getMachineMtdKernel=%s" %boxbranding.getMachineMtdKernel()
print "getMachineKernelFile=%s" %boxbranding.getMachineKernelFile()
print "getMachineMtdRoot=%s" %boxbranding.getMachineMtdRoot()
print "getMachineRootFile=%s" %boxbranding.getMachineRootFile()
print "getMachineMKUBIFS=%s" %boxbranding.getMachineMKUBIFS()
print "getMachineUBINIZE=%s" %boxbranding.getMachineUBINIZE()
print "getBoxType=%s" %boxbranding.getBoxType()
print "getBrandOEM=%s" %boxbranding.getBrandOEM()
print "getOEVersion=%s" %boxbranding.getOEVersion()
print "getDriverDate=%s" %boxbranding.getDriverDate()
print "getImageVersion=%s" %boxbranding.getImageVersion()
print "getImageBuild=%s" %boxbranding.getImageBuild()
print "getImageDistro=%s" %boxbranding.getImageDistro()
print "getImageFolder=%s" %boxbranding.getImageFolder()
print "getImageFileSystem=%s" %boxbranding.getImageFileSystem()
예제 #16
0
from __future__ import print_function
import boxbranding
print("getMachineBuild=%s<" % boxbranding.getMachineBuild())
print("getMachineMake=%s<" % boxbranding.getMachineMake())
print("getMachineProcModel=%s<" % boxbranding.getMachineProcModel())
print("getMachineBrand=%s<" % boxbranding.getMachineBrand())
print("getMachineName=%s<" % boxbranding.getMachineName())
print("getMachineMtdKernel=%s<" % boxbranding.getMachineMtdKernel())
print("getMachineKernelFile=%s<" % boxbranding.getMachineKernelFile())
print("getMachineMtdRoot=%s<" % boxbranding.getMachineMtdRoot())
print("getMachineRootFile=%s<" % boxbranding.getMachineRootFile())
print("getMachineMKUBIFS=%s<" % boxbranding.getMachineMKUBIFS())
print("getMachineUBINIZE=%s<" % boxbranding.getMachineUBINIZE())
print("getBoxType=%s<" % boxbranding.getBoxType())
print("getBrandOEM=%s<" % boxbranding.getBrandOEM())
print("getOEVersion=%s<" % boxbranding.getOEVersion())
print("getDriverDate=%s<" % boxbranding.getDriverDate())
print("getImageVersion=%s<" % boxbranding.getImageVersion())
print("getImageBuild=%s<" % boxbranding.getImageBuild())
print("getImageDevBuild=%s<" % boxbranding.getImageDevBuild())
print("getImageType=%s<" % boxbranding.getImageType())
print("getImageDistro=%s<" % boxbranding.getImageDistro())
print("getImageFolder=%s<" % boxbranding.getImageFolder())
print("getImageFileSystem=%s<" % boxbranding.getImageFileSystem())
print("getImageDevBuild=%s<" % boxbranding.getImageDevBuild())
print("getImageType=%s<" % boxbranding.getImageType())
print("getMachineMake=%s<" % boxbranding.getMachineMake())
print("getImageArch=%s<" % boxbranding.getImageArch())
print("getFeedsUrl=%s<" % boxbranding.getFeedsUrl())
print("getDisplayType=%s<" % boxbranding.getDisplayType())
print("getHaveHDMI=%s<" % boxbranding.getHaveHDMI())
예제 #17
0
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.selection = 0
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINEBUILD = getMachineBuild()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		self.IMAGEFOLDER = getImageFolder()
		self.HDFIMAGEVERSION = getImageVersion()
		self.HDFIMAGEBUILD = getImageBuild()
		self.UBINIZE_ARGS = getMachineUBINIZE()
		self.MKUBIFS_ARGS = getMachineMKUBIFS()
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()
		self.ROOTFSBIN = getMachineRootFile()
		self.KERNELBIN = getMachineKernelFile()
		self.ROOTFSTYPE = getImageFileSystem()

		if self.MACHINEBUILD in ("hd51","vs1500","h7","ceryon7252"):
			self.MTDBOOT = "mmcblk0p1"
			self.EMMCIMG = "disk.img"
		elif self.MACHINEBUILD in ("xc7439"):
			self.MTDBOOT = "mmcblk1p1"
			self.EMMCIMG = "emmc.img"
		else:
			self.MTDBOOT = "none"
			self.EMMCIMG = "none"

		print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD
		print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL
		print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM
		print "[FULL BACKUP] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER
		print "[FULL BACKUP] UBINIZE = >%s<" %self.UBINIZE_ARGS
		print "[FULL BACKUP] MKUBIFS = >%s<" %self.MKUBIFS_ARGS
		print "[FULL BACKUP] MTDBOOT = >%s<" %self.MTDBOOT
		print "[FULL BACKUP] MTDKERNEL = >%s<" %self.MTDKERNEL
		print "[FULL BACKUP] MTDROOTFS = >%s<" %self.MTDROOTFS
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
		print "[FULL BACKUP] EMMCIMG = >%s<" %self.EMMCIMG
		if isDreamboxXZ:
			self.IMAGEFOLDER = self.MODEL
# fix me to xz
			self.ROOTFSTYPE = "tar.gz"
			self.ROOTFSBIN = "root.tar.gz"

		self.list = self.list_files("/boot")
		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = Button(_("STARTUP"))
			self["info-multi"] = Label(_("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install."))
		else:
			self["key_yellow"] = Button("")
			self["info-multi"] = Label(" ")
		self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)