gluon-legacy: don't use generated scripts anymore
This commit is contained in:
parent
9367c1ffe7
commit
bf7a2c974e
@ -2,7 +2,6 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gluon-legacy
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
@ -30,7 +29,7 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/gluon-legacy/install
|
||||
$(GLUON_GENERATE) ./generate/* $(1)/
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gluon-legacy))
|
||||
|
13
package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade
Executable file
13
package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
|
||||
local ret = 1
|
||||
|
||||
for _, file in pairs(site.legacy.version_files) do
|
||||
if os.remove(file) then
|
||||
ret = 0
|
||||
end
|
||||
end
|
||||
|
||||
os.exit(ret)
|
8
package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late
Executable file
8
package/gluon-legacy/files/lib/gluon/legacy/legacy-upgrade-late
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
|
||||
|
||||
for _, file in pairs(site.legacy.old_files) do
|
||||
os.remove(file)
|
||||
end
|
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
|
||||
for _, config in ipairs(site.legacy.config_mode_configs) do
|
||||
local old = c:get_first(config, 'wizard', 'configured')
|
||||
if old == '1' then
|
||||
local wizard = c:get_first('gluon-config-mode', 'wizard')
|
||||
c:set('gluon-config-mode', wizard, 'configured', '1')
|
||||
|
||||
c:save('gluon-config-mode')
|
||||
c:commit('gluon-config-mode')
|
||||
|
||||
break
|
||||
end
|
||||
end
|
@ -24,7 +24,9 @@ remove_bat0() {
|
||||
sed -r -e 's/(^| )bat0( |$)/ /g' -e 's/^ | $//g'
|
||||
}
|
||||
|
||||
mesh_ifname="$(uci get 'network.@legacy.mesh_ifname@.ifname' | remove_bat0)"
|
||||
|
||||
mesh_section="$(lua -e 'print(require("gluon.site_config").legacy.mesh_ifname)')"
|
||||
mesh_ifname="$(uci get "network.${mesh_section}.ifname" | remove_bat0)"
|
||||
wan_ifname="$(uci get network.wan.ifname)"
|
||||
|
||||
if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then
|
24
package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/020-wireless
Executable file
24
package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/020-wireless
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
|
||||
function delete_legacy_iface(iface)
|
||||
for _, wifi in pairs(site.legacy.wifi_names) do
|
||||
if wifi == iface['.name'] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
c:delete_all('wireless', 'wifi-iface', delete_legacy_iface)
|
||||
|
||||
c:save('wireless')
|
||||
c:commit('wireless')
|
22
package/gluon-legacy/files/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh
Executable file
22
package/gluon-legacy/files/lib/gluon/upgrade/mesh-batman-adv/legacy/010-mesh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
|
||||
local s = c:get_all('network', site.legacy.mesh_ifname)
|
||||
c:delete('network', site.legacy.mesh_ifname)
|
||||
|
||||
s.auto = nil
|
||||
s.accept_ra = nil
|
||||
s.defaultroute = nil
|
||||
s.proto = 'dhcpv6'
|
||||
s.reqprefix = 'no'
|
||||
|
||||
c:section('network', 'interface', 'client', s)
|
||||
|
||||
c:save('network')
|
||||
c:commit('network')
|
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
|
||||
local secret
|
||||
local enabled
|
||||
|
||||
|
||||
for _, config in ipairs(site.legacy.fastd_configs) do
|
||||
if not secret then
|
||||
local s = c:get_all('fastd', config)
|
||||
if s then
|
||||
secret = s.secret
|
||||
enabled = s.enabled
|
||||
end
|
||||
end
|
||||
|
||||
c:delete('fastd', config)
|
||||
end
|
||||
|
||||
if secret then
|
||||
c:section('fastd', 'fastd', 'mesh_vpn',
|
||||
{
|
||||
secret = secret,
|
||||
enabled = enabled,
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
c:save('fastd')
|
||||
c:commit('fastd')
|
27
package/gluon-legacy/files/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc
Executable file
27
package/gluon-legacy/files/lib/gluon/upgrade/simple-tc/legacy/010-migrate-tc
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require 'luci.model.uci'
|
||||
|
||||
local c = uci.cursor()
|
||||
|
||||
|
||||
for _, config in ipairs(site.legacy.tc_configs) do
|
||||
local s = c:get_first(config, 'bandwidth')
|
||||
if s then
|
||||
old = c:get_all(config, s)
|
||||
c:section('gluon-simple-tc', 'interface', 'mesh_vpn',
|
||||
{
|
||||
ifname = 'mesh-vpn',
|
||||
enabled = old.enabled,
|
||||
limit_ingress = old.downstream,
|
||||
limit_egress = old.upstream,
|
||||
}
|
||||
)
|
||||
|
||||
c:save('gluon-simple-tc')
|
||||
c:commit('gluon-simple-tc')
|
||||
|
||||
break
|
||||
end
|
||||
end
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
RET=1
|
||||
|
||||
for file in @legacy.version_files@; do
|
||||
if [ -e "$file" ]; then
|
||||
rm "$file"
|
||||
RET=0
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RET
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f @legacy.old_files@
|
@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
|
||||
for config in @legacy.config_mode_configs@; do
|
||||
if [ "$(uci -q get "$config".configured)" = '1' ]; then
|
||||
uci_set gluon-config-mode '@wizard[0]' 'configured' '1'
|
||||
uci_commit gluon-config-mode
|
||||
|
||||
break
|
||||
fi
|
||||
done
|
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
config_load wireless
|
||||
|
||||
delete_legacy_iface() {
|
||||
local iface="$1"
|
||||
|
||||
for wifi in @legacy.wifi_names@; do
|
||||
if [ "$wifi" = "$iface" ]; then
|
||||
uci_remove wireless "$iface"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
config_foreach delete_legacy_iface 'wifi-iface'
|
||||
uci_commit wireless
|
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/gluon/functions/sysconfig.sh
|
||||
|
||||
|
||||
uci_rename network '@legacy.mesh_ifname@' 'client'
|
||||
|
||||
uci_remove network client auto
|
||||
uci_remove network client accept_ra
|
||||
uci_remove network client defaultroute
|
||||
|
||||
uci_set network client proto 'dhcpv6'
|
||||
uci_set network client reqprefix 'no'
|
||||
|
||||
uci_commit network
|
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
|
||||
SECRET=
|
||||
ENABLED=
|
||||
|
||||
|
||||
for config in @legacy.fastd_configs@; do
|
||||
if [ -z "$SECRET" ]; then
|
||||
SECRET="$(uci_get fastd "$config" secret)"
|
||||
ENABLED="$(uci_get fastd "$config" enabled)"
|
||||
fi
|
||||
|
||||
uci_remove fastd "$config"
|
||||
done
|
||||
|
||||
if [ -n "$SECRET" ]; then
|
||||
uci_add fastd fastd 'mesh_vpn'
|
||||
uci_set fastd 'mesh_vpn' 'secret' "$SECRET"
|
||||
|
||||
if [ "$ENABLED" = 1 ]; then
|
||||
uci_set fastd 'mesh_vpn' 'enabled' '1'
|
||||
fi
|
||||
fi
|
||||
|
||||
uci_commit fastd
|
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
|
||||
for config in @legacy.tc_configs@; do
|
||||
if uci -q get "$config" >/dev/null; then
|
||||
uci_add gluon-simple-tc interface 'mesh_vpn'
|
||||
uci_set gluon-simple-tc 'mesh_vpn' ifname 'mesh-vpn'
|
||||
|
||||
uci_set gluon-simple-tc 'mesh_vpn' enabled "$(uci get "$config".enabled)"
|
||||
uci_set gluon-simple-tc 'mesh_vpn' limit_ingress "$(uci get "$config".downstream)"
|
||||
uci_set gluon-simple-tc 'mesh_vpn' limit_egress "$(uci get "$config".upstream)"
|
||||
|
||||
uci_commit gluon-simple-tc
|
||||
|
||||
break
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user