Add previous commit to LUA patch series
Build, Test, Deploy / smoke-tests (push) Has been cancelled
Codespell / spell-check (push) Has been cancelled
Check for merge conflicts / merge-conflict (push) Has been cancelled
API validation / Node (push) Has been cancelled
Build, Test, Deploy / gha (pihole-FTL-386, , linux/386) (push) Has been cancelled
Build, Test, Deploy / gha (pihole-FTL-amd64, , linux/amd64) (push) Has been cancelled
Build, Test, Deploy / gha (pihole-FTL-amd64-clang, clang, linux/amd64) (push) Has been cancelled
Build, Test, Deploy / gha (pihole-FTL-riscv64, , linux/riscv64) (push) Has been cancelled
Build, Test, Deploy / self-hosted (pihole-FTL-arm64, linux/arm64/v8) (push) Has been cancelled
Build, Test, Deploy / self-hosted (pihole-FTL-armv6, linux/arm/v6) (push) Has been cancelled
Build, Test, Deploy / self-hosted (pihole-FTL-armv7, linux/arm/v7) (push) Has been cancelled

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-06-26 08:34:02 +02:00
parent 54798be3f8
commit 40cfbbbbff
2 changed files with 69 additions and 0 deletions
+1
View File
@@ -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"
@@ -0,0 +1,68 @@
From 54798be3f80824df3490dd420cbf912b07cb1550 Mon Sep 17 00:00:00 2001
From: DL6ER <dl6er@dl6er.de>
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 <dl6er@dl6er.de>
---
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