Table of Contents

Building the MESHdesk firmware on LEDE to include LuCI

Introduction


Adding LuCI to the MESHdesk build

Install the LuCI package.

cd ~/lede/source
./scripts/feeds update
./scripts/feeds install luci

Include the MESHdesk application

#Create the following directories
mkdir ~/lede/source/feeds/luci/applications/luci-app-meshdesk/
mkdir ~/lede/source/feeds/luci/applications/luci-app-meshdesk/luasrc/
mkdir ~/lede/source/feeds/luci/applications/luci-app-meshdesk/luasrc/controller
mkdir ~/lede/source/feeds/luci/applications/luci-app-meshdesk/luasrc/model
mkdir ~/lede/source/feeds/luci/applications/luci-app-meshdesk/luasrc/model/cbi
Makefile
#
# Copyright (C) 2008-2015 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
 
include $(TOPDIR)/rules.mk
 
PKG_NAME:=luci-app-meshdesk
 
# Version == major.minor.patch
# increase "minor" on new functionality and "patch" on patches/optimization
PKG_VERSION:=5.0.0
 
# Release == build
# increase on changes of translation files
PKG_RELEASE:=5
 
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Dirk van der Walt   <dirk@mymail.com>
 
# LuCI specific settings
LUCI_TITLE:=LuCI Support for MESHdesk firmware
LUCI_DEPENDS:=+luci-mod-admin-full
LUCI_PKGARCH:=all
 
define Package/$(PKG_NAME)/config
# shown in make menuconfig <Help>
help
        $(LUCI_TITLE)
        .
        Version: $(PKG_VERSION)-$(PKG_RELEASE)
        $(PKG_MAINTAINER)
endef
 
include ../../luci.mk
 
# call BuildPackage - OpenWrt buildroot signature
meshdesk.lua
-- Copyright 2016 Dirk van der Walt <dirk@mymail.com>
-- Licensed to the public under the Apache License 2.0.
 
module("luci.controller.meshdesk", package.seeall)
 
function index()
        local cc
        cc = entry( { "admin", "system", "meshdesk" },       cbi("meshdesk"),         _("Cloud Controller"),                90)
end
meshdesk.lua
m = Map("meshdesk", translate("Cloud Controller"), translate("Supply the following details"))
 
        d = m:section(NamedSection,"settings", "settings","Activation" )  -- info is the section called info in cbi_file
                a = d:option(ListValue, "mode", "Mode");
                a.optional=false;
                a.rmempty = false;
                a:value("off","OFF");
                a:value("mesh","Mesh");
                a:value("ap","AP");
 
        local s_internet = m:section(NamedSection,"internet1","internet","Settings");
                local protocol = s_internet:option(ListValue,"protocol", "Protocol");
                protocol:value("http","HTTP");
                protocol:value("https","HTTPS");
                local ip = s_internet:option(Value,'ip','IP Address','IP Address of Cloud Controller');
 
m.on_parse = function(self)
        -- all written config names are in self.parsechain
        local current_mode = uci.get("meshdesk", "settings", "mode");
        local new_mode  = a:formvalue("settings")
        if(current_mode ~= new_mode)then
                if(new_mode == 'off')then
                        nixio.fs.copy("/etc/MESHdesk/configs/wireless_original","/etc/config/wireless");
                        nixio.fs.copy("/etc/MESHdesk/configs/network_original","/etc/config/network");
                end
        end
end
 
return m
#  -i :           Recreate the index only. No feed update from repository is performed.
~/lede/source/scripts/feeds update -i
~/lede/source/scripts/feeds install luci-app-meshdesk

Modify the LuCI theme

~/lede/source/scripts/feeds install luci-theme-material
 <a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
<a class="brand" href="#">MESHdesk</a>
  <footer class="mobile-hide">
                    <a href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> /
                    <a href="https://openwrt.org/"><%= ver.distversion %></a>
                    <% if #categories > 1 then %>
                    <ul class="breadcrumb pull-right" id="modemenu">
                        <% for i, r in ipairs(categories) do %>
                        <li<% if request[1] == r then %> class="active"<%end%>><a href="<%=controller%>/<%=r%>/"><%=striptags(translate(tree.nodes[r].title))%></a> <span class="divider">|</span></li>
                        <% end %>
                    </ul>
                    <% end %>
                </footer>
<footer class="mobile-hide">
           MESHdesk project 2016
</footer>