can't you just drop a dummy stubbed out version into /usr/share/uconfig/unetmsg/client.uc on 23.05 builds ?

    John

On 03.12.25 15:38, Christian Korber wrote:
unetmsg depends on ucode functions (acl) that are not in openwrt-23.05.
To make it possible to use ufp in that branch, this commit tests
if unetmsg is installed on the target.

Changes in v2:
Patch missed '--' at the and and was corrupt.

Signed-off-by: Christian Korber <[email protected]>
---
  ufpd | 46 +++++++++++++++++++++++++++++-----------------
  1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/ufpd b/ufpd
index c41ab8c..2068f66 100755
--- a/ufpd
+++ b/ufpd
@@ -2,14 +2,22 @@
  'use strict';
  import * as uloop from "uloop";
  import * as libubus from "ubus";
-import * as unetmsg from "unetmsg.client";
-import { readfile, glob, basename } from "fs";
+import { readfile, glob, basename, stat } from "fs";
  let uht = require("uht");
+let unetmsg, unet;
  push(REQUIRE_SEARCH_PATH, "/usr/share/ufp/*.uc");
+let unetmsg_installed = stat("/usr/share/ucode/unetmsg");
+
+if (unetmsg_installed)
+       unetmsg = require("unetmsg.client");
+
  uloop.init();
  let ubus = libubus.connect();
-let unet = unetmsg.open(ubus);
+
+if (unetmsg_installed)
+       unet = unetmsg.open(ubus);
+
  let fingerprints = {};
  let fingerprint_ht = [];
  let devices = {};
@@ -49,17 +57,19 @@ function match_fingerprint(key)
        return fp;
  }
-unet.publish("ufp", (req) => {
-       let data = req.args;
-       switch (data.type) {
-       case "get_data":
-               let mac = data.macaddr;
-               if (mac)
-                       return { data: devices[mac] };
-               return { data: devices };
-       }
-});
-unet.subscribe("ufp");
+if (unetmsg_installed) {
+       unet.publish("ufp", (req) => {
+               let data = req.args;
+               switch (data.type) {
+               case "get_data":
+                       let mac = data.macaddr;
+                       if (mac)
+                               return { data: devices[mac] };
+                       return { data: devices };
+               }
+       });
+       unet.subscribe("ufp");
+}
function dev_timestamp_cmp(a, b)
  {
@@ -74,9 +84,11 @@ function network_devices(local) {
                devices
        ];
- unet.request("ufp", "get_data", {}, (msg) => {
-               push(device_lists, msg.data);
-       });
+       if (unetmsg_installed) {
+               unet.request("ufp", "get_data", {}, (msg) => {
+                       push(device_lists, msg.data);
+               });
+       }
let cur_devices = [];
        for (let list in device_lists)


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to