Jump to content


longtimeuser

Member Since 6 Feb 2022
Offline Last Active 08 Jun 2024 16:03
-----

#1612969 Vu+ 4K Multiboot

Posted by longtimeuser on 22 March 2024 - 20:14

@WanWizard

 

here is the diff to the current develop branch:

12a13,14
> bootargs = ""
> 
27a30,31
> 				bootargs = open(os.path.join(tmp.dir, "STARTUP"), 'r').read().split("'")[1]
> 				print('[Multiboot] bootargs:', bootargs)
75a80,88
> def getBootargs():
> 	if os.path.isfile('/sys/firmware/devicetree/base/chosen/bootargs'):
> 		return open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read()
> 	else:
> 		if bootargs == "":
> 			getMultibootStartupDevice()
> 		return bootargs
> 
> 
79c92
< 			rootsubdir = [x for x in open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read().split() if x.startswith("rootsubdir")]
---
> 			rootsubdir = [x for x in getBootargs().split() if x.startswith("rootsubdir")]
83c96
< 			slot = [x[-1] for x in open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read().split() if x.startswith('rootsubdir')]
---
> 			slot = [x[-1] for x in getBootargs().split() if x.startswith('rootsubdir')]
87c100
< 				device = getparam(open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read(), 'root')
---
> 				device = getparam(getBootargs(), 'root')
94c107
< 	return bool(BoxInfo.getItem("canMultiBoot")) and BoxInfo.getItem("canMode12") and int(open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read().replace('\0', '').split('=')[-1])
---
> 	return bool(BoxInfo.getItem("canMultiBoot")) and BoxInfo.getItem("canMode12") and int(getBootargs().replace('\0', '').split('=')[-1])
150c163,184
< 				imagelist[slot] = {'imagename': "%s (%s)" % (open(os.path.join(imagedir, "etc/issue")).readlines()[-2].capitalize().strip()[:-6], date)}
---
> 				imagename = open(os.path.join(imagedir, "etc/issue")).readlines()[-2].capitalize().strip()[:-6]
> 				if imagename == "" and os.path.isfile(os.path.join(imagedir, 'etc/image-version')):
> 					imageversion = {}
> 					with open(os.path.join(imagedir, 'etc/image-version')) as ivfile:
> 						for line in ivfile:
> 							key, val = line.partition("=")[::2]
> 							imageversion[key.strip()] = val.replace("\n", "")
> 					imagename = imageversion["creator"].split(" ")[0]+" "+str(int(imageversion["version"][0:3]))+"."+str(int(imageversion["version"][3:6]))
> 				imagelist[slot] = {'imagename': "%s (%s)" % (imagename, date)}
> 			elif os.path.isfile(os.path.join(imagedir, 'usr/bin/neutrino')):
> 				try:
> 					from datetime import datetime
> 					date = datetime.fromtimestamp(os.stat(os.path.join(imagedir, "usr/bin/neutrino")).st_mtime).strftime('%Y-%m-%d')
> 				except:
> 					date = _("Unknown")
> 				imageversion = {}
> 				with open(os.path.join(imagedir, 'usr/lib/enigma.info')) as ivfile:
> 					for line in ivfile:
> 						key, val = line.partition("=")[::2]
> 						imageversion[key.strip()] = val.replace("\n", "")
> 				imagename = imageversion["displaydistro"].replace("-Neutrino", "") + " " + imageversion["imgversion"]
> 				imagelist[slot] = {'imagename': "%s (%s)" % (imagename, date)}