From 6343cb8fcd816a883840863d69d59aff85fda408 Mon Sep 17 00:00:00 2001 From: gutosie Date: Sun, 7 Dec 2025 19:36:31 +0200 Subject: [PATCH] Add files via upload --- NeoBoot/tmpfiles/arm_run.py | 387 ++++++++---------------- NeoBoot/tmpfiles/mips_run.py | 195 ++++--------- NeoBoot/tmpfiles/vu4k_run.py | 495 +++++++------------------------ NeoBoot/tmpfiles/vu_run.py | 550 ++++++++--------------------------- 4 files changed, 417 insertions(+), 1210 deletions(-) diff --git a/NeoBoot/tmpfiles/arm_run.py b/NeoBoot/tmpfiles/arm_run.py index 576dc83..5a563ab 100644 --- a/NeoBoot/tmpfiles/arm_run.py +++ b/NeoBoot/tmpfiles/arm_run.py @@ -1,84 +1,36 @@ +# -*- coding: utf-8 -*- + +#from __init__ import _ from Plugins.Extensions.NeoBoot.__init__ import _ -from Plugins.Extensions.NeoBoot.files.stbbranding import ( - getSupportedTuners, - getCPUtype, - getCPUSoC, - getImageNeoBoot, - getBoxHostName, - getNeoLocation, - getMountPointNeo2, -) +from Plugins.Extensions.NeoBoot.files.stbbranding import getSupportedTuners, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxHostName, getTunerModel, getNeoLocation, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getMountPointNeo2 from enigma import getDesktop +from enigma import eTimer from Screens.Screen import Screen from Screens.MessageBox import MessageBox +from Screens.ChoiceBox import ChoiceBox +from Screens.VirtualKeyBoard import VirtualKeyBoard from Screens.Standby import TryQuitMainloop +from Components.About import about +from Screens.Console import Console from Components.Sources.List import List -from Components.ActionMap import ActionMap +from Components.Button import Button +from Components.ActionMap import ActionMap, NumberActionMap from Components.GUIComponent import * +from Components.MenuList import MenuList +from Components.Input import Input from Components.Label import Label -from Components.Pixmap import Pixmap +from Components.ProgressBar import ProgressBar +from Components.ScrollLabel import ScrollLabel +from Components.Pixmap import Pixmap, MultiPixmap from Components.config import * +from Components.ConfigList import ConfigListScreen from Tools.LoadPixmap import LoadPixmap -from Tools.Directories import fileExists +from Tools.Directories import fileExists, pathExists, createDir, resolveFilename, SCOPE_PLUGINS +from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen +from os.path import dirname, isdir, isdir as os_isdir import os -import subprocess - - -def run_shell_command(cmd): - """ - Modern replacement for os.system(cmd) using subprocess.run. - Returns the exit code, mimicking os.system's behavior. - """ - try: - result = subprocess.run(cmd, shell=True, check=False) - return result.returncode - except Exception as e: - print(f"[run_shell_command] Failed to run '{cmd}'. Error: {e}") - return -1 # Return a non-zero code to indicate failure - - -def _is_device_mounted( - device="/dev/mmcblk0p23", - mount_point="/media/InternalFlash"): - """ - Checks if the specified device is currently mounted on the given mount point. - """ - try: - with open("/proc/mounts", "r") as f: - for line in f: - parts = line.split() - if len( - parts) >= 2 and parts[0] == device and parts[1] == mount_point: - return True - return False - except FileNotFoundError: - return False - - -def _append_fstab_entry(device, mount_point, fstab_file="/etc/fstab"): - """ - Appends the required fstab line if it's not already present. - """ - FSTAB_LINE = f"{device}\t\t{mount_point}\t\tauto\t\tdefaults\t\t\t\t\t\t0\t0\n" - try: - with open(fstab_file, "r") as f: - if any(line.strip().startswith(device) for line in f): - print( - f"Fstab entry for {device} already exists or device is in use.") - return False - except OSError as e: - print(f"Error reading {fstab_file}: {e}") - return False - try: - with open(fstab_file, "a") as f: - f.write(FSTAB_LINE) - return True - except OSError as e: - print(f"Error writing to {fstab_file}. Check permissions. Error: {e}") - return False - - -LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot" +import time +LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' class StartImage(Screen): @@ -115,217 +67,124 @@ class StartImage(Screen): def __init__(self, session): Screen.__init__(self, session) self.list = [] - self["list"] = List(self.list) + self['list'] = List(self.list) self.select() - self["actions"] = ActionMap(["WizardActions", "ColorActions"], { - "ok": self.KeyOk, "back": self.close}) - self["label1"] = Label(_("Start the chosen system now ?")) - self["label2"] = Label(_("Select OK to run the image.")) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, + 'back': self.close}) + self['label1'] = Label(_('Start the chosen system now ?')) + self['label2'] = Label(_('Select OK to run the image.')) def select(self): self.list = [] - mypath = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot" - if not fileExists(mypath + "icons"): - mypixmap = ( - "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png" - ) + mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + if not fileExists(mypath + 'icons'): + mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' png = LoadPixmap(mypixmap) - res = (_("OK Start image..."), png, 0) + res = (_('OK Start image...'), png, 0) self.list.append(res) - self["list"].list = self.list + self['list'].list = self.list def KeyOk(self): - image = getImageNeoBoot() - neo_location = getNeoLocation() - cmd = f"rm -rf {neo_location}ImageBoot/{image}/usr/bin/enigma2_pre_start.sh" - run_shell_command(cmd) + if getImageNeoBoot() != 'Flash': + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) + self.StartImageInNeoBoot() + else: + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) + self.StartImageInNeoBoot() - self.StartImageInNeoBoot() + #--------------------------------------------- getMountPointNeo2() - run_shell_command("touch /tmp/.init_reboot") - - def novalerReboot(self, result): - """Callback to reboot after the fstab edit message.""" - self.session.open(TryQuitMainloop, 2) + system('touch /tmp/.init_reboot') + #--------------------------------------------- def StartImageInNeoBoot(self): - DEVICE = "/dev/mmcblk0p23" - MOUNT_POINT = "/media/InternalFlash" - - if getBoxHostName() == "novaler4kpro": - if not _is_device_mounted(DEVICE, MOUNT_POINT): - print( - f"Novaler4kpro: {DEVICE} not mounted on {MOUNT_POINT}. Checking fstab...") - if not os.path.isdir(MOUNT_POINT): - try: - os.mkdir(MOUNT_POINT) - print(f"Created mount point {MOUNT_POINT}") - except OSError as e: - print(f"Error creating mount point: {e}") - - if _append_fstab_entry(DEVICE, MOUNT_POINT): - print("fstab file edited. rebooting your novaler4kpro") - self.session.open( - MessageBox, - _("fstab file edited. rebooting your novaler4kpro"), - MessageBox.TYPE_INFO, - 5, # <--- TIMEOUT PASSED POSITIONALLY - self.novalerReboot, - ) - return # Exit the function after scheduling the reboot - else: - print( - "Novaler4kpro: fstab entry already present or write failed. Proceeding." - ) - - if getImageNeoBoot() != "Flash": - if fileExists( - "%sImageBoot/%s/.control_ok" % - (getNeoLocation(), getImageNeoBoot())): - run_shell_command("touch /tmp/.control_ok ") + if getImageNeoBoot() != 'Flash': + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): + system('touch /tmp/.control_ok ') else: - run_shell_command( - "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') - if fileExists("/.multinfo") and getCPUtype() == "ARMv7": - run_shell_command( - f"{LinkNeoBoot}/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash; sleep 1") - - self.sel = self["list"].getCurrent() + self.sel = self['list'].getCurrent() if self.sel: self.sel = self.sel[2] if self.sel == 0: - if not fileExists("/bin/busybox.nosuid"): - run_shell_command('ln -sf "busybox" "/bin/busybox.nosuid" ') - if fileExists("/media/InternalFlash/etc/init.d/neomountboot.sh"): - run_shell_command( - "rm -f /media/InternalFlash/etc/init.d/neomountboot.sh;" - ) - if fileExists( - "/media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh" - ): - run_shell_command( - "rm -f /media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh;" - ) - if fileExists( - "/media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh" - ): - run_shell_command( - "rm -f /media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh;" - ) - if fileExists( - "/media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh" - ): - run_shell_command( - "rm -f /media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh;" - ) - if fileExists( - "/media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh" - ): - run_shell_command( - "rm -f /media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh;" - ) - - if getSupportedTuners(): - if getImageNeoBoot() == "Flash": - if fileExists("/.multinfo"): - if fileExists( - "/media/InternalFlash/linuxrootfs1/sbin/neoinitarm" - ): - run_shell_command( - 'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs1/sbin/init"' - ) - if fileExists( - "/media/InternalFlash/linuxrootfs2/sbin/neoinitarm" - ): - run_shell_command( - 'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs2/sbin/init"' - ) - if fileExists( - "/media/InternalFlash/linuxrootfs3/sbin/neoinitarm" - ): - run_shell_command( - 'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs3/sbin/init"' - ) - if fileExists( - "/media/InternalFlash/linuxrootfs4/sbin/neoinitarm" - ): - run_shell_command( - 'ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs4/sbin/init"' - ) - if fileExists("/media/InternalFlash/sbin/init"): - run_shell_command( - 'ln -sfn "init.sysvinit" "/media/InternalFlash/sbin/init"' - ) - - self.session.open(TryQuitMainloop, 2) - - else: - cmd = "ln -sfn /sbin/init.sysvinit /sbin/init" - run_shell_command(cmd) # Removed unused 'rc' - self.session.open(TryQuitMainloop, 2) - - elif getImageNeoBoot() != "Flash": - if fileExists("/.multinfo"): - if fileExists( - "/media/InternalFlash/linuxrootfs1/sbin/neoinitarm" - ): - cmd = "cd /media/InternalFlash/linuxrootfs1; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs1/sbin/init" - run_shell_command(cmd) # Removed unused 'rc' - self.session.open(TryQuitMainloop, 2) - elif fileExists( - "/media/InternalFlash/linuxrootfs2/sbin/neoinitarm" - ): - cmd = "cd /media/InternalFlash/linuxrootfs2; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs2/sbin/init" - run_shell_command(cmd) # Removed unused 'rc' - self.session.open(TryQuitMainloop, 2) - elif fileExists( - "/media/InternalFlash/linuxrootfs3/sbin/neoinitarm" - ): - cmd = "cd /media/InternalFlash/linuxrootfs3; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs3/sbin/init" - run_shell_command(cmd) # Removed unused 'rc' - self.session.open(TryQuitMainloop, 2) - elif fileExists( - "/media/InternalFlash/linuxrootfs4/sbin/neoinitarm" - ): - cmd = "cd /media/InternalFlash/linuxrootfs4; ln -sfn /sbin/neoinitarm /media/InternalFlash/linuxrootfs4/sbin/init" - run_shell_command(cmd) # Removed unused 'rc' - self.session.open(TryQuitMainloop, 2) + if not fileExists('/bin/busybox.nosuid'): + os.system('ln -sf "busybox" "/bin/busybox.nosuid" ') + if fileExists('/media/InternalFlash/etc/init.d/neomountboot.sh'): + os.system('rm -f /media/InternalFlash/etc/init.d/neomountboot.sh;') + if fileExists('/media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh'): + os.system('rm -f /media/InternalFlash/linuxrootfs1/etc/init.d/neomountboot.sh;') + if fileExists('/media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh'): + os.system('rm -f /media/InternalFlash/linuxrootfs2/etc/init.d/neomountboot.sh;') + if fileExists('/media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh'): + os.system('rm -f /media/InternalFlash/linuxrootfs3/etc/init.d/neomountboot.sh;') + if fileExists('/media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh'): + os.system('rm -f /media/InternalFlash/linuxrootfs4/etc/init.d/neomountboot.sh;') +# else: +# pass + #_____ARM procesor____ + if (getSupportedTuners()): + if getImageNeoBoot() == 'Flash': + if fileExists('/.multinfo'): + if fileExists('/media/InternalFlash/linuxrootfs1/sbin/neoinitarm'): + os.system('ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs1/sbin/init"') + if fileExists('/media/InternalFlash/linuxrootfs2/sbin/neoinitarm'): + os.system('ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs2/sbin/init"') + if fileExists('/media/InternalFlash/linuxrootfs3/sbin/neoinitarm'): + os.system('ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs3/sbin/init"') + if fileExists('/media/InternalFlash/linuxrootfs4/sbin/neoinitarm'): + os.system('ln -sf "init.sysvinit" "/media/InternalFlash/linuxrootfs4/sbin/init"') + if fileExists('/media/InternalFlash/sbin/init'): + os.system('ln -sfn "init.sysvinit" "/media/InternalFlash/sbin/init"') + if fileExists('/media/InternalFlash'): + 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) else: - self.session.open(TryQuitMainloop, 2) + 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() - elif not fileExists("/.multinfo"): - cmd = "ln -sfn /sbin/neoinitarm /sbin/init" - run_shell_command(cmd) # Removed unused 'rc' - self.session.open(TryQuitMainloop, 2) - else: - cmd = "ln -sfn /sbin/init.sysvinit /sbin/init" - run_shell_command(cmd) # Removed unused 'rc' - self.session.open(TryQuitMainloop, 2) - else: - run_shell_command( - 'echo "Flash " >> ' - + getNeoLocation() - + "ImageBoot/.neonextboot" - ) - self.messagebox = self.session.open( - MessageBox, - _("It looks like it that multiboot does not support this STB."), - MessageBox.TYPE_INFO, - 8, - ) - self.close() else: - run_shell_command( - 'echo "Flash " >> ' + - getNeoLocation() + - "ImageBoot/.neonextboot") - self.messagebox = self.session.open( - MessageBox, - _("It looks like it that multiboot does not support this STB."), - MessageBox.TYPE_INFO, - 8, - ) - self.close() + 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() + diff --git a/NeoBoot/tmpfiles/mips_run.py b/NeoBoot/tmpfiles/mips_run.py index 99f820e..23813b6 100644 --- a/NeoBoot/tmpfiles/mips_run.py +++ b/NeoBoot/tmpfiles/mips_run.py @@ -1,19 +1,7 @@ +# -*- coding: utf-8 -*- + from Plugins.Extensions.NeoBoot.__init__ import _ -from Plugins.Extensions.NeoBoot.files.stbbranding import ( - getSupportedTuners, - getNeoLocation, - getCPUtype, - getCPUSoC, - getImageNeoBoot, - getBoxVuModel, - getBoxHostName, - getNeoMount, - getNeoMount2, - getNeoMount3, - getNeoMount4, - getNeoMount5, - getMountPointNeo2, -) +from Plugins.Extensions.NeoBoot.files.stbbranding import getSupportedTuners, getNeoLocation, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getMountPointNeo2 from enigma import getDesktop from enigma import eTimer from Screens.Screen import Screen @@ -36,28 +24,12 @@ from Components.Pixmap import Pixmap, MultiPixmap from Components.config import * from Components.ConfigList import ConfigListScreen from Tools.LoadPixmap import LoadPixmap -from Tools.Directories import ( - fileExists, - pathExists, - createDir, - resolveFilename, - SCOPE_PLUGINS, -) -from os import ( - system, - listdir, - mkdir, - chdir, - getcwd, - rename as os_rename, - remove as os_remove, - popen, -) +from Tools.Directories import fileExists, pathExists, createDir, resolveFilename, SCOPE_PLUGINS +from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen from os.path import dirname, isdir, isdir as os_isdir import os import time - -LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot" +LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' class StartImage(Screen): @@ -94,122 +66,79 @@ class StartImage(Screen): def __init__(self, session): Screen.__init__(self, session) self.list = [] - self["list"] = List(self.list) + self['list'] = List(self.list) self.select() - self["actions"] = ActionMap(["WizardActions", "ColorActions"], { - "ok": self.KeyOk, "back": self.close}) - self["label1"] = Label(_("Start the chosen system now ?")) - self["label2"] = Label(_("Select OK to run the image.")) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, + 'back': self.close}) + self['label1'] = Label(_('Start the chosen system now ?')) + self['label2'] = Label(_('Select OK to run the image.')) def select(self): self.list = [] - mypath = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot" - if not fileExists(mypath + "icons"): - mypixmap = ( - "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png" - ) + mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + if not fileExists(mypath + 'icons'): + mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' png = LoadPixmap(mypixmap) - res = (_("OK Start image..."), png, 0) + res = (_('OK Start image...'), png, 0) self.list.append(res) - self["list"].list = self.list + self['list'].list = self.list def KeyOk(self): - if getImageNeoBoot() != "Flash": - os.system( - "rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh" - % (getNeoLocation(), getImageNeoBoot()) - ) - self.StartImageInNeoBoot() + if getImageNeoBoot() != 'Flash': + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) + self.StartImageInNeoBoot() else: - os.system( - "rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh" - % (getNeoLocation(), getImageNeoBoot()) - ) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() + #--------------------------------------------- getMountPointNeo2() - system("touch /tmp/.init_reboot") + system('touch /tmp/.init_reboot') + #--------------------------------------------- def StartImageInNeoBoot(self): - if getImageNeoBoot() != "Flash": - if fileExists( - "%sImageBoot/%s/.control_ok" % - (getNeoLocation(), getImageNeoBoot())): - system("touch /tmp/.control_ok ") + if getImageNeoBoot() != 'Flash': + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): + system('touch /tmp/.control_ok ') else: - system( - "touch %sImageBoot/%s/.control_boot_new_image " - % (getNeoLocation(), getImageNeoBoot()) - ) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) - self.sel = self["list"].getCurrent() + #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;") - 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 fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'): + os.system('rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;') + if (getSupportedTuners()): + if getImageNeoBoot() == 'Flash': + cmd = 'ln -sfn /sbin/init.sysvinit /sbin/init' + 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') + + diff --git a/NeoBoot/tmpfiles/vu4k_run.py b/NeoBoot/tmpfiles/vu4k_run.py index be610b5..66a8cd6 100644 --- a/NeoBoot/tmpfiles/vu4k_run.py +++ b/NeoBoot/tmpfiles/vu4k_run.py @@ -1,18 +1,9 @@ +# -*- coding: utf-8 -*- + +#from __init__ import _ from Plugins.Extensions.NeoBoot.__init__ import _ -from Plugins.Extensions.NeoBoot.files.stbbranding import ( - getNeoLocation, - getCPUtype, - getCPUSoC, - getImageNeoBoot, - getBoxVuModel, - getBoxHostName, - getNeoMount, - getNeoMount2, - getNeoMount3, - getNeoMount4, - getNeoMount5, - getMountPointNeo2, -) +#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 from Screens.Screen import Screen @@ -35,48 +26,22 @@ from Components.Pixmap import Pixmap, MultiPixmap from Components.config import * from Components.ConfigList import ConfigListScreen from Tools.LoadPixmap import LoadPixmap -from Tools.Directories import ( - fileExists, - pathExists, - createDir, - resolveFilename, - SCOPE_PLUGINS, -) -import subprocess -from os import listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove +from Tools.Directories import fileExists, pathExists, createDir, resolveFilename, SCOPE_PLUGINS +from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen from os.path import dirname, isdir, isdir as os_isdir import os import time - -LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot" - +LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' def getMmcBlockDevice(): - mmcblockdevice = "UNKNOWN" - if ( - getBoxHostName() == "vuultimo4k" - or getBoxHostName() == "vusolo4k" - or getBoxHostName() == "vuuno4kse" - or getBoxHostName() == "vuuno4k" - and getBoxHostName() != "ustym4kpro" - ): - mmcblockdevice = "mmcblk0p1" - elif ( - getBoxHostName() == "vuzero4k" - and getBoxVuModel() == "zero4k" - and getCPUSoC() == "72604" - and getBoxHostName() != "ustym4kpro" - ): - mmcblockdevice = "mmcblk0p4" - elif ( - getBoxHostName() == "vuduo4k" - or getBoxHostName() == "vuduo4kse" - and getBoxHostName() != "vuultimo4k" - and getBoxHostName() != "ustym4kpro" - ): - mmcblockdevice = "mmcblk0p6" - return mmcblockdevice - + mmcblockdevice = 'UNKNOWN' + if getBoxHostName() == 'vuultimo4k' or getBoxHostName() == 'vusolo4k' or getBoxHostName() == 'vuuno4kse' or getBoxHostName() == 'vuuno4k' and getBoxHostName() != "ustym4kpro": + mmcblockdevice = 'mmcblk0p1' + elif getBoxHostName() == 'vuzero4k' and getBoxVuModel() == 'zero4k' and getCPUSoC() == '72604' and getBoxHostName() != "ustym4kpro": + mmcblockdevice = 'mmcblk0p4' + elif getBoxHostName() == 'vuduo4k' or getBoxHostName() == 'vuduo4kse' and getBoxHostName() != "vuultimo4k" and getBoxHostName() != "ustym4kpro": + mmcblockdevice = 'mmcblk0p6' + return mmcblockdevice class StartImage(Screen): screenwidth = getDesktop(0).size().width() @@ -112,360 +77,124 @@ class StartImage(Screen): def __init__(self, session): Screen.__init__(self, session) self.list = [] - self["list"] = List(self.list) + self['list'] = List(self.list) self.select() - self["actions"] = ActionMap(["WizardActions", "ColorActions"], { - "ok": self.KeyOk, "back": self.close}) - self["label1"] = Label(_("Start the chosen system now ?")) - self["label2"] = Label(_("Select OK to run the image.")) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, + 'back': self.close}) + self['label1'] = Label(_('Start the chosen system now ?')) + self['label2'] = Label(_('Select OK to run the image.')) def select(self): self.list = [] - mypath = "" + LinkNeoBoot + "" - if not fileExists(mypath + "icons"): - mypixmap = "" + LinkNeoBoot + "/images/ok.png" + mypath = '' + LinkNeoBoot + '' + if not fileExists(mypath + 'icons'): + mypixmap = '' + LinkNeoBoot + '/images/ok.png' png = LoadPixmap(mypixmap) - res = (_("OK Start image..."), png, 0) + res = (_('OK Start image...'), png, 0) self.list.append(res) - self["list"].list = self.list + self['list'].list = self.list def KeyOk(self): if getImageNeoBoot() != "Flash": - subprocess.run( - "rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh" - % (getNeoLocation(), getImageNeoBoot()), - shell=True, - ) - self.StartImageInNeoBoot() + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) + self.StartImageInNeoBoot() else: - subprocess.run( - "rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh" - % (getNeoLocation(), getImageNeoBoot()), - shell=True, - ) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() + #--------------------------------------------- getMountPointNeo2() - subprocess.run("touch /tmp/.init_reboot", shell=True) + system('touch /tmp/.init_reboot') + #--------------------------------------------- def StartImageInNeoBoot(self): if getImageNeoBoot() != "Flash": - if fileExists( - "%sImageBoot/%s/.control_ok" % - (getNeoLocation(), getImageNeoBoot())): - subprocess.run("touch /tmp/.control_ok ", shell=True) + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): + system('touch /tmp/.control_ok ') else: - subprocess.run( - "touch %sImageBoot/%s/.control_boot_new_image " - % (getNeoLocation(), getImageNeoBoot()), - shell=True, - ) + 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" - ): - subprocess.run( - "mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash", - shell=True, - ) - elif getBoxVuModel() == "duo4kse" or getBoxVuModel() == "duo4k": - subprocess.run( - "mkdir -p /media/InternalFlash; mount /dev/mmcblk0p9 /media/InternalFlash", - shell=True, - ) - elif getBoxVuModel() == "zero4k": - subprocess.run( - "mkdir -p /media/InternalFlash; mount /dev/mmcblk0p7 /media/InternalFlash", - shell=True, - ) - else: - subprocess.run( - " " + - LinkNeoBoot + - "/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash", - shell=True, - ) - - self.sel = self["list"].getCurrent() + 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"') + + 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"): - subprocess.run( - "rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;", - shell=True) - if not fileExists("/bin/busybox.nosuid"): - subprocess.run( - 'ln -sf "busybox" "/bin/busybox.nosuid" ', - shell=True) - - 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"' - 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() - + "" - ) - 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: " - + getCPUtype() - + " " - + getCPUSoC() - + "\nImage boot: " - + getImageNeoBoot() - + "\n____Your device will REBOOT in 5 seconds !____\n\n ------------ N E O B O O T ------------" - ) - cmd4 = "sleep 8; reboot -d -f " - elif fileExists( - "%sImageBoot/%s/boot/zImage.%s" - % ( - getNeoLocation(), - getImageNeoBoot(), - getBoxHostName(), - ) - ): - cmd = "echo -e '\n\n%s '" % _( - "...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted..." - ) - cmd1 = "ln -sfn /sbin/neoinitarmvu /sbin/init" - cmd2 = ( - "dd if=" - + getNeoLocation() - + "ImageBoot/" - + getImageNeoBoot() - + "/boot/zImage." - + getBoxHostName() - + " of=/dev/" - + getMmcBlockDevice() - + "" - ) - cmd3 = "echo -e '\n%s '" % _( - "Changed kernel COMPLETE !\nSTB NAME: " - + getBoxHostName() - + "\nMODEL: " - + getBoxVuModel() - + "\nNeoBoot location:" - + getNeoLocation() - + "\nCPU: " - + getCPUtype() - + " " - + getCPUSoC() - + "\nImage boot: " - + getImageNeoBoot() - + "\n____Your device will reboot in 5 seconds !____\n\n ------------ N E O B O O T ------------" - ) - cmd4 = ( - 'update-alternatives --remove vmlinux vmlinux-`uname -r` || true; echo "Used Kernel: " ' + - getImageNeoBoot() + - " > " + - getNeoLocation() + - "ImagesUpload/.kernel/used_flash_kernel; sleep 8; reboot -d -f") - 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 fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'): + os.system('rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;') + if not fileExists('/bin/busybox.nosuid'): + os.system('ln -sf "busybox" "/bin/busybox.nosuid" ') + # 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() + else: - subprocess.run( - 'echo "Flash " >> ' + - getNeoLocation() + - "ImageBoot/.neonextboot", - shell=True, - ) - self.messagebox = self.session.open( - MessageBox, - _("It looks like it that multiboot does not support this STB."), - MessageBox.TYPE_INFO, - 8, - ) - self.close() - + 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() + diff --git a/NeoBoot/tmpfiles/vu_run.py b/NeoBoot/tmpfiles/vu_run.py index 8334187..de7ac36 100644 --- a/NeoBoot/tmpfiles/vu_run.py +++ b/NeoBoot/tmpfiles/vu_run.py @@ -1,21 +1,7 @@ +# -*- coding: utf-8 -*- + from Plugins.Extensions.NeoBoot.__init__ import _ -from Plugins.Extensions.NeoBoot.files.stbbranding import ( - getNeoLocation, - getCPUtype, - getCPUSoC, - getImageNeoBoot, - getBoxVuModel, - getBoxHostName, - getNeoMount, - getNeoMount2, - getNeoMount3, - getNeoMount4, - getNeoMount5, - getMountPointNeo2, - getNandWrite, - getExtCheckHddUsb, - getImageBootNow, -) +from Plugins.Extensions.NeoBoot.files.stbbranding import getNeoLocation, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getNeoMount, getNeoMount2, getNeoMount3, getNeoMount4, getNeoMount5, getMountPointNeo2, getNandWrite, getExtCheckHddUsb, getImageBootNow from enigma import getDesktop from enigma import eTimer from Screens.Screen import Screen @@ -38,68 +24,23 @@ from Components.Pixmap import Pixmap, MultiPixmap from Components.config import * from Components.ConfigList import ConfigListScreen from Tools.LoadPixmap import LoadPixmap -from Tools.Directories import ( - fileExists, - pathExists, - createDir, - resolveFilename, - SCOPE_PLUGINS, -) -from os import ( - system, - listdir, - mkdir, - chdir, - getcwd, - rename as os_rename, - remove as os_remove, - popen, -) +from Tools.Directories import fileExists, pathExists, createDir, resolveFilename, SCOPE_PLUGINS +from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen from os.path import dirname, isdir, isdir as os_isdir import os import time - -LinkNeoBoot = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot" - +LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' def getMmcBlockDevice(): - if ( - getBoxHostName() == "vuultimo" - or getBoxHostName() == "bm750" - or getBoxHostName() == "vuduo" - or getBoxHostName() == "vuuno" - or getBoxHostName() == "vusolo" - or getBoxHostName() == "vuduo" - ): - mmcblockdevice = "mtd1" - if ( - fileExists( - "" - + getNeoLocation() - + "ImageBoot/" - + getImageNeoBoot() - + "/etc/vtiversion.info" - ) - and getExtCheckHddUsb() == "ext4" - ): - if fileExists( - "%sImageBoot/%s/boot/%s.vmlinux.gz" - % (getNeoLocation(), getImageNeoBoot(), getBoxHostName()) - ): - os.system( - "rm -r %sImageBoot/%s/boot/%s.vmlinux.gz" - % (getNeoLocation(), getImageNeoBoot(), getBoxHostName()) - ) - elif ( - getBoxHostName() == "vusolo2" - or getBoxHostName() == "vusolose" - or getBoxHostName() == "vuduo2" - or getBoxHostName() == "vuzero" - ): - mmcblockdevice = "mtd2" + if getBoxHostName() == 'vuultimo' or getBoxHostName() == 'bm750' or getBoxHostName() == 'vuduo' or getBoxHostName() == 'vuuno' or getBoxHostName() == 'vusolo' or getBoxHostName() == 'vuduo': + mmcblockdevice = 'mtd1' + if fileExists('' + getNeoLocation() + 'ImageBoot/' + getImageNeoBoot() + '/etc/vtiversion.info') and getExtCheckHddUsb() == 'ext4': + if fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + os.system('rm -r %sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())) + elif getBoxHostName() == 'vusolo2' or getBoxHostName() == 'vusolose' or getBoxHostName() == 'vuduo2' or getBoxHostName() == 'vuzero': + mmcblockdevice = 'mtd2' return mmcblockdevice - class StartImage(Screen): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: @@ -134,388 +75,137 @@ class StartImage(Screen): def __init__(self, session): Screen.__init__(self, session) self.list = [] - self["list"] = List(self.list) + self['list'] = List(self.list) self.select() - self["actions"] = ActionMap(["WizardActions", "ColorActions"], { - "ok": self.KeyOk, "back": self.close}) - self["label1"] = Label(_("Start the chosen system now ?")) - self["label2"] = Label(_("Select OK to run the image.")) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, + 'back': self.close}) + self['label1'] = Label(_('Start the chosen system now ?')) + self['label2'] = Label(_('Select OK to run the image.')) def select(self): self.list = [] - mypath = "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot" - if not fileExists(mypath + "icons"): - mypixmap = ( - "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png" - ) + mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + if not fileExists(mypath + 'icons'): + mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' png = LoadPixmap(mypixmap) - res = (_("OK Start image..."), png, 0) + res = (_('OK Start image...'), png, 0) self.list.append(res) - self["list"].list = self.list + self['list'].list = self.list def KeyOk(self): - if getImageNeoBoot() != "Flash": - os.system( - "rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh" - % (getNeoLocation(), getImageNeoBoot()) - ) - self.StartImageInNeoBoot() + 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') + + if getNandWrite() == 'nandwrite': + os.system('echo "nandwrite" > /tmp/check_nandwrite') + #--------------------------------------------- getMountPointNeo2() - system("touch /tmp/.init_reboot") + system('touch /tmp/.init_reboot') + #--------------------------------------------- def StartImageInNeoBoot(self): - if getImageNeoBoot() != "Flash": - if fileExists( - "%sImageBoot/%s/.control_ok" % - (getNeoLocation(), getImageNeoBoot())): - system("touch /tmp/.control_ok ") + if getImageNeoBoot() != 'Flash': + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): + system('touch /tmp/.control_ok ') else: - system( - "touch %sImageBoot/%s/.control_boot_new_image " - % (getNeoLocation(), getImageNeoBoot()) - ) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) + + system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/*') - system("chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/*") - - self.sel = self["list"].getCurrent() + self.sel = self['list'].getCurrent() if self.sel: self.sel = self.sel[2] if self.sel == 0: - if fileExists("/media/InternalFlash/etc/init.d/neobootmount.sh"): - os.system( - "rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;") - if not fileExists("/bin/busybox.nosuid"): + if fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'): + os.system('rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;') + if not fileExists('/bin/busybox.nosuid'): os.system('ln -sf "busybox" "/bin/busybox.nosuid" ') +#################_____mips___########################## + #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" - - 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() + 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() + 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() +