From 759c0a3007bc145fca914e19e2aef99541ff942f Mon Sep 17 00:00:00 2001 From: Wouter R Date: Mon, 19 May 2014 21:39:59 +0200 Subject: [PATCH] Install loglite filter to wifibox. Small fixes to loglite filter. Set dummy host/port/agent info on command-line API call. Remove non-functional version info from shell banner. New todo item in release script. Conflicts: extra/scripts/publish-wifibox-release.lua --- Makefile | 4 ++++ extra/scripts/publish-wifibox-release.lua | 4 ++-- post-install.sh | 2 +- src/rest/request.lua | 4 ++++ src/script/loglite-filters.lua | 2 +- src/script/loglite.lua | 10 ++++++---- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 63cdfae..c0f17e2 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,7 @@ define Package/wifibox/install #$(INSTALL_DIR) $(1)/etc $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DIR) $(1)/root/ #$(INSTALL_DIR) $(1)/www $(INSTALL_DIR) $(1)/www/cgi-bin @@ -102,6 +103,9 @@ define Package/wifibox/install $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3d-updater.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/script $(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/d3d-updater.lua $(1)/bin/d3d-updater + $(CP) $(WIFIBOX_BASE_DIR)/script/loglite-filters.lua $(1)/root/ + $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/loglite.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/script + $(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/loglite.lua $(1)/bin/loglite $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifibox_init $(1)/etc/init.d/wifibox $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/dhcpcheck_init $(1)/etc/init.d/dhcpcheck $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3dapi $(1)/$(TGT_LUA_DIR_SUFFIX)/script diff --git a/extra/scripts/publish-wifibox-release.lua b/extra/scripts/publish-wifibox-release.lua index 6cbcacd..1154304 100755 --- a/extra/scripts/publish-wifibox-release.lua +++ b/extra/scripts/publish-wifibox-release.lua @@ -27,8 +27,8 @@ -- HostName ftp.greenhost.nl -- Some basic sanity checks are built in (unique version, updated release notes, 'clean' openwrt config) -- but lots others are still missing (mainly: clean git repo's, freshly built images). --- The script must be run from within the openwrt build root. So it's handy to create a symlink --- to this file. You could to something like from the build root: +-- The script must be run from within the openwrt build root. So it's handy to create a symlink +-- to this file. You could to something like from the build root: -- ln -s ~/wrt-wifibox-feed/doodle3d-firmware/extra/scripts/publish-wifibox-release.lua . -- Then you can start with: -- cd trunk ../publish-wifibox-release.lua diff --git a/post-install.sh b/post-install.sh index b85d63c..8f5865a 100644 --- a/post-install.sh +++ b/post-install.sh @@ -38,7 +38,7 @@ if [ ! -f $IPKG_INSTROOT/etc/banner.default ]; then mv $IPKG_INSTROOT/etc/banner $IPKG_INSTROOT/etc/banner.default cat <<-'EOM' > $IPKG_INSTROOT/etc/banner ........D o o d l e 3 D - .......________ _____ _____ v \$(PACKAGE_VERSION) + .......________ _____ _____ ....../ / / |__ / __/ / - /___ __ ...../ / / /--// _|-// --| . /v / ..../________/__//__/__//____/___/_^_\ diff --git a/src/rest/request.lua b/src/rest/request.lua index 5c52c8f..00ad3e4 100644 --- a/src/rest/request.lua +++ b/src/rest/request.lua @@ -181,6 +181,10 @@ function M.new(environment, postData, debugEnabled) self.remoteAddress = environment['REMOTE_ADDR'] else self.requestMethod = 'CMDLINE' + self.remoteHost = "cmdline" + self.remotePort = "0" + self.userAgent = "shell" + self.remoteAddress = "0.0.0.0" end self.cmdLineArgs = kvTableFromArray(arg) diff --git a/src/script/loglite-filters.lua b/src/script/loglite-filters.lua index d0171b0..6d74ade 100644 --- a/src/script/loglite-filters.lua +++ b/src/script/loglite-filters.lua @@ -10,7 +10,7 @@ M.printstart = { M.test = { ['options'] = { 'delete_mode' }, ['patterns'] = { - ['(verbose)'] = 'underline,cyan,_delete' + ['(verbose)'] = 'underline,cyan,_delete', ['(info)'] = 'magenta', ['ABSD'] = '_nodelete', ['SE?RV?'] = 'bblue' diff --git a/src/script/loglite.lua b/src/script/loglite.lua index f9034ce..4e88d9b 100644 --- a/src/script/loglite.lua +++ b/src/script/loglite.lua @@ -1,3 +1,5 @@ +#!/usr/bin/env lua + -- Notes -- * directives: either a color, a color prefixed by 'b' or one of: _delete, _nodelete, [_matchonly] -- * pattern rules are matched top to bottom, the last one encountered overriding any previous conflicting directive @@ -50,9 +52,9 @@ local DFL_FILTERSET_FILE = "loglite-filters.lua" local DEFAULT_FILTERSET = { ['options'] = { 'default_enabled', 'keep_mode' }, ['patterns'] = { - ['(error)'] = 'red', - ['(warning)'] = 'yellow', - ['(bulk)'] = 'gray' + ['%(error%)'] = 'red', + ['%(warning%)'] = 'yellow', + ['%(bulk%)'] = 'gray' } } @@ -174,7 +176,7 @@ local function main() local tailin = followFile and io.popen('tail -f ' .. followFile, 'r') or io.stdin local patterns = DEFAULT_FILTERSET.patterns - local options = { ['mode'] = 'keep', count = 'all' } + local options = { ['mode'] = 'keep', count = 'none' } pcall(tailStream, tailin, patterns, options) -- Note: protected call to suppress interrupt error thrown by lines iterator end