Skip to content

Instantly share code, notes, and snippets.

@b13bs
Last active August 29, 2015 13:57
Show Gist options
  • Save b13bs/9675945 to your computer and use it in GitHub Desktop.
Save b13bs/9675945 to your computer and use it in GitHub Desktop.
LuCI modifications
-- Dans le fichier /usr/lib/lua/luci/view/themes/commotion/header.htm, à la ligne 101
-- ==========
---- Le code suivant donne l'erreur: "Status: 500 Internal Server Error [...] 65: attempt to index local 'iface' (a nil value)"
function(s)
if s and s.mode and s.mode == "adhoc" and s.network then
local iface = conn:call("network.interface."..s.network, "status", {})
if s.proto == "babel" then
mesh_ip = sys.exec("ip addr show dev '"..iface["l3_device"].."' | sed -e's/^.*inet6 \\([^ ]*\\)\\/.*$/\\1/;t;d'")
else -- We keep the old behaviour before babel integration
if iface ~= nil and iface["ipv4-address"] then
if iface["ipv4-address"][1] and iface["ipv4-address"][1].address then
mesh_ip = iface["ipv4-address"][1].address
else
mesh_ip = "Unknown"
end
elseif mesh_ip == "None" then
mesh_ip = "Unknown"
end
end
end
end
-- ==========
---- Le code suivant casse le CSS et donne l'erreur: "error on line 267 at column 8: Opening and ending tag mismatch: div line 0 and form" puis plus tard l'erreur suivante arrive:
----- /usr/lib/lua/luci/dispatcher.lua:448: Failed to execute cbi dispatcher target for entry '/commotion/setup_wizard'.
----- The called action terminated with an exception:
----- /usr/lib/lua/luci/cbi.lua:600: Invalid state
----- stack traceback:
----- [C]: in function 'assert'
----- /usr/lib/lua/luci/dispatcher.lua:448: in function 'dispatch'
----- /usr/lib/lua/luci/dispatcher.lua:195: in function </usr/lib/lua/luci/dispatcher.lua:194>
function(s)
if s and s.mode and s.mode == "adhoc" and s.network then
local iface = conn:call("network.interface."..s.network, "status", {})
if iface ~= nil then
if s.proto == "babel" then
if iface["l3_device"] ~= nil then
mesh_ip = sys.exec("ip addr show dev '"..iface["l3_device"].."' | sed -e's/^.*inet6 \\([^ ]*\\)\\/.*$/\\1/;t;d'"
else
mesh_ip = "Unknown"
end
else -- We keep the old behaviour before babel integration
if iface ~= nil and iface["ipv4-address"] then
if iface["ipv4-address"][1] and iface["ipv4-address"][1].address then
mesh_ip = iface["ipv4-address"][1].address
else
mesh_ip = "Unknown"
end
elseif mesh_ip == "None" then
mesh_ip = "Unknown"
end
end
end
end
end
-- ==========
---- Et ce code la fait fonctionner le setup-wizard
function(s)
if s and s.mode and s.mode == "adhoc" and s.network then
local iface = conn:call("network.interface."..s.network, "status", {})
if iface ~= nil and iface["ipv4-address"] then
if iface["ipv4-address"][1] and iface["ipv4-address"][1].address then
mesh_ip = iface["ipv4-address"][1].address
elseif iface["ipv6-address"][1] and iface["ipv6-address"][1].address then
mesh_ip = iface["ipv6-address"][1].address
else
mesh_ip = "Unknown"
end
elseif mesh_ip == "None" then
mesh_ip = "Unknown"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment