Moving the scripts to a common directory not only vastly simplifies the zzz-gluon-upgrade script, but also allows to define an ordering of such scripts across packages.
		
			
				
	
	
		
			38 lines
		
	
	
		
			640 B
		
	
	
	
		
			Lua
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			640 B
		
	
	
	
		
			Lua
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/lua
 | |
| 
 | |
| local site = require 'gluon.site_config'
 | |
| local sysconfig = require 'gluon.sysconfig'
 | |
| 
 | |
| local uci = require('luci.model.uci').cursor()
 | |
| 
 | |
| 
 | |
| if sysconfig.gluon_version == 'legacy' then
 | |
|   local secret
 | |
|   local enabled
 | |
| 
 | |
| 
 | |
|   for _, config in ipairs(site.legacy.fastd_configs) do
 | |
|     if not secret then
 | |
|       local s = uci:get_all('fastd', config)
 | |
|       if s then
 | |
| 	secret = s.secret
 | |
| 	enabled = s.enabled
 | |
|       end
 | |
|     end
 | |
| 
 | |
|     uci:delete('fastd', config)
 | |
|   end
 | |
| 
 | |
|   if secret then
 | |
|     uci:section('fastd', 'fastd', 'mesh_vpn',
 | |
| 		{
 | |
| 		  secret = secret,
 | |
| 		  enabled = enabled,
 | |
| 		}
 | |
|     )
 | |
|   end
 | |
| 
 | |
|   uci:save('fastd')
 | |
|   uci:commit('fastd')
 | |
| end
 |