@@ -39,6 +39,8 @@ def read_settings(infile):
3939 config = read_settings (conffile )
4040 print (config )
4141
42+ newconfig = config .copy ()
43+
4244def download (url , file_name = None ):
4345 # get request
4446 response = requests .get (url )
@@ -215,41 +217,31 @@ def getInitrdInfo():
215217 else : print (f"kernel not set!" )
216218else : print (f"{ board } not found in ubootfiles" )
217219
218- newconfig = {}
219- newconfig ["variant" ]= config .get ("variant" ,"" )
220-
221- if config and config .get ("skipubootdownload" ):
222- newconfig ["skipubootdownload" ]= config .get ("skipubootdownload" )
223- newconfig ["imgfile" ]= config .get ("imgfile" ,"" )
224- newconfig ["bl2file" ]= config .get ("bl2file" ,"" )
225- newconfig ["fipfile" ]= config .get ("fipfile" ,"" )
226- elif ufile and "mmc" in device :
227- fname = ufile .get ("name" )
228- a = urlparse (ufile .get ("url" ))
229- #fname=os.path.basename(a.path)
230- print (f"ubootfile: { ufile } filename: { fname } " )
231- if os .path .isfile (fname ):
232- print (fname ,"already exists" )
233- c = input ('overwrite it [yn]? ' ).lower ()
234- else : c = 'y'
235- if c == 'y' :
236- download (ufile .get ("url" ),fname )
237- newconfig ["imgfile" ]= fname
238- elif ufile and device in ['spim-nand' ,'nor' ]:
239- bl2 = ufile .get ("bl2" )
240- fip = ufile .get ("fip" )
241- if bl2 :
242- download (bl2 .get ("url" ),bl2 .get ("name" ))
243- newconfig ["bl2file" ]= bl2 .get ("name" )
244- if fip :
245- download (fip .get ("url" ),fip .get ("name" ))
246- newconfig ["fipfile" ]= fip .get ("name" )
220+ if not config .get ("skipubootdownload" ) and ufile :
221+ if "mmc" in device :
222+ fname = ufile .get ("name" )
223+ a = urlparse (ufile .get ("url" ))
224+ #fname=os.path.basename(a.path)
225+ print (f"ubootfile: { ufile } filename: { fname } " )
226+ if os .path .isfile (fname ):
227+ print (fname ,"already exists" )
228+ c = input ('overwrite it [yn]? ' ).lower ()
229+ else : c = 'y'
230+ if c == 'y' :
231+ download (ufile .get ("url" ),fname )
232+ newconfig ["imgfile" ]= fname
233+ elif device in ['spim-nand' ,'nor' ]:
234+ bl2 = ufile .get ("bl2" )
235+ fip = ufile .get ("fip" )
236+ if bl2 :
237+ download (bl2 .get ("url" ),bl2 .get ("name" ))
238+ newconfig ["bl2file" ]= bl2 .get ("name" )
239+ if fip :
240+ download (fip .get ("url" ),fip .get ("name" ))
241+ newconfig ["fipfile" ]= fip .get ("name" )
247242else : print ("no uboot image defined!" )
248243
249- if config and config .get ("skipkerneldownload" ):
250- newconfig ["skipkerneldownload" ]= config .get ("skipkerneldownload" )
251- newconfig ["kernelfile" ]= config .get ("kernelfile" )
252- elif kfile :
244+ if not config .get ("skipkerneldownload" ) and kfile :
253245 a = urlparse (kfile )
254246 fname = os .path .basename (a .path )
255247 print (f"kernelfile: { kfile } filename: { fname } " )
@@ -259,9 +251,6 @@ def getInitrdInfo():
259251 newconfig ["kernelfile" ]= fname
260252else : print ("no kernel defined!" )
261253
262- if config and config .get ("userpackages" ):
263- newconfig ["userpackages" ]= config .get ("userpackages" )
264-
265254for replacement in ["hostapd" ,"wpa_supplicant" ,"iperf" ,"iproute2" ]:
266255 if config and config .get ("replace" + replacement ):
267256 newconfig ["replace" + replacement ]= config .get ("replace" + replacement )
@@ -275,11 +264,8 @@ def getInitrdInfo():
275264 newconfig [replacement + "file" ]= fname
276265 else : print ("no bfiles defined!" )
277266
278- if config and config .get ("skipinitrddownload" ):
279- newconfig ["skipinitrddownload" ]= config .get ("skipinitrddownload" )
280- newconfig ["initrd" ]= config .get ("initrd" ,"" )
281- elif device in ["spim-nand" ,"nor" ]:
282- if ifiles :
267+ if not config .get ("skipinitrddownload" ) and ifiles :
268+ if device in ["spim-nand" ,"nor" ]:
283269 fname = "rootfs_arm64.cpio.zst"
284270 if fname in ifiles :
285271 print (f"initrd-file: { fname } " )
0 commit comments