gluon-core: migrate wireless configuration from hwmode to band
The migration is done very early, as other upgrade scripts depend on the band setting through platform.device_uses_11a().
This commit is contained in:
		
							parent
							
								
									c52089fcda
								
							
						
					
					
						commit
						17e1aa4ffd
					
				
							
								
								
									
										20
									
								
								package/gluon-core/luasrc/lib/gluon/upgrade/005-wireless-migration
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								package/gluon-core/luasrc/lib/gluon/upgrade/005-wireless-migration
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,20 @@ | ||||
| #!/usr/bin/lua | ||||
| 
 | ||||
| local uci = require('simple-uci').cursor() | ||||
| 
 | ||||
| -- Migration from hwmode to band (OpenWrt 21.02) | ||||
| -- Use uci:foreach(), as wireless.foreach_radio() depends on band already being set | ||||
| uci:foreach('wireless', 'wifi-device', function(radio) | ||||
| 	local radio_name = radio['.name'] | ||||
| 	local hwmode = radio.hwmode | ||||
| 	if not radio.band then | ||||
| 		if hwmode == '11g' or hwmode == '11ng' then | ||||
| 			uci:set('wireless', radio_name, 'band', '2g') | ||||
| 		elseif hwmode == '11a' or hwmode == '11na' then | ||||
| 			uci:set('wireless', radio_name, 'band', '5g') | ||||
| 		end | ||||
| 	end | ||||
| 	uci:delete('wireless', radio_name, 'hwmode') | ||||
| end) | ||||
| 
 | ||||
| uci:save('wireless') | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user