...
 
Commits (15)
......@@ -19,4 +19,4 @@ rsync -av gluon/output/images/l2tp/"$GLUON_RELEASE"/factory/* runner@firmware.ff
rsync -av gluon/output/images/l2tp/"$GLUON_RELEASE"/sysupgrade/* runner@firmware.ffnw.de:/var/www/dev/firmware/l2tp/nightly/"$CI_BUILD_REF_NAME"
ssh runner@firmware.ffnw.de -C "ln -sr /var/www/dev/firmware/l2tp/nightly/$CI_BUILD_REF_NAME/$GLUON_BRANCH.manifest /var/www/dev/firmware/l2tp/nightly/$CI_BUILD_REF_NAME/manifest"
rm -rf gluon/output
#rm -rf gluon/output
......@@ -9,10 +9,9 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(TOPDIR)/../package/gluon.mk
define Package/ffnw-banner
SECTION:= networke
SECTION:= network
CATEGORY:=Freifunk Nordwest
TITLE:=Nordwest freifunk shell banner
DEPENDS:= gluon-hoodselector
endef
define Package/ffnw-banner/description
......
......@@ -8,17 +8,14 @@
|__|____||_____|__| |_____||________|_____|_____||____|
##############################################################################
_________
/ /\ _ ___ ___ ___
/ LE / \ | | | __| \| __|
/ DE / \ | |__| _|| |) | _|
/________/ LE \ |____|___|___/|___| lede-project.org
\ \ DE /
\ LE \ /
\ DE \ /
\________\/
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
------------------------------------------------------------------------------
%A
%B
%C
%D
------------------------------------------------------------------------------
#!/usr/bin/lua
local unistd = require 'posix.unistd'
local has_fastd = unistd.access('/lib/gluon/mesh-vpn/fastd')
local has_tunneldigger = unistd.access('/lib/gluon/mesh-vpn/tunneldigger')
local srcFile = "/lib/ffnw/banner/banner"
local desFile = "/tmp/ffnw-banner"
local uci = require('simple-uci').cursor()
local json = require ("luci.jsonc")
local json = require 'jsonc'
os.execute('cp '..srcFile..' '..desFile)
-- Read the full hoodfile. Return nil for wrong format or no such file
local function readHoodfile(file)
local jhood = io.open(file, 'r')
if not jhood then return nil end
local obj, _, err = json.parse (jhood:read('*a'), 1, nil)
-- Read the full domainfile. Return nil for wrong format or no such file
local function readdomainfile(file)
local jdomain = io.open(file, 'r')
if not jdomain then return nil end
local obj, _, err = json.parse (jdomain:read('*a'), 1, nil)
if err then
return nil
else
......@@ -20,35 +21,23 @@ local function readHoodfile(file)
end
end
local function gethoodByBssid(jhood, scan_bssid)
for _, h in pairs(jhood) do
if scan_bssid:lower():match(h.bssid:lower()) then
return h
end
end
return nil
end
local openwrtRelease = io.open("/etc/openwrt_release", "r")
local gluonVersion = io.open("/lib/gluon/gluon-version", "r")
local gluonRelease = io.open("/lib/gluon/release", "r")
local infoHeader = {}
infoHeader["ledeRelease"] = ""
infoHeader["openwrtRelease"] = ""
infoHeader["revision"] = ""
infoHeader["gluonVersion"] = ""
infoHeader["gluonRelease"] = ""
infoHeader["hoodname"] = ""
infoHeader["domain"] = ""
infoHeader["HWmodel"] = require("platform_info").get_model()
infoHeader["vpn"] = ""
local hoodbssid = uci:get('hoodselector', 'hoodselector', 'hood')
local hoodfile = uci:get('hoodselector', 'hoodselector', 'hoodfile')
if hoodbssid ~= nil and hoodfile ~= nil then
local jhood = readHoodfile(hoodfile)
if jhood ~= nil then
local hood = gethoodByBssid(jhood, hoodbssid)
if hood ~= nil then
infoHeader["hoodname"] = hood.name
end
local domaincode = uci:get('gluon', 'core', 'domain')
if domaincode ~= nil then
local domain = readdomainfile("/lib/gluon/domains/" .. domaincode .. ".json")
if domain ~= nil then
infoHeader["domain"] = domain["domain_names"][domaincode]
end
end
......@@ -58,17 +47,17 @@ if openwrtRelease~=nil then
if line:match("DISTRIB_DESCRIPTION") then
for v in string.gmatch(line, "([^=]+)") do
if not v:match("DISTRIB_DESCRIPTION") then
infoHeader["ledeRelease"] = string.gsub(v,"'","")
infoHeader["openwrtRelease"] = string.gsub(v,"'","")
end
end
end
-- Get openwrt revision
if line:match("DISTRIB_REVISION") then
for v in string.gmatch(line, "([^=]+)") do
if not v:match("DISTRIB_REVISION") then
infoHeader["revision"] = string.gsub(v,"'","")
end
end
for v in string.gmatch(line, "([^=]+)") do
if not v:match("DISTRIB_REVISION") then
infoHeader["revision"] = string.gsub(v,"'","")
end
end
end
end
end
......@@ -89,9 +78,18 @@ if gluonRelease~=nil then
end
end
local firstLine ="LEDE Version: " .. infoHeader["ledeRelease"].. " (" .. infoHeader["revision"] .. ")"
if has_tunneldigger then
infoHeader["vpn"] = "l2tp"
elseif has_fastd then
infoHeader["vpn"] = "fastd"
else infoHeader["vpn"] = "unknown"
end
local firstLine =infoHeader["openwrtRelease"]
local secondLine ="Gluon Version: " .. infoHeader["gluonVersion"] .. " Gluon Release: " .. infoHeader["gluonRelease"]
local thirdLine = "Selected Hood: " .. infoHeader["hoodname"]
local thirdLine = "Hardware model: " .. infoHeader["HWmodel"] .. " vpn: " .. infoHeader["vpn"]
local forthLine = "Domain: " .. infoHeader["domain"]
os.execute('sed -i \'/%A/c\\' .. firstLine .. '\' ' .. desFile)
os.execute('sed -i \'/%B/c\\' .. secondLine .. '\' ' .. desFile)
os.execute('sed -i \'/%C/c\\' .. thirdLine .. '\' ' .. desFile)
os.execute('sed -i \'/%D/c\\' .. forthLine .. '\' ' .. desFile)