From cded5ac6ef4c97d3fddfe5f3f015fd1d5c33df3e Mon Sep 17 00:00:00 2001 From: gutosie Date: Thu, 11 Mar 2021 13:04:45 +0200 Subject: [PATCH] Add files via upload --- NeoBoot/files/backflash | 4 +- NeoBoot/files/neoreboot | 112 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 109 insertions(+), 7 deletions(-) diff --git a/NeoBoot/files/backflash b/NeoBoot/files/backflash index 198a68c..6d712e9 100644 --- a/NeoBoot/files/backflash +++ b/NeoBoot/files/backflash @@ -54,7 +54,7 @@ if [ -e /.multinfo ]; then flash_eraseall /dev/mtd1 echo "Instalacja kernel do /dev/mtd1..." sleep 2 - /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/nandwrite -p /dev/mtd1 $NEOBOOTMOUNT$UPLOAD/.kernel/$BOXNAME.vmlinux.gz + nandwrite -p /dev/mtd1 $NEOBOOTMOUNT$UPLOAD/.kernel/$BOXNAME.vmlinux.gz fi fi update-alternatives --remove vmlinux vmlinux-`uname -r` || true @@ -68,7 +68,7 @@ if [ -e /.multinfo ]; then flash_eraseall /dev/mtd2 echo "Instalacja kernel do /dev/mtd2..." sleep 2 - /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/nandwrite -p /dev/mtd2 $NEOBOOTMOUNT$UPLOAD/.kernel/$BOXNAME.vmlinux.gz + nandwrite -p /dev/mtd2 $NEOBOOTMOUNT$UPLOAD/.kernel/$BOXNAME.vmlinux.gz fi fi update-alternatives --remove vmlinux vmlinux-`uname -r` || true diff --git a/NeoBoot/files/neoreboot b/NeoBoot/files/neoreboot index 05b1240..0f6dfbf 100644 --- a/NeoBoot/files/neoreboot +++ b/NeoBoot/files/neoreboot @@ -18,7 +18,6 @@ from Plugins.Plugin import PluginDescriptor from Screens.Standby import TryQuitMainloop from Screens.MessageBox import MessageBox from Screens.Screen import Screen -from Screens.Console import Console from Tools.LoadPixmap import LoadPixmap from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, fileExists, pathExists, createDir from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen @@ -29,8 +28,112 @@ import os import time import sys import struct, shutil +if fileExists('/etc/vtiversion.info') or fileExists('/usr/lib/python3.8') and fileExists('/.multinfo'): + from Screens.Console import Console +else: + from Plugins.Extensions.NeoBoot.files.neoconsole import Console LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + +class NBIChoose2(Screen): + skin = """ \n\t\n\t\t + \n\t\t + \n\t\t + \n\t\t\t + \n\t\t\n\t\t + \n\t\t + \n\t\t + \n\t + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['device_icon'] = Pixmap() + self['lab1'] = Label('') + self['lab2'] = Label('') + self['key_red'] = Label(_('Force reboot')) + self['key_green'] = Label(_('Boot Image')) + self['key_blue'] = Label(_('Help')) + self['list'] = List([]) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'ok': self.bootImage, + 'red': self.forceBoot, + 'green': self.bootImage, + 'blue': self.mytools}) + self.availablespace = 0 + self.curimage = '' + self.onShow.append(self.updateInfo) + + def updateInfo(self): + pluginpath = '' + LinkNeoBoot + '' + f = open(pluginpath + '/.location', 'r') + mypath = f.readline().strip() + f.close() + + curimage = 'Flash' + if fileExists('/.multinfo'): + f = open('/.multinfo', 'r') + curimage = f.readline().strip() + f.close() + strview = _('Current Running Image: ') + curimage + self.curimage = curimage + self['lab1'].setText(strview) + + linesdevice = open('' + LinkNeoBoot + '/.location', 'r').readlines() + deviceneo = linesdevice[0][0:-1] + device = deviceneo + devicelist = ['cf', + 'hdd', + 'card', + 'usb', + 'usb2'] + for d in listdir('' + getNeoLocation() +''): + if d == 'ImageBoot': + continue + test = '' + getNeoLocation() +'' + d + '/.neonextboot' + if fileExists(test): + device = d + + strview = _('NeoBoot Installed on: ') + device + self['lab2'].setText(strview) + + imageslist = ['Flash'] + for fn in listdir('' + getNeoLocation() + '/ImageBoot'): + dirfile = '' + getNeoLocation() + '/ImageBoot/' + fn + if os_isdir(dirfile): + imageslist.append(fn) + + self['list'].list = imageslist + + def mytools(self): + from Plugins.Extensions.NeoBoot.files.tools import MBTools + self.session.open(MBTools) + + def bootImage(self): + newimage = self['list'].getCurrent() + if newimage: + self.rebootimage = newimage.strip() + message = _('Are you sure you want to Boot Image:\n ') + newimage + '?' + ybox = self.session.openWithCallback(self.restStb, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Reboot Confirmation')) + + def restStb(self, answer): + if answer is True: + newimage = self['list'].getCurrent() + if newimage: + out = open('' + getNeoLocation() +'/ImageBoot/.neonextboot', 'w') + out.write(self.rebootimage) + out.close() + try: + from Plugins.Extensions.NeoBoot.run import StartImage + self.session.open(StartImage) + except: + self.session.open(TryQuitMainloop, 2) + self.close() + + def forceBoot(self): + self.session.open(ForceReboot) + class ForceReboot(Screen): __module__ = __name__ skin = """ @@ -68,7 +171,7 @@ class ForceReboot(Screen): def main(session, **kwargs): try: - session.open(ForceReboot) + session.open(NBIChoose2) except: False @@ -85,6 +188,5 @@ def Plugins(path, **kwargs): global plugin_path plugin_path = path list = [PluginDescriptor(name=_('NeoReboot'), description=_('Force reboot to flash.'), where=PluginDescriptor.WHERE_MENU, fnc=startSetup)] - return list - - + return list + \ No newline at end of file