def startup_option(self): if self.option_enabled: self["options"].setText(_("Select bootoption: %s") % self.optionsList[self.option][1]) elif 'up' in self["actions"].actions: self["options"].setText(_("Select bootoption: not supported - see info")) del self["actions"].actions['up'] del self["actions"].actions['down']
def __init__(self, session): Screen.__init__(self, session) self.setup_title = _("MultiBoot STARTUP switcher") self.skin = MultiBootSwitcher.skin self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText(_("Rename")) self["config"] = StaticText() self["options"] = StaticText() self["description"] = Label() self["curbootmode"] = Label() self["actions"] = ActionMap(["InfobarEPGActions", "WizardActions", "SetupActions", "ColorActions"], { "left": self.left, "right": self.right, "up": self.up, "down": self.down, "green": self.save, "red": self.cancel, "yellow": self.rename, "cancel": self.cancel, #"ok": self.save, "showEventInfo": self.info, "showEventInfoSingleEPG": self.info, }, -2) self.MultiBootSelector = False self.waitTimer = eTimer() self.waitTimer.callback.append(self.initWaitcheckMount) self.waitTimer.start(500, True) self.curBootmode() self.onLayoutFinish.append(self.layoutFinished)
def renameCB(self, newname): if newname and newname != 'bootname' and newname != self.oldname: if not os.path.exists('/boot/%s' % newname) and os.path.isfile( '/boot/%s' % self.oldname): ret = os.system("mv -fn '/boot/%s' '/boot/%s'" % (self.oldname, newname)) if ret: self.session.open(MessageBox, _('Rename failed!'), MessageBox.TYPE_ERROR) else: bootname = self.readlineFile('/boot/bootname').split('=') if len(bootname) == 2 and bootname[1] == self.oldname: self.writeFile('/boot/bootname', '%s=%s' % (bootname[0], newname)) self.getCurrent() return elif self.bootname == self.oldname: self.getCurrent() return self.list[self.selection] = newname self["config"].setText(_("Select Image: %s") % newname) else: if not os.path.exists('/boot/%s' % self.oldname): self.getCurrent() txt = _("File not found - rename failed!") else: txt = _("Name already exists - rename failed!") self.session.open(MessageBox, txt, MessageBox.TYPE_ERROR)
def startup_option(self): if self.option_enabled: self["options"].setText( _("Select bootoption: %s") % self.optionsList[self.option][1]) elif 'up' in self["actions"].actions: self["options"].setText( _("Select bootoption: not supported - see info")) del self["actions"].actions['up'] del self["actions"].actions['down']
def startup(self): if not self.MultiBootSelector: return if len(self.list): self["config"].setText(_("Select Image: %s") % (self.list[self.selection] + self.getNumberPartition())) elif 'left' in self["actions"].actions: self["config"].setText(_("Select Image: %s") % _("no image found")) del self["actions"].actions['left'] del self["actions"].actions['right'] del self["actions"].actions['green'] del self["actions"].actions['yellow']
def startup(self): if not self.MultiBootSelector: return if len(self.list): self["config"].setText( _("Select Image: %s") % self.list[self.selection]) elif 'left' in self["actions"].actions: self["config"].setText(_("Select Image: %s") % _("no image found")) del self["actions"].actions['left'] del self["actions"].actions['right'] del self["actions"].actions['green'] del self["actions"].actions['yellow']
def rename(self): if not self.MultiBootSelector: return if self.list: self.oldname = self.list[self.selection] if self.oldname: self.session.openWithCallback(self.renameCB, VirtualKeyBoard, title=_("Please enter new name:"), text=self.oldname)
def rename(self): if not self.MultiBootSelector: return if self.list: self.oldname = self.list[self.selection] if self.oldname: self.session.openWithCallback( self.renameCB, VirtualKeyBoard, title=_("Please enter new name:"), text=self.oldname)
def info(self): if not self.MultiBootSelector: return message = ( #message 0 _("*** boxmode=1 (Standard) ***\n\n" + "+++ Features +++\n" + "3840x2160p60 10-bit HEVC, 3840x2160p60 8-bit VP9, 1920x1080p60 8-bit AVC,\nMAIN only (no PIP), Limited display usages, UHD only (no SD),\nNo multi-PIP, No transcoding\n\n" + "--- Restrictions ---\n" + "Decoder 0: 3840x2160p60 10-bit HEVC, 3840x2160p60 8-bit VP9, 1920x1080p60 8-bit AVC\n" + "OSD Grafic 0: 1080p60 32 bit ARGB\n" + "Display 0 Encode Restrictions: 3840x2160p60 12-bit 4:2:0 (HDMI),\n3840x2160p60 12-bit 4:2:2 (HDMI), 3840x2160p60 8-bit 4:4:4 (HDMI),\n1920x1080p60 (component), Only one display format at a time\n\n" + "If you want 1080p60 component, HDMI also needs to be 1080p60."), #message 1 _("*** boxmode=12 (Experimental) ***\n\n" + "+++ Features +++\n" + "3840x2160p50 10-bit decode for MAIN, 1080p25/50i PIP support, HDMI input (if available),\n UHD display only, No SD display, No transcoding\n\n" + "--- Restrictions ---\n" + "Decoder 0: 3840x2160p50 10-bit HEVC, 3840x2160p50 8-bit VP9,\n1920x1080p50 8-bit AVC/MPEG\n" + "Decoder 1: 1920x1080p25/50i 10-bit HEVC, 1920x1080p25/50i 8-bit VP9/AVC/MPEG2,\nHDMI In (if available), 3840x2160p50\n" + "OSD Graphic 0 (UHD): 1080p50 32-bit ARGB\n" + "Window 0 (MAIN/UHD): Limited display capabilities, 1080i50 10-bit de-interlacing\n" + "Multi-PIP mode (3x): Enigma2 supported no multi-PIP\n" + "Window 1 (PIP/UHD) (Enigma2 PIP Mode): Up to 1/2 x 1/2 screen display, 576i50 de-interlacing\n" + "Display 0 (UHD) Encode Restrictions: 3840x2160p50"), #message 2 _("placeholder message 2"), ) if not self.option_enabled: idx = 0 blv = '' for x in self.bootloaderList: if idx: blv += ', ' blv += x idx += 1 message = (_( "Your box needs Bootloaderversion(s)\n\n%s\n\nto make compatible with Bootoptions!" ) % blv, ) self.session.open(MessageBox, message[self.option], MessageBox.TYPE_INFO)
def info(self): if not self.MultiBootSelector: return message = ( #message 0 _("*** boxmode=1 (Standard) ***\n\n" + "+++ Features +++\n" + "3840x2160p60 10-bit HEVC, 3840x2160p60 8-bit VP9, 1920x1080p60 8-bit AVC,\nMAIN only (no PIP), Limited display usages, UHD only (no SD),\nNo multi-PIP, No transcoding\n\n" + "--- Restrictions ---\n" + "Decoder 0: 3840x2160p60 10-bit HEVC, 3840x2160p60 8-bit VP9, 1920x1080p60 8-bit AVC\n" + "OSD Grafic 0: 1080p60 32 bit ARGB\n" + "Display 0 Encode Restrictions: 3840x2160p60 12-bit 4:2:0 (HDMI),\n3840x2160p60 12-bit 4:2:2 (HDMI), 3840x2160p60 8-bit 4:4:4 (HDMI),\n1920x1080p60 (component), Only one display format at a time\n\n" + "If you want 1080p60 component, HDMI also needs to be 1080p60."), #message 1 _("*** boxmode=12 (Experimental) ***\n\n" + "+++ Features +++\n" + "3840x2160p50 10-bit decode for MAIN, 1080p25/50i PIP support, HDMI input (if available),\n UHD display only, No SD display, No transcoding\n\n" + "--- Restrictions ---\n" + "Decoder 0: 3840x2160p50 10-bit HEVC, 3840x2160p50 8-bit VP9,\n1920x1080p50 8-bit AVC/MPEG\n" + "Decoder 1: 1920x1080p25/50i 10-bit HEVC, 1920x1080p25/50i 8-bit VP9/AVC/MPEG2,\nHDMI In (if available), 3840x2160p50\n" + "OSD Graphic 0 (UHD): 1080p50 32-bit ARGB\n" + "Window 0 (MAIN/UHD): Limited display capabilities, 1080i50 10-bit de-interlacing\n" + "Multi-PIP mode (3x): Enigma2 supported no multi-PIP\n" + "Window 1 (PIP/UHD) (Enigma2 PIP Mode): Up to 1/2 x 1/2 screen display, 576i50 de-interlacing\n" + "Display 0 (UHD) Encode Restrictions: 3840x2160p50"), #message 2 _("placeholder message 2"), ) if not self.option_enabled: idx = 0 blv = '' for x in self.bootloaderList: if idx: blv += ', ' blv += x idx += 1 message = (_("Your box needs Bootloaderversion(s)\n\n%s\n\nto make compatible with Bootoptions!") % blv,) self.session.open(MessageBox, message[self.option], MessageBox.TYPE_INFO)
def __init__(self, session): Screen.__init__(self, session) self.setup_title = _("MultiBoot STARTUP switcher") self.skin = MultiBootSwitcher.skin self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText(_("Rename")) self["config"] = StaticText() self["options"] = StaticText() self["description"] = Label() self["curbootmode"] = Label() self["actions"] = ActionMap( [ "InfobarEPGActions", "WizardActions", "SetupActions", "ColorActions" ], { "left": self.left, "right": self.right, "up": self.up, "down": self.down, "green": self.save, "red": self.cancel, "yellow": self.rename, "cancel": self.cancel, #"ok": self.save, "showEventInfo": self.info, "showEventInfoSingleEPG": self.info, }, -2) self.MultiBootSelector = False self.waitTimer = eTimer() self.waitTimer.callback.append(self.initWaitcheckMount) self.waitTimer.start(500, True) self.curBootmode() self.onLayoutFinish.append(self.layoutFinished)
def renameCB(self, newname): if newname and newname != 'bootname' and newname != self.oldname: if not os.path.exists('/boot/%s' %newname) and os.path.isfile('/boot/%s' %self.oldname): ret = os.system("mv -fn '/boot/%s' '/boot/%s'" %(self.oldname,newname)) if ret: self.session.open(MessageBox, _('Rename failed!'), MessageBox.TYPE_ERROR) else: bootname = self.readlineFile('/boot/bootname').split('=') if len(bootname) == 2 and bootname[1] == self.oldname: self.writeFile('/boot/bootname', '%s=%s' %(bootname[0],newname)) self.getCurrent() return elif self.bootname == self.oldname: self.getCurrent() return self.list[self.selection] = newname self["config"].setText(_("Select Image: %s") % (self.list[self.selection] + self.getNumberPartition())) else: if not os.path.exists('/boot/%s' % self.oldname): self.getCurrent() txt = _("File not found - rename failed!") else: txt = _("Name already exists - rename failed!") self.session.open(MessageBox, txt, MessageBox.TYPE_ERROR)
def save(self): if not self.MultiBootSelector: return error = True newboot = self.readlineFile('/boot/%s' % self.list[self.selection]) if newboot: temp = newboot.split(' ') device = temp[4].split("=")[1] os.system("mkdir /tmp/testimage") os.system("mount %s /tmp/testimage" % device) if os.path.isfile('/tmp/testimage/usr/bin/enigma2'): error = False self.saved() os.system("umount /tmp/testimage") if error: self.session.open(MessageBox, _("Error reading image from file '/boot/%s'!\nPlease flashing another image for this partition.") % self.list[self.selection], MessageBox.TYPE_ERROR)
def checkMount(self): if not os.path.exists("/sbin/blkid.util-linux"): self.installUtilblkid() self["config"].setText(_("Warning!Please install util-linux-blkid.")) return False if not os.path.ismount("/boot") or not os.path.isfile("/boot/STARTUP"): try: os.mkdir("/boot") except OSError: pass ret = os.system("mount -t vfat /dev/mmcblk0p1 /boot") if not os.path.ismount("/boot"): return False if os.path.ismount("/boot") and not os.path.isfile("/boot/STARTUP"): ret = os.system("mount -t vfat /dev/mmcblk0p1 /boot") if not os.path.isfile("/boot/STARTUP"): return False return True
def checkMount(self): if not os.path.exists("/sbin/blkid.util-linux"): self.installUtilblkid() self["config"].setText( _("Warning!Please install util-linux-blkid.")) return False if not os.path.ismount("/boot") or not os.path.isfile("/boot/STARTUP"): try: os.mkdir("/boot") except OSError: pass ret = os.system("mount -t vfat /dev/mmcblk0p1 /boot") if not os.path.ismount("/boot"): return False if os.path.ismount("/boot") and not os.path.isfile("/boot/STARTUP"): ret = os.system("mount -t vfat /dev/mmcblk0p1 /boot") if not os.path.isfile("/boot/STARTUP"): return False return True
def save(self): if not self.MultiBootSelector: return error = True newboot = self.readlineFile('/boot/%s' % self.list[self.selection]) if newboot: temp = newboot.split(' ') device = temp[4].split("=")[1] os.system("mkdir /tmp/testimage") os.system("mount %s /tmp/testimage" % device) if os.path.isfile('/tmp/testimage/usr/bin/enigma2'): error = False self.saved() os.system("umount /tmp/testimage") if error: self.session.open( MessageBox, _("Error reading image from file '/boot/%s'!\nPlease flashing another image for this partition." ) % self.list[self.selection], MessageBox.TYPE_ERROR)
def curBootmode(self): curbootmode = self.readlineFile(('/sys/module/%s/parameters/boxmode') % MODEL_NAME) if curbootmode: self["curbootmode"].setText(_("Current load boxmode: %s") % str(curbootmode))
def getCurrent(self): ''' #default Image 1: boot emmcflash0.kernel1 'root=/dev/mmcblk0p3 rw rootwait' Image 2: boot emmcflash0.kernel2 'root=/dev/mmcblk0p5 rw rootwait' Image 3: boot emmcflash0.kernel3 'root=/dev/mmcblk0p7 rw rootwait' Image 4: boot emmcflash0.kernel4 'root=/dev/mmcblk0p9 rw rootwait' #options Standard: hd51_4.boxmode=1 (or no option) Experimental: hd51_4.boxmode=12 #example boot emmcflash0.kernel1 'root=/dev/mmcblk0p3 rw rootwait hd51_4.boxmode=1' ''' self.optionsList = (('boxmode=1', _('2160p60 without PiP (default)')), ('boxmode=12', _('2160p50 with PiP'))) self.bootloaderList = ('v1.07-r19', 'v1.07-r21') #for compatibility to old or other images set 'self.enable_bootnamefile = False' #if 'False' and more as on file with same kernel exist is possible no exact matching found (only to display) self.enable_bootnamefile = False if not self.enable_bootnamefile and os.path.isfile('/boot/bootname'): os.system("rm -f /boot/bootname") self.list = self.list_files("/boot") self.option_enabled = self.readlineFile( '/sys/firmware/devicetree/base/bolt/tag').replace( '\x00', '') in self.bootloaderList boot = self.readlineFile('/boot/STARTUP') bootname = self.readlineFile('/boot/bootname').split('=') self.selection = None self.option = 0 #read name from bootname file if len(bootname) == 2: idx = 0 for x in self.list: if x == bootname[1]: self.selection = idx bootname = x break idx += 1 if self.selection is None: idx = 0 for x in self.list: if x == bootname[0]: self.selection = idx bootname = x break idx += 1 #verify bootname if bootname in self.list: line = self.readlineFile('/boot/%s' % bootname) if line[22:23] != boot[22:23]: self.selection = None else: self.selection = None #bootname searching ... if self.selection is None: idx = 0 for x in self.list: line = self.readlineFile('/boot/%s' % x) if line[22:23] == boot[22:23]: bootname = x self.selection = idx break idx += 1 #bootname not found if self.selection is None: bootname = _('unknown') self.selection = 0 self.bootname = bootname #read current boxmode try: bootmode = boot.split('rootwait', 1)[1].split( 'boxmode', 1)[1].split("'", 1)[0].split('=', 1)[1].replace(' ', '') except IndexError: bootmode = "" #find and verify current boxmode if self.option_enabled: idx = 0 for x in self.optionsList: if bootmode and bootmode == x[0].split('=')[1]: self.option = idx break elif x[0] + "'" in boot or x[0] + " " in boot: self.option = idx break idx += 1 if bootmode and bootmode != self.optionsList[self.option][0].split( '=')[1]: bootoption = ', boxmode=' + bootmode + _(" (unknown mode)") elif self.option_enabled: bootoption = ', ' + self.optionsList[self.option][0] else: bootoption = '' try: image = _('Image %s') % (int(boot[22:23])) except: image = _("Unable to read image number") self.startup() self.startup_option() self["description"].setText( _("Current bootsettings: %s (%s)%s") % (bootname, image, bootoption))
def saved(self): print "[MultiBoot switcher] select new startup: ", self.list[self.selection] ret = os.system("cp -f '/boot/%s' /boot/STARTUP" % self.list[self.selection]) if ret: self.session.open(MessageBox, _("File '/boot/%s' copy to '/boot/STARTUP' failed!") % self.list[self.selection], MessageBox.TYPE_ERROR) self.getCurrent() return writeoption = already = failboot = False newboot = boot = self.readlineFile('/boot/STARTUP') if self.checkBootEntry(boot): failboot = True elif self.option_enabled: for x in self.optionsList: if (x[0] + "'" in boot or x[0] + " " in boot) and x[0] != self.optionsList[self.option][0]: newboot = boot.replace(x[0],self.optionsList[self.option][0]) if self.optionsList[self.option][0] == "boxmode=1": newboot = newboot.replace("520M@248M", "440M@328M") newboot = newboot.replace("200M@768M", "192M@768M") elif self.optionsList[self.option][0] == "boxmode=12": newboot = newboot.replace("440M@328M", "520M@248M") newboot = newboot.replace("192M@768M", "200M@768M") writeoption = True break elif (x[0] + "'" in boot or x[0] + " " in boot) and x[0] == self.optionsList[self.option][0]: already = True break if not (writeoption or already): if "boxmode" in boot: failboot = True elif self.option: newboot = boot.replace("rootwait", "rootwait %s_4.%s" % (MODEL_NAME, self.optionsList[self.option][0])) if self.optionsList[self.option][0] == "boxmode=1": newboot = newboot.replace("520M@248M", "440M@328M") newboot = newboot.replace("200M@768M", "192M@768M") elif self.optionsList[self.option][0] == "boxmode=12": newboot = newboot.replace("440M@328M", "520M@248M") newboot = newboot.replace("192M@768M", "200M@768M") writeoption = True if self.enable_bootnamefile: if failboot: self.writeFile('/boot/bootname', 'STARTUP_1=STARTUP_1') else: self.writeFile('/boot/bootname', '%s=%s' %('STARTUP_%s' % MODEL_NAME, boot[22:23], self.list[self.selection])) message = _("Do you want to reboot now with selected image?") if failboot: print "[MultiBoot switcher] wrong bootsettings: " + boot if '/dev/mmcblk0p3' in getextdevices("ext4"): if self.writeFile('/boot/STARTUP', "boot emmcflash0.kernel1 'brcm_cma=440M@328M brcm_cma=192M@768M root=/dev/mmcblk0p3 rw rootwait'"): txt = _("Next boot will start from Image 1.") else: txt =_("Can not repair file %s") %("'/boot/STARTUP'") + "\n" + _("Caution, next boot is starts with these settings!") + "\n" else: txt = _("Alternative Image 1 partition for boot repair not found.") + "\n" + _("Caution, next boot is starts with these settings!") + "\n" message = _("Wrong Bootsettings detected!") + "\n\n%s\n\n%s\n" %(boot, txt) + _("Do you want to reboot now?") elif writeoption: if not self.writeFile('/boot/STARTUP', newboot): txt = _("Can not write file %s") %("'/boot/STARTUP'") + "\n" + _("Caution, next boot is starts with these settings!") + "\n" message = _("Write error!") + "\n\n%s\n\n%s\n" %(boot, txt) + _("Do you want to reboot now?") if failboot or writeoption: boot = self.readlineFile('/boot/STARTUP') if self.checkBootEntry(boot): txt = _("Error in file %s") %("'/boot/STARTUP'") + "\n" + _("Caution, next boot is starts with these settings!") + "\n" message = _("Command line error!") + "\n\n%s\n\n%s\n" %(boot, txt) + _("Do you want to reboot now?") self.session.openWithCallback(self.restartBOX, MessageBox, message, MessageBox.TYPE_YESNO, default=False)
def installUtilblkid(self): self.session.openWithCallback(self.installUtilblkidCallback, MessageBox, _("Install util-linux-blkid?"), MessageBox.TYPE_YESNO)
def getCurrent(self): ''' #default Image 1: boot emmcflash0.kernel1 'root=/dev/mmcblk0p3 rw rootwait' Image 2: boot emmcflash0.kernel2 'root=/dev/mmcblk0p5 rw rootwait' Image 3: boot emmcflash0.kernel3 'root=/dev/mmcblk0p7 rw rootwait' Image 4: boot emmcflash0.kernel4 'root=/dev/mmcblk0p9 rw rootwait' #options Standard: hd51_4.boxmode=1 (or no option) Experimental: hd51_4.boxmode=12 #example boot emmcflash0.kernel1 'root=/dev/mmcblk0p3 rw rootwait hd51_4.boxmode=1' ''' self.optionsList = (('boxmode=1', _('2160p60 without PiP (default)')), ('boxmode=12', _('2160p50 with PiP'))) self.bootloaderList = ('v1.07-r19', 'v1.07-r21', 'v1.07-r35') #for compatibility to old or other images set 'self.enable_bootnamefile = False' #if 'False' and more as on file with same kernel exist is possible no exact matching found (only to display) self.enable_bootnamefile = False if not self.enable_bootnamefile and os.path.isfile('/boot/bootname'): os.system("rm -f /boot/bootname") self.list = self.list_files("/boot") self.option_enabled = self.readlineFile('/sys/firmware/devicetree/base/bolt/tag').replace('\x00', '') in self.bootloaderList boot = self.readlineFile('/boot/STARTUP') bootname = self.readlineFile('/boot/bootname').split('=') self.selection = None self.option = 0 #read name from bootname file if len(bootname) == 2: idx = 0 for x in self.list: if x == bootname[1]: self.selection = idx bootname = x break idx += 1 if self.selection is None: idx = 0 for x in self.list: if x == bootname[0]: self.selection = idx bootname = x break idx += 1 #verify bootname if bootname in self.list: line = self.readlineFile('/boot/%s' %bootname) if line[22:23] != boot[22:23]: self.selection = None else: self.selection = None #bootname searching ... if self.selection is None: idx = 0 for x in self.list: line = self.readlineFile('/boot/%s' %x) if line[22:23] == boot[22:23]: bootname = x self.selection = idx break idx += 1 #bootname not found if self.selection is None: bootname = _('unknown') self.selection = 0 self.bootname = bootname #read current boxmode try: bootmode = boot.split('rootwait',1)[1].split('boxmode',1)[1].split("'",1)[0].split('=',1)[1].replace(' ','') except IndexError: bootmode = "" #find and verify current boxmode if self.option_enabled: idx = 0 for x in self.optionsList: if bootmode and bootmode == x[0].split('=')[1]: self.option = idx break elif x[0] + "'" in boot or x[0] + " " in boot: self.option = idx break idx += 1 if bootmode and bootmode != self.optionsList[self.option][0].split('=')[1]: bootoption = ', boxmode=' + bootmode + _(" (unknown mode)") elif self.option_enabled: bootoption = ', ' + self.optionsList[self.option][0] else: bootoption = '' try: image = _('Image %s') % (int(boot[22:23])) except: image = _("Unable to read image number") self.startup() self.startup_option() self["description"].setText(_("Current bootsettings: %s (%s)%s") %(bootname, image, bootoption))
def curBootmode(self): curbootmode = self.readlineFile( ('/sys/module/%s/parameters/boxmode') % MODEL_NAME) if curbootmode: self["curbootmode"].setText( _("Current load boxmode: %s") % str(curbootmode))
def saved(self): print "[MultiBoot switcher] select new startup: ", self.list[ self.selection] ret = os.system("cp -f '/boot/%s' /boot/STARTUP" % self.list[self.selection]) if ret: self.session.open( MessageBox, _("File '/boot/%s' copy to '/boot/STARTUP' failed!") % self.list[self.selection], MessageBox.TYPE_ERROR) self.getCurrent() return writeoption = already = failboot = False newboot = boot = self.readlineFile('/boot/STARTUP') if self.checkBootEntry(boot): failboot = True elif self.option_enabled: for x in self.optionsList: if (x[0] + "'" in boot or x[0] + " " in boot) and x[0] != self.optionsList[self.option][0]: newboot = boot.replace(x[0], self.optionsList[self.option][0]) if self.optionsList[self.option][0] == "boxmode=1": newboot = newboot.replace("520M@248M", "440M@328M") newboot = newboot.replace("200M@768M", "192M@768M") elif self.optionsList[self.option][0] == "boxmode=12": newboot = newboot.replace("440M@328M", "520M@248M") newboot = newboot.replace("192M@768M", "200M@768M") writeoption = True break elif (x[0] + "'" in boot or x[0] + " " in boot) and x[0] == self.optionsList[self.option][0]: already = True break if not (writeoption or already): if "boxmode" in boot: failboot = True elif self.option: newboot = boot.replace( "rootwait", "rootwait %s_4.%s" % (MODEL_NAME, self.optionsList[self.option][0])) if self.optionsList[self.option][0] == "boxmode=1": newboot = newboot.replace("520M@248M", "440M@328M") newboot = newboot.replace("200M@768M", "192M@768M") elif self.optionsList[self.option][0] == "boxmode=12": newboot = newboot.replace("440M@328M", "520M@248M") newboot = newboot.replace("192M@768M", "200M@768M") writeoption = True if self.enable_bootnamefile: if failboot: self.writeFile('/boot/bootname', 'STARTUP_1=STARTUP_1') else: self.writeFile( '/boot/bootname', '%s=%s' % ('STARTUP_%s' % MODEL_NAME, boot[22:23], self.list[self.selection])) message = _("Do you want to reboot now with selected image?") if failboot: print "[MultiBoot switcher] wrong bootsettings: " + boot if '/dev/mmcblk0p3' in getextdevices("ext4"): if self.writeFile( '/boot/STARTUP', "boot emmcflash0.kernel1 'brcm_cma=440M@328M brcm_cma=192M@768M root=/dev/mmcblk0p3 rw rootwait'" ): txt = _("Next boot will start from Image 1.") else: txt = _("Can not repair file %s") % ( "'/boot/STARTUP'") + "\n" + _( "Caution, next boot is starts with these settings!" ) + "\n" else: txt = _( "Alternative Image 1 partition for boot repair not found." ) + "\n" + _( "Caution, next boot is starts with these settings!") + "\n" message = _("Wrong Bootsettings detected!") + "\n\n%s\n\n%s\n" % ( boot, txt) + _("Do you want to reboot now?") elif writeoption: if not self.writeFile('/boot/STARTUP', newboot): txt = _("Can not write file %s") % ( "'/boot/STARTUP'") + "\n" + _( "Caution, next boot is starts with these settings!" ) + "\n" message = _("Write error!") + "\n\n%s\n\n%s\n" % ( boot, txt) + _("Do you want to reboot now?") if failboot or writeoption: boot = self.readlineFile('/boot/STARTUP') if self.checkBootEntry(boot): txt = _("Error in file %s") % ("'/boot/STARTUP'") + "\n" + _( "Caution, next boot is starts with these settings!") + "\n" message = _("Command line error!") + "\n\n%s\n\n%s\n" % ( boot, txt) + _("Do you want to reboot now?") self.session.openWithCallback(self.restartBOX, MessageBox, message, MessageBox.TYPE_YESNO, default=False)