diff --git a/patch/lua.sh b/patch/lua.sh index 63342544..79f6572e 100644 --- a/patch/lua.sh +++ b/patch/lua.sh @@ -3,5 +3,6 @@ set -e patch -p1 < patch/lua/0001-add-pihole-library.patch patch -p1 < patch/lua/0002-Make-lsqlite3-globally-available-in-LUA.patch +patch -p1 < patch/lua/0003-Make-Pi-hole-bundled-scripts-e.g.-inspect-also-avail.patch echo "ALL PATCHES APPLIED OKAY" diff --git a/patch/lua/0003-Make-Pi-hole-bundled-scripts-e.g.-inspect-also-avail.patch b/patch/lua/0003-Make-Pi-hole-bundled-scripts-e.g.-inspect-also-avail.patch new file mode 100644 index 00000000..2f294503 --- /dev/null +++ b/patch/lua/0003-Make-Pi-hole-bundled-scripts-e.g.-inspect-also-avail.patch @@ -0,0 +1,68 @@ +From 54798be3f80824df3490dd420cbf912b07cb1550 Mon Sep 17 00:00:00 2001 +From: DL6ER +Date: Wed, 26 Jun 2024 08:32:53 +0200 +Subject: [PATCH] Make Pi-hole-bundled scripts (e.g. inspect) also available in + dnsmasq/web LUA environments. So far, they were only available in the CLI + +Signed-off-by: DL6ER +--- + src/lua/linit.c | 9 +++++++++ + src/lua/lua.c | 9 --------- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/src/lua/linit.c b/src/lua/linit.c +index 6023020c..5125f6ee 100644 +--- a/src/lua/linit.c ++++ b/src/lua/linit.c +@@ -34,6 +34,10 @@ + #include "lualib.h" + #include "lauxlib.h" + ++/** Pi-hole modification **/ ++#include "ftl_lua.h" ++/**************************/ ++ + + /* + ** these libs are loaded by lua.c and are readily available to any Lua +@@ -65,5 +69,10 @@ LUALIB_API void luaL_openlibs (lua_State *L) { + luaL_requiref(L, lib->name, lib->func, 1); + lua_pop(L, 1); /* remove lib */ + } ++ ++ /************** Pi-hole modification ***************/ ++ // Load and enable libraries bundled with Pi-hole ++ ftl_lua_init(L); ++ /***************************************************/ + } + +diff --git a/src/lua/lua.c b/src/lua/lua.c +index f269c997..68cdbe6b 100644 +--- a/src/lua/lua.c ++++ b/src/lua/lua.c +@@ -20,10 +20,6 @@ + #include "lauxlib.h" + #include "lualib.h" + +-/** Pi-hole modification **/ +-#include "ftl_lua.h" +-/**************************/ +- + + #if !defined(LUA_PROGNAME) + #define LUA_PROGNAME "lua" +@@ -646,11 +642,6 @@ static int pmain (lua_State *L) { + return 0; /* error running LUA_INIT */ + } + +- /************** Pi-hole modification ***************/ +- // Load and enable libraries bundled with Pi-hole +- ftl_lua_init(L); +- /***************************************************/ +- + if (!runargs(L, argv, optlim)) /* execute arguments -e and -l */ + return 0; /* something failed */ + if (script > 0) { /* execute main script (if there is one) */ +-- +2.34.1 +