Developing lightweight computation at the DSG edge

Commit fb97dd73 authored by conxuro's avatar conxuro
Browse files

Adding version options to qmpinfo (+some fixes)

parent 2dab45f0
......@@ -29,6 +29,9 @@ PKG_RELEASE:=8
#PKG_SOURCE_URL:=@SF/qmp-small-node
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
QMP_CODENAME:=Ratafia
QMP_RELEASE:=1.0beta
QMP_BUILDDATE:=$(shell date +%Y%m%d_%H%M)
include $(INCLUDE_DIR)/package.mk
......@@ -86,23 +89,22 @@ define Build/Compile
endef
define Package/qmp-small-node/install
CODENAME:=Ratafia
RELEASE:=1.0beta
$(CP) ./files/* $(1)/
$(CP) ./files/etc/config/qmp $(1)/etc/config/qmp.orig
$(SED) 's,$$$$BRANCH,$(BRANCH_GIT),g' $(1)/etc/uci-defaults/qmp_banner
$(SED) 's,$$$$REV,$(REV_GIT),g' $(1)/etc/uci-defaults/qmp_banner
$(SED) 's,$$$$COD,$(CODENAME),g' $(1)/etc/uci-defaults/qmp_banner
$(SED) 's,$$$$REV,$(RELEASE),g' $(1)/etc/uci-defaults/qmp_banner
$(SED) 's,$$$$COD,$(QMP_CODENAME),g' $(1)/etc/uci-defaults/qmp_banner
$(SED) 's,$$$$REL,$(QMP_RELEASE),g' $(1)/etc/uci-defaults/qmp_banner
$(SED) 's,$$$$DATE,$(QMP_BUILDDATE),g' $(1)/etc/uci-defaults/qmp_banner
chmod 755 $(1)/etc/init.d/qmp_autoconf
date +%Y%m%d > $(1)/etc/qmp/qmp.version
echo "QMP_ID=qMp" > $(1)/etc/qmp/qmp.release
echo "QMP_CODENAME=$(CODENAME)" >> $(1)/etc/qmp/qmp.release
echo "QMP_RELEASE=$(RELEASE)" >> $(1)/etc/qmp/qmp.release
echo "QMP_BRANCH=$(BRANCH_GIT)" >> $(1)/etc/qmp/qmp.release
echo "QMP_REVISION=$(REV_GIT)" >> $(1)/etc/qmp/qmp.release
echo "QMP_BUILDDATE=$(date +%Y%m%d)" >> $(1)/etc/qmp/qmp.release
echo "QMP_DESCRIPTION=\"qMp $(CODENAME) $(RELEASE), $(BRANCH_GIT) rev.$(REV_GIT)-$(date +%Y%m%d)\"" >> $(1)/etc/qmp/qmp.release
echo "QMP_ID=qMp" > $(1)/etc/qmp/qmp.release
echo "QMP_CODENAME=$(QMP_CODENAME)" >> $(1)/etc/qmp/qmp.release
echo "QMP_RELEASE=$(QMP_RELEASE)" >> $(1)/etc/qmp/qmp.release
echo "QMP_BRANCH=$(BRANCH_GIT)" >> $(1)/etc/qmp/qmp.release
echo "QMP_REVISION=$(REV_GIT)" >> $(1)/etc/qmp/qmp.release
echo "QMP_BUILDDATE=$(QMP_BUILDDATE)" >> $(1)/etc/qmp/qmp.release
echo "QMP_DESCRIPTION=\"qMp $(QMP_CODENAME) $(QMP_RELEASE), $(BRANCH_GIT) rev.$(REV_GIT)-$(QMP_BUILDDATE)\"" >> $(1)/etc/qmp/qmp.release
endef
......
......@@ -105,8 +105,8 @@ help() {
echo " unpublish_hna : Unpublish a current HNA: unpublish_hna <ID>"
echo " apply_netserver : Start/stop nerserver depending on qmp configuration"
echo " enable_ns_ppt : Enable POE passtrought from NanoStation M2/5 devices. Be careful with this"
echo " upgrade [URL] : Upgrade system. By default to the last version, but image url can be provided to force"
echo " hard_reboot : Performs a hard reboot (using kernel sysrq)"
echo " upgrade [URL] : Upgrade system. By default to the last version, but image url can be provided to force"
echo " hard_reboot : Performs a hard reboot (using kernel sysrq)"
echo ""
exit 1
}
......
......@@ -28,13 +28,16 @@ function print_help()
print("qMpinfo is a dummy script to get some information about the device")
print("Usage: qmpinfo <question> [options]")
print("Available questions:")
print(" modes <dev> : supported modes by the wireless card")
print(" channels <dev> : supported channels and supported HT40 type (+/-) ")
print(" ipv4 : print all ipv4 from this computer (excluding localhost)")
print(" hostname : print device hostname")
print(" bwtest <ipv6> : perform a bandwidth test")
print(" nodes : list all nodes on MESH network")
print(" key : print qmp key")
print(" modes <dev> : supported modes by the wireless card")
print(" channels <dev> : supported channels and supported HT40 type (+/-) ")
print(" txpower <dev> : supported transmission powers")
print(" ipv4 : print all ipv4 from this computer (excluding localhost)")
print(" hostname : print device hostname")
print(" bwtest <ipv6> : perform a bandwidth test")
print(" nodes : list all nodes on MESH network")
print(" links : list direct connected nodes on MESH")
print(" version <option> : show version (options: full, build, branch, codename, release, revision)")
print(" key : print qmp key")
print("")
end
......@@ -109,6 +112,22 @@ function links()
end
end
function version()
loocal checkop = qmpinfo.get_version(op1)
if checkop == nil then
print("Wrong option!")
print("Usage: qmpinfo version <options>")
print("Options:")
print(" full : full description")
print(" build : build date")
print(" branch : development branch")
print(" codename : release codename")
print(" release : release number")
print(" revision : repository revision number")
print("")
else print(qmpinfo.get_version(op1))
end
end
function key()
print(qmpinfo.get_key())
......@@ -140,6 +159,8 @@ elseif question == "key" then
key()
elseif question == "links" then
links()
elseif question == "version" then
version()
else
print_help()
end
......
......@@ -221,6 +221,18 @@ function qmpinfo.links()
return result
end
function qmpinfo.get_version(option)
local version = nil
if option == nil or option == "full" then version = util.exec("cat /etc/qmp/qmp.release | grep DESCRIPTION | cut -d= -f2")
elseif option == "build" then version = util.exec("cat /etc/qmp/qmp.release | grep BUILDDATE | cut -d= -f2")
elseif option == "branch" then version = util.exec("cat /etc/qmp/qmp.release | grep BRANCH | cut -d= -f2")
elseif option == "codename" then version = util.exec("cat /etc/qmp/qmp.release | grep CODENAME | cut -d= -f2")
elseif option == "release" then version = util.exec("cat /etc/qmp/qmp.release | grep RELEASE | cut -d= -f2")
elseif option == "revision" then version = util.exec("cat /etc/qmp/qmp.release | grep REVISION | cut -d= -f2")
else version = nil
end
return version
end
function qmpinfo.get_key()
local keyf = util.exec("uci get qmp.node.key")
......
......@@ -2,7 +2,7 @@
cat /etc/qmp/qmp.banner >> /etc/banner
echo " ---------------------------------------------------" >> /etc/banner
echo " $CODE ($REL, $BRANCH rev.$REV-$DATE)" >> /etc/banner
echo " $COD ($REL, $BRANCH rev.$REV-$DATE)" >> /etc/banner
echo " ---------------------------------------------------" >> /etc/banner
echo " * Recipe: http://en.wikipedia.org/wiki/Ratafia" >> /etc/banner
echo "" >> /etc/banner
......
......@@ -28,7 +28,7 @@ node_section = m:section(NamedSection, "node", "qmp", translate("Node"), transla
node_section.addremove = False
community_id = node_section:option(Value,"community_id", translate("Community id"), translate("Community identifier for node name (alphanumeric, no spaces)"))
community_node_id = node_section:option(Value,"community_node_id", translate("Node id"), translate("Node identifier, leave blank for randomize (alphanumeric, no spaces)"))
community_node_id = node_section:option(Value,"community_node_id", translate("Node id"), translate("Node identifier, leave blank for randomize (hexadecimal 16bit)"))
primary_device = node_section:option(Value,"primary_device", translate("Primary device"), translate("Network primary device which never will change"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment