mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-28 23:29:17 +08:00
Compare commits
134 Commits
qcom
...
dynamic_bb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1b793ca53 | ||
|
|
89b623b415 | ||
|
|
061d5c0eef | ||
|
|
75869b899c | ||
|
|
ea19916cc4 | ||
|
|
d416df6f86 | ||
|
|
72c59bc2ad | ||
|
|
5f2b3a3f9b | ||
|
|
cb504ababe | ||
|
|
ab44d2383e | ||
|
|
30d72f1683 | ||
|
|
45b8a62027 | ||
|
|
c476a8ec75 | ||
|
|
4a3d6e0331 | ||
|
|
a947dae5f3 | ||
|
|
b219be48eb | ||
|
|
87fc510726 | ||
|
|
4929ebc503 | ||
|
|
88af9763a0 | ||
|
|
34343d4824 | ||
|
|
708a417086 | ||
|
|
e8ba4a8a14 | ||
|
|
b2523c14b6 | ||
|
|
2677dd57de | ||
|
|
df919ded0c | ||
|
|
343ed3993b | ||
|
|
41b934575e | ||
|
|
579fd3bf07 | ||
|
|
ee30bacc15 | ||
|
|
06bad4b9c4 | ||
|
|
04a08815e7 | ||
|
|
8397922ecd | ||
|
|
4de8c13136 | ||
|
|
b9b81709af | ||
|
|
b4c7eb1a3e | ||
|
|
6706e94bc2 | ||
|
|
44c870e1bb | ||
|
|
4f5c7623d2 | ||
|
|
5ca4ee678b | ||
|
|
ebb112f264 | ||
|
|
b30aca1b27 | ||
|
|
5d7af4f3c3 | ||
|
|
e5204b2fdc | ||
|
|
ed855b6921 | ||
|
|
052823c0fd | ||
|
|
e5f389aab6 | ||
|
|
6bf2135bbc | ||
|
|
dcc58ea25a | ||
|
|
8644eb21ab | ||
|
|
170a1f6ad8 | ||
|
|
362b54c642 | ||
|
|
d9e28aa3ca | ||
|
|
a942e21040 | ||
|
|
49dd5d8e31 | ||
|
|
86757e41a3 | ||
|
|
3f86658c46 | ||
|
|
7fa87aca9d | ||
|
|
5259cc9edb | ||
|
|
b39000ea58 | ||
|
|
001d494afd | ||
|
|
3befafcbc1 | ||
|
|
597d866204 | ||
|
|
568b6785d3 | ||
|
|
3a7975bd9b | ||
|
|
e54251dc24 | ||
|
|
ec2b9e76c4 | ||
|
|
d8b65da11f | ||
|
|
3f124c31f0 | ||
|
|
b376a0b16a | ||
|
|
42c0e1ecc8 | ||
|
|
cdce816fd2 | ||
|
|
a49951ad7e | ||
|
|
887cef9b37 | ||
|
|
3ccdcb4140 | ||
|
|
0a80afc550 | ||
|
|
c5c4a6dcbe | ||
|
|
6f5e41bb76 | ||
|
|
20937718f1 | ||
|
|
f7b13cf973 | ||
|
|
946b7a453c | ||
|
|
fcf102b9d2 | ||
|
|
6355eb4b9e | ||
|
|
315d7b44f9 | ||
|
|
6c342e930d | ||
|
|
624e67df4b | ||
|
|
8f2694b035 | ||
|
|
776baa7c95 | ||
|
|
baff3cf6c7 | ||
|
|
a5e007a3b6 | ||
|
|
23b88839a0 | ||
|
|
ddc1933862 | ||
|
|
50e836e3e7 | ||
|
|
e3f7ad9156 | ||
|
|
73d9e5a6f1 | ||
|
|
73124c3d37 | ||
|
|
be2a34fcb4 | ||
|
|
a3f8d33711 | ||
|
|
a500724e17 | ||
|
|
ab4b8f3373 | ||
|
|
bc0452e56d | ||
|
|
da92efc708 | ||
|
|
ba98d3e7aa | ||
|
|
019a02fa7f | ||
|
|
42d496107e | ||
|
|
549378ecbd | ||
|
|
c0bef6ce70 | ||
|
|
97853638bf | ||
|
|
a968641bd1 | ||
|
|
e7c8c56819 | ||
|
|
f4b1bf345c | ||
|
|
6d212ecea3 | ||
|
|
444a5a0c82 | ||
|
|
b2fce09a7f | ||
|
|
6fe9ad271e | ||
|
|
7677e51aeb | ||
|
|
9724913f14 | ||
|
|
99925c9360 | ||
|
|
621ca1c23a | ||
|
|
316e7d1d47 | ||
|
|
8ebe2c7f5a | ||
|
|
0b4be48bf3 | ||
|
|
f680ff2229 | ||
|
|
60034eab91 | ||
|
|
6d539c17a7 | ||
|
|
2c06bbeaf0 | ||
|
|
d36147601b | ||
|
|
cb3c2d4b0e | ||
|
|
e11950b9a1 | ||
|
|
901c2df5cf | ||
|
|
504621b64b | ||
|
|
916ac0eea7 | ||
|
|
d7859ebe06 | ||
|
|
c96e9c170a | ||
|
|
9cb726d649 |
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2019 iopsys Software Solutions AB. All rights reserved.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*/
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB. All rights reserved.
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
17
bbf/Makefile
17
bbf/Makefile
@@ -1,22 +1,22 @@
|
||||
#
|
||||
# Copyright (C) 2019 Iopsys
|
||||
# Copyright (C) 2019 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=1.0-2019-10-01
|
||||
PKG_VERSION:=1.0-2019-12-28
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b3bae9df19df35075ac52f53758288d8e0573790
|
||||
PKG_SOURCE_VERSION:=87df7048821fb8a6dcd35f0959f97aa08688f53b
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@@ -36,6 +36,13 @@ define Package/libbbfdm/description
|
||||
Test description will update later.
|
||||
endef
|
||||
|
||||
USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
|
||||
ifneq ($(USE_LOCAL),)
|
||||
define Build/Prepare
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += -DCUSTOM_PREFIX=\\\"$(CONFIG_LIBBBFDM_VENDOR_PREFIX)\\\"
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
@@ -70,6 +77,7 @@ define Package/libbbfdm/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.so* $(1)/lib/
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/functions $(1)/usr/share/bbfdm
|
||||
@@ -80,6 +88,7 @@ define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
|
||||
$(CP) $(PKG_BUILD_DIR)/dmtree/tr181/*.h $(1)/usr/include/libbbfdm/
|
||||
$(CP) $(PKG_BUILD_DIR)/dmtree/tr157/*.h $(1)/usr/include/libbbfdm/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
39
bbfdetest/Makefile
Normal file
39
bbfdetest/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Copyright (C) 2020 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdetest
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bbfdetest
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Library for example shared libraries
|
||||
DEPENDS:=+libubox +ubus +libbbf_api
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
define Build/Prepare
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/bbfdetest/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdetest.init $(1)/etc/init.d/bbfdetest
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdetest $(1)/usr/sbin/bbfdetest
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib/bbfdm
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bbfdetest))
|
||||
|
||||
25
bbfdetest/src/Makefile
Normal file
25
bbfdetest/src/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
PROG = bbfdetest
|
||||
LIB = libbbfdetest.so
|
||||
|
||||
PROG_OBJS = bbfdetest.o
|
||||
LIB_OBJS = libbbfdetest.o
|
||||
|
||||
PROG_CFLAGS = $(CFLAGS) -fstrict-aliasing
|
||||
PROG_LDFLAGS = $(LDFLAGS) -lubus -lubox
|
||||
LIB_LDFLAGS = $(LDFLAGS) -lbbf_api
|
||||
|
||||
.PHONY: all
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<
|
||||
|
||||
all: $(PROG) $(LIB)
|
||||
|
||||
$(PROG): $(PROG_OBJS)
|
||||
$(CC) $(PROG_LDFLAGS) -o $@ $^
|
||||
|
||||
$(LIB): $(LIB_OBJS)
|
||||
$(CC) $(PROG_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROG) $(LIB)
|
||||
185
bbfdetest/src/bbfdetest.c
Normal file
185
bbfdetest/src/bbfdetest.c
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <libubox/blobmsg.h>
|
||||
#include <libubox/uloop.h>
|
||||
#include <libubus.h>
|
||||
|
||||
typedef struct SupportedDataModel
|
||||
{
|
||||
char url[128];
|
||||
char urn[128];
|
||||
char features[128];
|
||||
} Supported_DataModel;
|
||||
|
||||
struct SupportedDataModel DataModel[] = {
|
||||
{"http://www.broadband-forum.org/cwmp/tr-181-2-13-0.xml","urn:broadband-forum-org:tr-181-2-13-0","Router,Wireless,Firewall,NAT,IPv4,IPv6"},
|
||||
{"http://www.broadband-forum.org/cwmp/tr-104-1-1-0.xml","urn:broadband-forum-org:tr-104-1-1-0", "VoiceService"},
|
||||
{"http://www.broadband-forum.org/cwmp/tr-143-1-1-0.xml","urn:broadband-forum-org:tr-143-1-1-0", "Ping,TraceRoute,Download,Upload,UDPecho,ServerSelectionDiag"},
|
||||
{"http://www.broadband-forum.org/cwmp/tr-157-1-3-0.xml","urn:broadband-forum-org:tr-157-1-3-0", "Bulkdata,SoftwareModules"},
|
||||
};
|
||||
|
||||
void remove_new_line(char *buf)
|
||||
{
|
||||
int len;
|
||||
len = strlen(buf) - 1;
|
||||
if (buf[len] == '\n')
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
static int device_info(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg)
|
||||
{
|
||||
void *a, *t;
|
||||
struct blob_buf bb;
|
||||
char line[256];
|
||||
char *p;
|
||||
|
||||
memset(&bb,0,sizeof(struct blob_buf));
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
FILE* fs = fopen( "/proc/cpuinfo" , "r");
|
||||
if (fs) {
|
||||
a = blobmsg_open_array(&bb, "processor");
|
||||
while (fgets(line, 256, fs)) {
|
||||
remove_new_line(line);
|
||||
strtok_r(line, ":", &p);
|
||||
if (strcasestr(line, "processor")) {
|
||||
t = blobmsg_open_table(&bb, "");
|
||||
blobmsg_add_u32(&bb, "number", atoi(p+1));
|
||||
}
|
||||
if (strcasestr(line, "model")) {
|
||||
blobmsg_add_string(&bb, "model", p+1);
|
||||
blobmsg_close_table(&bb, t);
|
||||
}
|
||||
}
|
||||
fclose(fs);
|
||||
blobmsg_close_array(&bb, a);
|
||||
}
|
||||
|
||||
a = blobmsg_open_array(&bb, "dataModel");
|
||||
for (int i = 0; i < sizeof(DataModel)/sizeof(struct SupportedDataModel); i++) {
|
||||
t = blobmsg_open_table(&bb, "");
|
||||
blobmsg_add_string(&bb, "url", DataModel[i].url);
|
||||
blobmsg_add_string(&bb, "urn", DataModel[i].urn);
|
||||
blobmsg_add_string(&bb, "features", DataModel[i].features);
|
||||
blobmsg_close_table(&bb, t);
|
||||
}
|
||||
blobmsg_close_array(&bb, a);
|
||||
|
||||
ubus_send_reply(ctx, req, bb.head);
|
||||
blob_buf_free(&bb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum {
|
||||
PING_HOST,
|
||||
__PING_MAX
|
||||
};
|
||||
|
||||
static const struct blobmsg_policy ping_policy[__PING_MAX] = {
|
||||
[PING_HOST] = { .name = "host", .type = BLOBMSG_TYPE_STRING },
|
||||
};
|
||||
|
||||
static int device_ping(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg)
|
||||
{
|
||||
struct blob_attr *tb[__PING_MAX] = {NULL};
|
||||
char *p, *min, *avg, *max, line[512], command[512];
|
||||
struct blob_buf bb;
|
||||
FILE *log;
|
||||
int host_ping = 0;
|
||||
|
||||
if(blobmsg_parse(ping_policy, __PING_MAX, tb, blob_data(msg), blob_len(msg)))
|
||||
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||
|
||||
if (!tb[PING_HOST])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
snprintf(command, sizeof(command), "ping -c 1 -W 1 %s", blobmsg_get_string(tb[PING_HOST]));
|
||||
|
||||
memset(&bb,0,sizeof(struct blob_buf));
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
if ((log = popen(command, "r"))) {
|
||||
while (fgets(line, sizeof(line), log) != NULL) {
|
||||
if (strstr(line, "round-trip")) {
|
||||
host_ping = 1;
|
||||
blobmsg_add_u8(&bb,"status", true);
|
||||
strtok_r(line, "=", &min);
|
||||
strtok_r(min+1, "/", &avg);
|
||||
blobmsg_add_string(&bb, "min", min+1);
|
||||
strtok_r(avg, "/", &max);
|
||||
blobmsg_add_string(&bb, "avg", avg);
|
||||
strtok_r(max, " ", &p);
|
||||
blobmsg_add_string(&bb, "max", max);
|
||||
break;
|
||||
}
|
||||
}
|
||||
pclose(log);
|
||||
}
|
||||
|
||||
if (!host_ping)
|
||||
blobmsg_add_u8(&bb,"status", false);
|
||||
|
||||
ubus_send_reply(ctx, req, bb.head);
|
||||
blob_buf_free(&bb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ubus_method device_object_methods[] = {
|
||||
UBUS_METHOD_NOARG("info", device_info),
|
||||
UBUS_METHOD("ping", device_ping, ping_policy),
|
||||
};
|
||||
|
||||
static struct ubus_object_type device_object_type = UBUS_OBJECT_TYPE("device", device_object_methods);
|
||||
|
||||
static struct ubus_object device_object = {
|
||||
.name = "device",
|
||||
.type = &device_object_type,
|
||||
.methods = device_object_methods,
|
||||
.n_methods = ARRAY_SIZE(device_object_methods),
|
||||
};
|
||||
|
||||
static void device_init(struct ubus_context *ctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ubus_add_object(ctx, &device_object);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to publish '%s' object : %s\n", device_object.name, ubus_strerror(ret));
|
||||
|
||||
uloop_run();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const char *ubus_socket = NULL;
|
||||
struct ubus_context *ctx = NULL;
|
||||
|
||||
uloop_init();
|
||||
ctx = ubus_connect(ubus_socket);
|
||||
if (!ctx) {
|
||||
fprintf(stderr, "Failed to connect to ubus\n");
|
||||
return -1;
|
||||
}
|
||||
ubus_add_uloop(ctx);
|
||||
device_init(ctx);
|
||||
uloop_run();
|
||||
ubus_free(ctx);
|
||||
if (ctx) ubus_free(ctx);
|
||||
uloop_done();
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
bbfdetest/src/bbfdetest.init
Normal file
19
bbfdetest/src/bbfdetest.init
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=94
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/bbfdetest
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command ${PROG}
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
292
bbfdetest/src/libbbfdetest.c
Normal file
292
bbfdetest/src/libbbfdetest.c
Normal file
@@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <libbbf_api/dmbbf.h>
|
||||
#include <libbbf_api/dmcommon.h>
|
||||
#include <libbbf_api/dmuci.h>
|
||||
#include <libbbf_api/dmubus.h>
|
||||
#include <libbbf_api/dmjson.h>
|
||||
#include "libbbfdetest.h"
|
||||
|
||||
/* ********** RootDynamicObj ********** */
|
||||
LIB_MAP_OBJ tRootDynamicObj[] = {
|
||||
/* parentobj, nextobject */
|
||||
{"Device.IP.Diagnostics.", tdynamicIPDiagnosticsObj},
|
||||
{"Device.DeviceInfo.", tdynamicDeviceInfobj},
|
||||
{"Device.", tdynamicDeviceObj},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* ********** RootDynamicOperate ********** */
|
||||
LIB_MAP_OPERATE tRootDynamicOperate[] = {
|
||||
/* pathname, operation */
|
||||
{"Device.X_IOPSYS_EU_PingTEST.Run", dynamicDevicePingOperate},
|
||||
{"Device.X_IOPSYS_EU_Reboot", dynamicDeviceRebootOperate},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.IP.Diagnostics. *** */
|
||||
DMOBJ tdynamicIPDiagnosticsObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/
|
||||
{"X_IOPSYS_EU_PingTest", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tdynamicIPDiagnosticsX_IOPSYS_EU_PingTestParams, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.IP.Diagnostics.X_IOPSYS_EU_PingTest. *** */
|
||||
DMLEAF tdynamicIPDiagnosticsX_IOPSYS_EU_PingTestParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||
{"DiagnosticsState", &DMWRITE, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_DiagnosticsState, setdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_DiagnosticsState, NULL, NULL, BBFDM_BOTH},
|
||||
{"Host", &DMWRITE, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_Host, setdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_Host, NULL, NULL, BBFDM_BOTH},
|
||||
{"MinimumResponseTime", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_MinimumResponseTime, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{"AverageResponseTime", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_AverageResponseTime, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{"MaximumResponseTime", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_MaximumResponseTime, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.DeviceInfo. *** */
|
||||
DMOBJ tdynamicDeviceInfobj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/
|
||||
{"SupportedDataModel", &DMREAD, NULL, NULL, NULL, browseDeviceInfoSupportedDataModelInst, NULL, NULL, NULL, NULL, tdynamicDeviceInfoSupportedDataModelTestParams, NULL, BBFDM_CWMP},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.DeviceInfo.SupportedDataModel.{i}. *** */
|
||||
DMLEAF tdynamicDeviceInfoSupportedDataModelTestParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||
{"URL", &DMREAD, DMT_STRING, getdynamic_DeviceInfoSupportedDataModel_URL, NULL, NULL, NULL, BBFDM_CWMP},
|
||||
{"URN", &DMREAD, DMT_STRING, getdynamic_DeviceInfoSupportedDataModel_URN, NULL, NULL, NULL, BBFDM_CWMP},
|
||||
{"Features", &DMREAD, DMT_STRING, getdynamic_DeviceInfoSupportedDataModel_Features, NULL, NULL, NULL, BBFDM_CWMP},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device. *** */
|
||||
DMOBJ tdynamicDeviceObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/
|
||||
{"X_IOPSYS_EU_Processor", &DMREAD, NULL, NULL, NULL, browseDeviceX_IOPSYS_EU_ProcessorInst, NULL, NULL, NULL, NULL, tdynamicDeviceX_IOPSYS_EU_ProcessorParams, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.X_IOPSYS_EU_Processor.{i}. *** */
|
||||
DMLEAF tdynamicDeviceX_IOPSYS_EU_ProcessorParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||
{"Architecture", &DMREAD, DMT_STRING, getdynamic_DeviceX_IOPSYS_EU_Processor_Architecture, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* ENTRY METHOD
|
||||
/*************************************************************/
|
||||
int browseDeviceInfoSupportedDataModelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *datamodel_obj = NULL, *arrobj = NULL;
|
||||
char *idx, *idx_last = NULL;
|
||||
int id = 0, j = 0;
|
||||
|
||||
dmubus_call("device", "info", UBUS_ARGS{}, 0, &res);
|
||||
if (res) {
|
||||
dmjson_foreach_obj_in_array(res, arrobj, datamodel_obj, j, 1, "dataModel") {
|
||||
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)datamodel_obj, idx) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int browseDeviceX_IOPSYS_EU_ProcessorInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *processor_obj = NULL, *arrobj = NULL;
|
||||
char *idx, *idx_last = NULL;
|
||||
int id = 0, j = 0;
|
||||
|
||||
dmubus_call("device", "info", UBUS_ARGS{}, 0, &res);
|
||||
if (res) {
|
||||
dmjson_foreach_obj_in_array(res, arrobj, processor_obj, j, 1, "processor") {
|
||||
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)processor_obj, idx) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* GET & SET PARAM
|
||||
/*************************************************************/
|
||||
static int execute_pingtest()
|
||||
{
|
||||
json_object *res;
|
||||
char *host, *min, *avg, *max;
|
||||
|
||||
dmuci_get_varstate_string("cwmp", "@pingtest[0]", "Host", &host);
|
||||
if(host && host[0] == '\0')
|
||||
return 0;
|
||||
|
||||
dmubus_call("device", "ping", UBUS_ARGS{{"host", host, String}}, 1, &res);
|
||||
if (res) {
|
||||
dmuci_set_varstate_value("cwmp", "@pingtest[0]", "DiagnosticState", "Complete");
|
||||
min=dmjson_get_value(res, 1, "min");
|
||||
if(min!=NULL && strlen(min)>0)
|
||||
dmuci_set_varstate_value("cwmp", "@pingtest[0]", "Minimum", min);
|
||||
avg=dmjson_get_value(res, 1, "avg");
|
||||
if(avg!=NULL && strlen(avg)>0)
|
||||
dmuci_set_varstate_value("cwmp", "@pingtest[0]", "Average", avg);
|
||||
max=dmjson_get_value(res, 1, "max");
|
||||
if(max!=NULL && strlen(max)>0)
|
||||
dmuci_set_varstate_value("cwmp", "@pingtest[0]", "Maximum", max);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline char *pingtest_get(char *option, char *def)
|
||||
{
|
||||
char *tmp;
|
||||
dmuci_get_varstate_string("cwmp", "@pingtest[0]", option, &tmp);
|
||||
if(tmp && tmp[0] == '\0')
|
||||
return dmstrdup(def);
|
||||
else
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = pingtest_get("DiagnosticState", "None");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *tmp;
|
||||
struct uci_section *curr_section = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
break;
|
||||
case VALUESET:
|
||||
if (strcmp(value, "Requested") == 0) {
|
||||
curr_section = dmuci_walk_state_section("cwmp", "pingtest", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
|
||||
if(!curr_section)
|
||||
{
|
||||
dmuci_add_state_section("cwmp", "pingtest", &curr_section, &tmp);
|
||||
}
|
||||
dmuci_set_varstate_value("cwmp", "@pingtest[0]", "DiagnosticState", value);
|
||||
execute_pingtest();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = pingtest_get("Host", "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *tmp;
|
||||
struct uci_section *curr_section = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
break;
|
||||
case VALUESET:
|
||||
curr_section = dmuci_walk_state_section("cwmp", "pingtest", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
|
||||
if(!curr_section)
|
||||
{
|
||||
dmuci_add_state_section("cwmp", "pingtest", &curr_section, &tmp);
|
||||
}
|
||||
dmuci_set_varstate_value("cwmp", "@pingtest[0]", "Host", value);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_MinimumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = pingtest_get("Minimum", "0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_AverageResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = pingtest_get("Average", "0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_MaximumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = pingtest_get("Maximum", "0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_DeviceInfoSupportedDataModel_URL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmjson_get_value((json_object *)data, 1, "url");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_DeviceInfoSupportedDataModel_URN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmjson_get_value((json_object *)data, 1, "urn");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_DeviceInfoSupportedDataModel_Features(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmjson_get_value((json_object *)data, 1, "features");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getdynamic_DeviceX_IOPSYS_EU_Processor_Architecture(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmjson_get_value((json_object *)data, 1, "model");
|
||||
if (strcasestr(*value, "arm"))
|
||||
*value = "arm";
|
||||
else if(strcasestr(*value,"mips"))
|
||||
*value = "mips";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* OPERATE
|
||||
/*************************************************************/
|
||||
opr_ret_t dynamicDevicePingOperate(struct dmctx *dmctx, char *path, char *input)
|
||||
{
|
||||
json_object *ubus_res = NULL, *json_res = NULL;
|
||||
|
||||
json_res = json_tokener_parse((const char *)input);
|
||||
char *host = dmjson_get_value(json_res, 1, "host");
|
||||
if(host[0] == '\0')
|
||||
return UBUS_INVALID_ARGUMENTS;
|
||||
|
||||
dmubus_call("device", "ping", UBUS_ARGS{{"host", host, String}}, 1, &ubus_res);
|
||||
if (ubus_res) {
|
||||
char *param_min = dmjson_get_value(ubus_res, 1, "min");
|
||||
char *param_avg = dmjson_get_value(ubus_res, 1, "avg");
|
||||
char *param_max = dmjson_get_value(ubus_res, 1, "max");
|
||||
|
||||
add_list_paramameter(dmctx, dmstrdup("MinimumResponseTime"), param_min, "string", NULL, 0);
|
||||
add_list_paramameter(dmctx, dmstrdup("AverageResponseTime"), param_avg, "string", NULL, 0);
|
||||
add_list_paramameter(dmctx, dmstrdup("MaximumResponseTime"), param_max, "string", NULL, 0);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
opr_ret_t dynamicDeviceRebootOperate(struct dmctx *dmctx, char *path, char *input)
|
||||
{
|
||||
if(0 == dmubus_call_set("system", "reboot", UBUS_ARGS{}, 0))
|
||||
return SUCCESS;
|
||||
else
|
||||
return FAIL;
|
||||
}
|
||||
40
bbfdetest/src/libbbfdetest.h
Normal file
40
bbfdetest/src/libbbfdetest.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#ifndef __LIBBBFDETEST_H
|
||||
#define __LIBBBFDETEST_H
|
||||
|
||||
DMOBJ tdynamicIPDiagnosticsObj[];
|
||||
DMLEAF tdynamicIPDiagnosticsX_IOPSYS_EU_PingTestParams[];
|
||||
DMOBJ tdynamicDeviceInfobj[];
|
||||
DMLEAF tdynamicDeviceInfoSupportedDataModelTestParams[];
|
||||
DMOBJ tdynamicDeviceObj[];
|
||||
DMLEAF tdynamicDeviceX_IOPSYS_EU_ProcessorParams[];
|
||||
|
||||
int browseDeviceInfoSupportedDataModelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
|
||||
int browseDeviceX_IOPSYS_EU_ProcessorInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
|
||||
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int setdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int setdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_MinimumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_AverageResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int getdynamic_IPDiagnosticsX_IOPSYS_EU_PingTest_MaximumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int getdynamic_DeviceInfoSupportedDataModel_URL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int getdynamic_DeviceInfoSupportedDataModel_URN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int getdynamic_DeviceInfoSupportedDataModel_Features(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int getdynamic_DeviceX_IOPSYS_EU_Processor_Architecture(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
|
||||
opr_ret_t dynamicDevicePingOperate(struct dmctx *dmctx, char *path, char *input);
|
||||
opr_ret_t dynamicDeviceRebootOperate(struct dmctx *dmctx, char *path, char *input);
|
||||
|
||||
#endif //__LIBBBFDETEST_H
|
||||
|
||||
@@ -6,14 +6,13 @@ send_log()
|
||||
{
|
||||
nr=$(db get hw.board.serialNumber)
|
||||
hw=$(db get hw.board.hardware)
|
||||
hwv=$(db get hw.board.hardwareVersion)
|
||||
bid=$(db get hw.board.boardId)
|
||||
fam=$(db get hw.board.iopVerFam)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
server=$(/sbin/uci get system.crashlog.server)
|
||||
|
||||
while true
|
||||
do
|
||||
scp -S /usr/sbin/logssh /proc/last_kmsg log@${server}:log/${bid}_${hwv}_${hw}_${sw}_${nr}
|
||||
scp -S /usr/sbin/logssh /proc/last_kmsg log@${server}:log/${fam}_${hw}_${sw}_${nr}
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
break;
|
||||
|
||||
@@ -52,10 +52,9 @@ cat >/dev/null
|
||||
|
||||
nr=$(db get hw.board.serialNumber)
|
||||
hw=$(db get hw.board.hardware)
|
||||
hwv=$(db get hw.board.hardwareVersion)
|
||||
bid=$(db get hw.board.boardId)
|
||||
fam=$(hw.board.iopVerFam)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
|
||||
scp -S /usr/sbin/logssh $TMP_CORE log@${server}:log/core_${1}_${2}_${bid}_${hwv}_${hw}_${sw}_${nr}
|
||||
scp -S /usr/sbin/logssh $TMP_CORE log@${server}:log/core_${1}_${2}_${fam}_${hw}_${sw}_${nr}
|
||||
rm $TMP_CORE
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ define Package/dectmngr2
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Dectmngr2
|
||||
URL:=
|
||||
DEPENDS:= +natalie-dect-h bcmkernel +libubox +ubus +libpicoevent
|
||||
DEPENDS:= +natalie-dect-h @+PACKAGE_bcmkernel:bcmkernel @+PACKAGE_bcmopen:bcmopen @(PACKAGE_bcmkernel||PACKAGE_bcmopen) +libubox +ubus +libpicoevent endptmngr
|
||||
endef
|
||||
|
||||
define Package/dectmngr2/description
|
||||
|
||||
@@ -45,7 +45,7 @@ define Package/dslmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=XDSL status and configration utility
|
||||
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +easy-soc-libs
|
||||
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/dslmngr/description
|
||||
|
||||
@@ -4,6 +4,7 @@ START=99
|
||||
USE_PROCD=1
|
||||
|
||||
RULE_LIST="/tmp/easy_qos_rule.list"
|
||||
CLIENT_LIST="/tmp/easy_qos_class_client.list"
|
||||
BRIDGE_INTF=""
|
||||
|
||||
[ -f /etc/profile.d/intel.sh ] && {
|
||||
@@ -16,6 +17,13 @@ log() {
|
||||
}
|
||||
|
||||
exec_log() {
|
||||
${@}
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
fi
|
||||
}
|
||||
|
||||
exec_class_log() {
|
||||
${@} |grep -i successful
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
@@ -46,6 +54,114 @@ get_priority() {
|
||||
esac
|
||||
}
|
||||
|
||||
get_mark() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo "0x41/0x3df";;
|
||||
"low")
|
||||
echo "0x82/0x3df";;
|
||||
"besteffort")
|
||||
echo "0xc3/0x3df";;
|
||||
"normal")
|
||||
echo "0x104/0x3df";;
|
||||
"video")
|
||||
echo "0x145/0x3df";;
|
||||
"medium")
|
||||
echo "0x186/0x3df";;
|
||||
"high")
|
||||
echo "0x1c7/0x3df";;
|
||||
"highest")
|
||||
echo "0x208/0x3df";;
|
||||
esac
|
||||
}
|
||||
|
||||
clean_client_entries() {
|
||||
[ -f ${CLIENT_LIST} ] && rm ${CLIENT_LIST}
|
||||
}
|
||||
|
||||
map_client_entries() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(ubus call router.network 'clients')"
|
||||
json_get_keys keys
|
||||
|
||||
for key in ${keys};
|
||||
do
|
||||
json_select ${key}
|
||||
json_get_vars ipaddr macaddr hostname
|
||||
clients="${macaddr} ${ipaddr} ${hostname};${clients}"
|
||||
json_select ..
|
||||
done
|
||||
|
||||
json_init
|
||||
|
||||
IFS=";"
|
||||
for client in ${clients};
|
||||
do
|
||||
macaddr=$(echo ${client} | cut -d" " -f1)
|
||||
json_add_object "${macaddr//:/_}"
|
||||
json_add_string "ip" "$(echo ${client} | cut -d" " -f2)"
|
||||
json_add_string "macaddr" "$(echo ${client} | cut -d" " -f1)"
|
||||
json_add_string "host" "$(echo ${client} | cut -d" " -f3)"
|
||||
json_close_object
|
||||
done
|
||||
|
||||
IFS=' '
|
||||
echo `json_dump` > ${CLIENT_LIST}
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
# Find the IP of a corresponding mac from arp table
|
||||
get_ipaddress() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(cat ${CLIENT_LIST})"
|
||||
json_get_keys keys
|
||||
|
||||
# jshn seems a bit iffy on having : in key, replace by _
|
||||
json_select "${1//:/_}" 2 > /dev/null
|
||||
json_get_var ip ip
|
||||
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
check_and_create() {
|
||||
iptables -t mangle -C PREROUTING ${@} 2>/dev/null
|
||||
# Create rule if not exists
|
||||
if [ ${?} -ne 0 ]; then
|
||||
exec_log iptables -t mangle -A PREROUTING ${@}
|
||||
else
|
||||
log "Rule exists for ${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
create_ip_rule() {
|
||||
local proto=$1; shift
|
||||
local src_ip=$1; shift
|
||||
local mark=$1; shift
|
||||
local ports=$1;
|
||||
local cmd="";
|
||||
|
||||
cmd="-j EXTMARK --set-mark ${mark}";
|
||||
if [ "${proto}" != "icmp" ]; then
|
||||
if [ -n "${ports}" ]; then
|
||||
cmd="--match multiport --dports ${ports} ${cmd}";
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${proto}" == "icmp" ]; then
|
||||
cmd="-p icmp -m icmp --icmp-type 8 $cmd"
|
||||
elif [ "${proto}" == "all" ]; then
|
||||
cmd="-p all $cmd"
|
||||
else
|
||||
cmd="-p ${proto} -m ${proto} $cmd"
|
||||
fi
|
||||
cmd="-s ${src_ip} $cmd"
|
||||
|
||||
check_and_create ${cmd}
|
||||
}
|
||||
|
||||
is_lan_bridge() {
|
||||
local _section=$1
|
||||
local _type
|
||||
@@ -67,10 +183,10 @@ get_bridge_interface() {
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section easy_qos rule "${1}" \
|
||||
'priority:string:none' \
|
||||
'macaddr:string:none' \
|
||||
'priority:string' \
|
||||
'macaddr:string' \
|
||||
'proto:string:none' \
|
||||
'port:list(uinteger):none' \
|
||||
'port:list(uinteger)' \
|
||||
'comment:string:none'
|
||||
}
|
||||
|
||||
@@ -82,8 +198,14 @@ clear_existing_rules() {
|
||||
while read line
|
||||
do
|
||||
log "Deleting old classification rules"
|
||||
exec_log classcfg -D ${line} -i ${BRIDGE_INTF}
|
||||
exec_class_log classcfg -D ${line} -i ${BRIDGE_INTF}
|
||||
done <${RULE_LIST}
|
||||
|
||||
local rule=$(iptables -t mangle -S PREROUTING|grep -m 1 EXTMARK |sed 's/-A/-D/1')
|
||||
while [ -n "${rule}" ]; do
|
||||
exec_log iptables -t mangle ${rule}
|
||||
rule=$(iptables -t mangle -S PREROUTING|grep -m 1 EXTMARK |sed 's/-A/-D/1')
|
||||
done
|
||||
sync
|
||||
|
||||
[ -f ${RULE_LIST} ] && rm ${RULE_LIST}
|
||||
@@ -104,13 +226,16 @@ create_rule() {
|
||||
if [ "${mac_addr}" != "none" ]; then
|
||||
cmd="--smac ${mac_addr} ${cmd}";
|
||||
fi
|
||||
if [ "${ports}" != "none" ]; then
|
||||
IFS=","
|
||||
for port in ${ports};
|
||||
do
|
||||
cmd="--dport ${port}:${port} ${cmd}";
|
||||
done
|
||||
IFS=' '
|
||||
|
||||
if [ "${proto}" != "icmp" ]; then
|
||||
if [ "${ports}" != "none" ]; then
|
||||
IFS=","
|
||||
for port in ${ports};
|
||||
do
|
||||
cmd="--dport ${port}:${port} ${cmd}";
|
||||
done
|
||||
IFS=' '
|
||||
fi
|
||||
fi
|
||||
if [ "${proto}" != "none" ]; then
|
||||
cmd="-p ${proto} $cmd"
|
||||
@@ -119,14 +244,14 @@ create_rule() {
|
||||
cmd="-A ${rule_name} $cmd"
|
||||
|
||||
# Store the rule_names for cleanup on reload
|
||||
exec_log classcfg ${cmd}
|
||||
exec_class_log classcfg ${cmd}
|
||||
[ $? -eq 0 ] && \
|
||||
echo ${rule_name} >> ${RULE_LIST}
|
||||
}
|
||||
|
||||
manage_rule() {
|
||||
local cfg="$1"
|
||||
local priority macaddr proto port comment prio_num port_list
|
||||
local priority macaddr proto port comment prio_num port_list ip ipmark
|
||||
|
||||
validate_rule_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
@@ -135,22 +260,33 @@ manage_rule() {
|
||||
|
||||
prio_num=$(get_priority ${priority})
|
||||
port_list=$(echo ${port}|sed 's/ /,/g')
|
||||
ipmark=$(get_mark ${priority})
|
||||
ip=$(get_ipaddress ${macaddr})
|
||||
|
||||
if [ -n "${prio_num}" ]; then
|
||||
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
|
||||
create_rule tcp ${macaddr} ${prio_num} ${port_list}
|
||||
create_rule udp ${macaddr} ${prio_num} ${port_list}
|
||||
if [ -n "${ip}" ]; then
|
||||
create_ip_rule tcp ${ip} ${ipmark} ${port_list}
|
||||
create_ip_rule udp ${ip} ${ipmark} ${port_list}
|
||||
fi
|
||||
else
|
||||
create_rule ${proto} ${macaddr} ${prio_num} ${port_list}
|
||||
if [ -n "${ip}" ]; then
|
||||
create_ip_rule ${proto} ${ip} ${ipmark} ${port_list}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
get_bridge_interface
|
||||
map_client_entries
|
||||
clear_existing_rules
|
||||
config_load easy_qos
|
||||
config_foreach manage_rule rule
|
||||
clean_client_entries
|
||||
}
|
||||
|
||||
start_service() {
|
||||
|
||||
@@ -103,18 +103,18 @@ validate_rule_section()
|
||||
|
||||
# Clear existing rules before applying new rules
|
||||
clear_existing_rules() {
|
||||
local rule=$(iptables -t mangle -S OUTPUT|grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
local rule=$(iptables -t mangle -S PREROUTING | grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
while [ -n "${rule}" ]; do
|
||||
exec_log iptables -t mangle ${rule}
|
||||
rule=$(iptables -t mangle -S OUTPUT|grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
rule=$(iptables -t mangle -S PREROUTING | grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
done
|
||||
}
|
||||
|
||||
check_and_create() {
|
||||
iptables -t mangle -C OUTPUT ${@} 2>/dev/null
|
||||
iptables -t mangle -C PREROUTING ${@} 2>/dev/null
|
||||
# Create rule if not exists
|
||||
if [ ${?} -ne 0 ]; then
|
||||
exec_log iptables -t mangle -A OUTPUT ${@}
|
||||
exec_log iptables -t mangle -A PREROUTING ${@}
|
||||
else
|
||||
log "Rule exists for ${@}"
|
||||
fi
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
if (PACKAGE_libwifix)
|
||||
menu "configurations"
|
||||
|
||||
config LIBWIFIX_DEBUG
|
||||
depends on PACKAGE_libwifix
|
||||
bool "Enable wifi debugging"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
endif
|
||||
@@ -1,111 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs.deprecated
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b88afddd2f4cb216bfcd190f9096c138299c28e2
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/easy-soc-libs.deprecated
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IOPSYS easy SoC libraries (deprecated)
|
||||
SUBMENU:=IOPSYS easy SoC libraries (deprecated)
|
||||
DEPENDS:=+libopenssl
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/libwifix/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/libwifix
|
||||
$(call Package/easy-soc-libs.deprecated)
|
||||
TITLE:= WiFi library for wifix (deprecated)
|
||||
DEPENDS+=+libnl +libnl-route
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
KERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
TARGET_CFLAGS +=-DIOPSYS_MEDIATEK
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
TARGET_PLATFORM=MARVELL
|
||||
TARGET_CFLAGS +=-DIOPSYS_MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
TARGET_PLATFORM=INTEL
|
||||
TARGET_CFLAGS +=-DIOPSYS_INTEL
|
||||
else ifeq ($(CONFIG_TARGET_ipq),y)
|
||||
TARGET_PLATFORM=QCA
|
||||
TARGET_CFLAGS +=-DIOPSYS_QCA
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET)
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
|
||||
ifdef CONFIG_LIBWIFIX_DEBUG
|
||||
TARGET_CFLAGS += -DIOP_LLA_LIBS_DEBUG
|
||||
endif
|
||||
|
||||
subdirs := \
|
||||
$(if $(CONFIG_PACKAGE_libwifix),libwifix)
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/openssl \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall -I./" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)" \
|
||||
PLATFORM="$(TARGET_PLATFORM)" \
|
||||
subdirs="$(subdirs)"
|
||||
|
||||
define Build/InstallDev/libwifix
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifix/wifi.h $(1)/usr/include/wifix.h
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifix/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||
endef
|
||||
|
||||
define Package/libwifix/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifix/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libwifix))
|
||||
@@ -2,18 +2,18 @@
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=2.4.1
|
||||
PKG_VERSION:=2.5.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=1b6234d2dad694ace8af50956cd66f1c96f2255f
|
||||
PKG_SOURCE_VERSION:=6bf3911521b6c9072c20798c59390280afd0f16f
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
@@ -162,3 +162,4 @@ endef
|
||||
$(eval $(call BuildPackage,libwifi))
|
||||
$(eval $(call BuildPackage,libdsl))
|
||||
$(eval $(call BuildPackage,libethernet))
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=0.2
|
||||
PKG_SOURCE_VERSION:=ef49d57c3824df4dfb4921d39461e2bd14f918a7
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
ifeq ($(CONFIG_ENDPT_OPEN),y)
|
||||
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
@@ -22,16 +23,13 @@ PKG_SOURCE_URL:=git@dev.iopsys.eu:iopsys/endptmngr
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_NAME:=endptmngr
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
endif
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +43,7 @@ define Package/endptmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Brcmslic
|
||||
URL:=
|
||||
DEPENDS:= +libubox +ubus +libpicoevent +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen
|
||||
DEPENDS:= +libubox +ubus +libpicoevent @+PACKAGE_bcmkernel:bcmkernel @+PACKAGE_bcmopen:bcmopen @(PACKAGE_bcmkernel||PACKAGE_bcmopen) @TARGET_HAS_VOICE
|
||||
endef
|
||||
|
||||
define Package/endptmngr/description
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=4.0-2019-10-01
|
||||
PKG_VERSION:=4.0-2019-12-28
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ed781436f96f2dc3cf58b35adc640c6f9f6783d1
|
||||
PKG_SOURCE_VERSION:=b3c9b384ccf9d48a9b4dac953586f5230cfd6fc2
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
@@ -33,45 +33,52 @@ CWMP_REVISION=$(shell svnversion ./src/ -n|cut -f2 -d:)
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/icwmp_stun
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 stun Client
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libopenssl +libblobmsg-json
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 stun Client
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libopenssl +libblobmsg-json
|
||||
endef
|
||||
|
||||
define Package/icwmp_xmpp
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 xmpp feature
|
||||
DEPENDS:=+libuci +libubox +libexpat +libstrophe
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 xmpp feature
|
||||
DEPENDS:=+libuci +libubox +libexpat +libstrophe
|
||||
endef
|
||||
|
||||
define Package/icwmp_twamp
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 twamp feature
|
||||
DEPENDS:=+libuci
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 twamp feature
|
||||
DEPENDS:=+libuci
|
||||
endef
|
||||
|
||||
define Package/icwmp_udpechoserver
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 udpechoserver feature
|
||||
DEPENDS:=+libuci
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 udpechoserver feature
|
||||
DEPENDS:=+libuci
|
||||
endef
|
||||
|
||||
define Package/icwmp_bulkdata
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 BulkData Collection
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +curl +libblobmsg-json +libbbfdm
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-069 BulkData Collection
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +curl +libblobmsg-json +libbbfdm
|
||||
endef
|
||||
|
||||
define Package/icwmp-tr098
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CWMP client for TR-098 Data Model
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +curl +libcurl +libtr098
|
||||
endef
|
||||
|
||||
define Package/icwmp/Default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CWMP client
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +curl +libbbfdm +(PACKAGE_libtr098):libtr098
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +curl +libbbfdm
|
||||
endef
|
||||
|
||||
define Package/icwmp/description
|
||||
@@ -103,13 +110,14 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_CFLAGS += -DEX400
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE -D_AADJ
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_icwmp-tr098),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-icwmp_tr098
|
||||
endif
|
||||
|
||||
ifneq ($(CWMP_REVISION)_,_)
|
||||
ifneq ($(CWMP_REVISION),exported)
|
||||
ifneq ($(CWMP_REVISION),Unversioned directory)
|
||||
@@ -158,28 +166,17 @@ CONFIGURE_ARGS += \
|
||||
--enable-devel
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_libtr098),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr098
|
||||
endif
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr181
|
||||
|
||||
define Package/icwmp-$(BUILD_VARIANT)/install
|
||||
$(INSTALL_DIR) $(1)/etc/icwmpd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/icwmpd $(1)/usr/sbin
|
||||
ifeq ($(CONFIG_PACKAGE_libtr098),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/icwmp_tr098d $(1)/usr/sbin
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmpd.init $(1)/etc/init.d/icwmpd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/90-cwmpfirewall
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
ifeq ($(CONFIG_CWMP_SCRIPTS_FULL),y)
|
||||
$(INSTALL_DIR) $(1)/usr/share/icwmp
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/defaults $(1)/usr/share/icwmp
|
||||
@@ -190,6 +187,11 @@ endif
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
define Package/icwmp-tr098/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/icwmp_tr098d $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
define Package/icwmp_stun/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_stund $(1)/usr/sbin/icwmp_stund
|
||||
@@ -261,4 +263,5 @@ $(eval $(call BuildPackage,icwmp_xmpp))
|
||||
$(eval $(call BuildPackage,icwmp_udpechoserver))
|
||||
$(eval $(call BuildPackage,icwmp_twamp))
|
||||
$(eval $(call BuildPackage,icwmp_bulkdata))
|
||||
$(eval $(call BuildPackage,icwmp-zstream))
|
||||
$(eval $(call BuildPackage,icwmp-tr098))
|
||||
#$(eval $(call BuildPackage,icwmp-zstream))
|
||||
|
||||
55
ieee1905/Makefile
Normal file
55
ieee1905/Makefile
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# Copyright (C) 2019 Iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=1.1.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5f3cdad5c0ee41464b5699565e0175611dc9d070
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ieee1905
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IEEE1905 handler
|
||||
DEPENDS:= +ubox +libpicoevent +libpcap +libopenssl +libuci +libjson-c
|
||||
endef
|
||||
|
||||
define Package/ieee1905/description
|
||||
IEEE1905 stack with extended functionalities.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-D_GNU_SOURCE \
|
||||
-DSEND_EMPTY_TLVS \
|
||||
-DFIX_BROKEN_TLVS \
|
||||
-DSPEED_UP_DISCOVERY \
|
||||
-DREGISTER_MULTIAP_FEATURE \
|
||||
-DDO_NOT_ACCEPT_UNAUTHENTICATED_COMMANDS
|
||||
#-DREGISTER_EXTENSION_BBF
|
||||
|
||||
#define Build/Prepare
|
||||
# $(CP) -rf ./ieee1905/* $(PKG_BUILD_DIR)/
|
||||
#endef
|
||||
|
||||
define Package/ieee1905/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/etc/init.d/ieee1905 $(1)/etc/init.d/ieee1905
|
||||
$(INSTALL_DATA) ./files/etc/config/ieee1905 $(1)/etc/config/ieee1905
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ieee1905d $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libs/*.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ieee1905))
|
||||
43
ieee1905/files/etc/config/ieee1905
Normal file
43
ieee1905/files/etc/config/ieee1905
Normal file
@@ -0,0 +1,43 @@
|
||||
config ieee1905
|
||||
option enabled '1'
|
||||
option debug true
|
||||
|
||||
config meshcomms 'global'
|
||||
option enabled '1'
|
||||
option basemacint 'wan'
|
||||
option mapall true
|
||||
# option registrar 'wl0'
|
||||
option debug_level 2
|
||||
option port 8888
|
||||
option cmdu_event false
|
||||
option discovery_timer 300
|
||||
|
||||
#config al-iface
|
||||
# option enabled '1'
|
||||
# option ifname 'br-lan'
|
||||
# option media '802_3U'
|
||||
# option manufacturer_name 'Broadcom'
|
||||
# option model_name 'Eth EG400'
|
||||
# option model_number '00002'
|
||||
# option device_name 'EG400R1'
|
||||
# option serial_number '1234'
|
||||
|
||||
#config al-iface
|
||||
# option enabled '1'
|
||||
# option ifname 'wl0'
|
||||
# option media '802_11N5'
|
||||
# option manufacturer_name 'Broadcom'
|
||||
# option model_name 'WIFI EG400'
|
||||
# option model_number '00001'
|
||||
# option device_name 'EG400R1'
|
||||
# option serial_number '1235'
|
||||
|
||||
#config al-iface
|
||||
# option enabled '1'
|
||||
# option ifname 'wl1'
|
||||
# option media '802_11N2'
|
||||
# option manufacturer_name 'Broadcom'
|
||||
# option model_name 'WIFI EG400'
|
||||
# option model_number '00001'
|
||||
# option device_name 'EG400R1'
|
||||
# option serial_number '1236'
|
||||
211
ieee1905/files/etc/init.d/ieee1905
Normal file
211
ieee1905/files/etc/init.d/ieee1905
Normal file
@@ -0,0 +1,211 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/ieee1905d
|
||||
MESH_CONF=/tmp/meshcomms.config
|
||||
INTERFACE=""
|
||||
|
||||
validate_global_section()
|
||||
{
|
||||
uci_validate_section ieee1905 meshcomms "${1}" \
|
||||
'enabled:bool:false' \
|
||||
'basemacint:string:wan' \
|
||||
'almac:string' \
|
||||
'registrar:string' \
|
||||
'mapall:bool:true' \
|
||||
'debug_level:uinteger:5' \
|
||||
'port:port:8888' \
|
||||
'cmdu_event:bool:true' \
|
||||
'discovery_timer:uinteger:60'
|
||||
}
|
||||
|
||||
validate_ieee1905_section()
|
||||
{
|
||||
uci_validate_section ieee1905 ieee1905 "${1}" \
|
||||
'debug:bool:true' \
|
||||
'enabled:bool:true'
|
||||
}
|
||||
|
||||
get_device_name() {
|
||||
local device
|
||||
# Get wan L3 interface
|
||||
ubus list |grep -iq network.interface.${1}
|
||||
if [ "$?" -eq 0 ]; then
|
||||
json_load "$(ubus -t 2 call network.interface.${1} status)"
|
||||
json_get_var device device
|
||||
echo ${device}
|
||||
fi
|
||||
}
|
||||
|
||||
get_interface_mac() {
|
||||
local l3 basemac
|
||||
l3=$(get_device_name ${1})
|
||||
if [ -n ${l3} ]; then
|
||||
json_load "$(ubus -t 2 call network.device status "{\"name\":\"${l3}\"}")"
|
||||
json_get_var basemac macaddr
|
||||
fi
|
||||
local first=0x$(echo $basemac |cut -d : -f 1)
|
||||
local rest=$(echo $basemac |cut -d : -f 2-)
|
||||
# Set local bit
|
||||
first=$((first|2))
|
||||
first=$(printf "%02x" $first)
|
||||
basemac="${first}:${rest}"
|
||||
echo ${basemac}
|
||||
}
|
||||
|
||||
validate_al_section()
|
||||
{
|
||||
uci_validate_section ieee1905 al-iface "${1}" \
|
||||
'enabled:bool:false' \
|
||||
'ifname:string' \
|
||||
'media:string:eth' \
|
||||
'manufacturer_name:string:iopsys' \
|
||||
'model_name:string' \
|
||||
'model_number:string' \
|
||||
'device_name:string' \
|
||||
'serial_number:string'
|
||||
}
|
||||
|
||||
configure_interface()
|
||||
{
|
||||
local ifname media enabled manufacturer_name model_name model_number device_name serial_number
|
||||
validate_al_section ${1} || {
|
||||
echo "Validation of global section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ ${enabled} -eq 0 ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
if [ -z ${INTERFACE} ]; then
|
||||
INTERFACE=${ifname}
|
||||
else
|
||||
INTERFACE="${INTERFACE},${ifname}"
|
||||
fi
|
||||
|
||||
local uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
local ifindex=$(cat /sys/class/net/${ifname}/upper_*/ifindex 2>/dev/null)
|
||||
if [ -z ${ifindex} ]; then
|
||||
ifindex=$(cat /sys/class/net/${ifname}/ifindex)
|
||||
fi
|
||||
|
||||
echo "Interface ${ifname} ifindex |${ifindex}|" >>/dev/console
|
||||
|
||||
json_add_object
|
||||
json_add_string ifname ${ifname}
|
||||
json_add_string media ${media}
|
||||
json_add_string manufacturer_name ${manufacturer_name}
|
||||
json_add_string model_name ${model_name}
|
||||
json_add_string model_number ${model_number}
|
||||
json_add_string device_name ${device_name}
|
||||
json_add_string serial_number ${serial_number}
|
||||
json_add_string uuid ${uuid}
|
||||
json_add_int ifindex ${ifindex}
|
||||
json_close_object
|
||||
}
|
||||
|
||||
configure_meshcomms()
|
||||
{
|
||||
local enabled almac basemacint mapall debug_level port l3device basemac intf registrar cmdu_event discovery_timer
|
||||
|
||||
validate_global_section global || {
|
||||
echo "Validation of global section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ -z ${almac} ]; then
|
||||
basemac=$(get_interface_mac ${basemacint})
|
||||
else
|
||||
basemac=${almac}
|
||||
fi
|
||||
|
||||
|
||||
local fname cname model cUrl
|
||||
fname=$(db get hw.board.boardId)
|
||||
cname=$(db get hw.board.iopVerCustomer)
|
||||
model=$(db get hw.board.routerModel)
|
||||
cUrl="http://192.168.1.1"
|
||||
|
||||
json_init
|
||||
# fill the al-iface info
|
||||
json_add_array al-iface
|
||||
config_foreach configure_interface al-iface
|
||||
json_close_array
|
||||
json_add_object deviceInfo
|
||||
json_add_string friendly_name ${fname}
|
||||
json_add_string manufacturer_name ${cname}
|
||||
json_add_string model ${model}
|
||||
json_add_string control_url ${cUrl}
|
||||
json_close_object
|
||||
json_add_object meshcomms
|
||||
json_add_int enabled ${enabled}
|
||||
json_add_string mac ${basemac}
|
||||
json_add_string interfaces ${INTERFACE}
|
||||
json_add_int map ${mapall}
|
||||
json_add_string registrar ${registrar}
|
||||
json_add_int debug_level ${debug_level}
|
||||
json_add_int port ${port}
|
||||
json_add_int cmdu_event ${cmdu_event}
|
||||
json_add_int discovery_timer ${discovery_timer}
|
||||
json_close_object
|
||||
|
||||
json_dump >${MESH_CONF}
|
||||
|
||||
}
|
||||
|
||||
configure_ieee1905()
|
||||
{
|
||||
local enabled debug
|
||||
|
||||
validate_ieee1905_section ${1} || {
|
||||
echo "Validation of ieee1905 section failed"
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if [ ${debug} -eq 1 ]; then
|
||||
# Forward stdout of the command to logd
|
||||
procd_set_param stdout 1
|
||||
# Same for stderr
|
||||
procd_set_param stderr 1
|
||||
fi
|
||||
|
||||
if [ ${enabled} -ne 1 ]; then
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
|
||||
configure_network() {
|
||||
[ -f ${MESH_CONF} ] && rm ${MESH_CONF}
|
||||
|
||||
ebtables -L FORWARD|grep -iqE "1:80:C2:(0)+:(0)+:13.*-j.*DROP"
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "Applying drop rule to drop pkts forwared by kernel to 1905.1 multicast mac"
|
||||
ebtables -A FORWARD -d 01:80:c2:00:00:13 -j DROP
|
||||
fi
|
||||
|
||||
config_load ieee1905
|
||||
config_foreach configure_ieee1905 ieee1905
|
||||
config_foreach configure_meshcomms meshcomms
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance ieee1905
|
||||
procd_set_param command ${PROG}
|
||||
configure_network
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "network"
|
||||
procd_add_reload_trigger "netmode"
|
||||
}
|
||||
@@ -8,7 +8,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
PKG_NAME:=ifbt
|
||||
PKG_VERSION:=0.2
|
||||
|
||||
PKG_SOURCE_VERSION:=f6edff47b6c0a154ab892301acf767d19ac8ad73
|
||||
PKG_SOURCE_VERSION:=6a279efa5046ace0681a1d0e79592a120f80e171
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ifbt.git
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=inotify-tools
|
||||
PKG_VERSION:=3.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=1df9af4d6cd0f4af4b1b19254bcf056aed4ae395
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rvoicilas/inotify-tools.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/inotify-tools
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Tools to trace filesystem events.
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/inotify-tools/description
|
||||
Tools to trace filesystem events.
|
||||
endef
|
||||
|
||||
define Package/inotify-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0.4.1 $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0 $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywait $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywatch $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,inotify-tools))
|
||||
@@ -1,13 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# is the real root mounted ?
|
||||
if [ ! -f /tmp/inotify_real_root/etc/preinit ]
|
||||
then
|
||||
ubivol=$( cat /proc/cmdline | sed -e "s/.*root=\(ubi:rootfs_.\).*/\1/" )
|
||||
mkdir /tmp/inotify_real_root
|
||||
mount -t ubifs $ubivol /tmp/inotify_real_root
|
||||
fi
|
||||
|
||||
inotifywait -r -m -e modify -e create -e attrib -e delete -e move /tmp/inotify_real_root
|
||||
|
||||
|
||||
13
iop/config
13
iop/config
@@ -123,8 +123,6 @@ CONFIG_PACKAGE_wwan=y
|
||||
CONFIG_PACKAGE_libwifi=y
|
||||
CONFIG_PACKAGE_wifilife=y
|
||||
CONFIG_PACKAGE_wifimngr=y
|
||||
CONFIG_PACKAGE_libwifix=y
|
||||
CONFIG_PACKAGE_wifixd=y
|
||||
CONFIG_PACKAGE_xl2tpd=y
|
||||
CONFIG_PACKAGE_zoneinfo-core=y
|
||||
CONFIG_PACKAGE_zoneinfo-europe=y
|
||||
@@ -185,6 +183,10 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_PUT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_PAM is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_TFTP_DEBUG is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_NTPD is not set
|
||||
CONFIG_BUSYBOX_CONFIG_MOUNTPOINT=y
|
||||
CONFIG_BUSYBOX_CONFIG_RUN_PARTS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_FANCY=y
|
||||
CONFIG_LIBCURL_CRYPTO_AUTH=y
|
||||
# CONFIG_LIBCURL_MBEDTLS is not set
|
||||
CONFIG_LIBCURL_OPENSSL=y
|
||||
@@ -194,5 +196,10 @@ CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
|
||||
CONFIG_KERNEL_DEVTMPFS=y
|
||||
CONFIG_KERNEL_DEVTMPFS_MOUNT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_IP is not set
|
||||
LOCAL_MIRROR="http://download.iopsys.eu/iopsys/mirror/"
|
||||
CONFIG_LOCALMIRROR="http://download.iopsys.eu/iopsys/mirror/"
|
||||
|
||||
# Generation of /etc/banner.
|
||||
CONFIG_IMAGEOPT=y
|
||||
CONFIG_VERSIONOPT=y
|
||||
CONFIG_VERSION_MANUFACTURER="iopsysWrt"
|
||||
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
function cvecheck {
|
||||
CVEDIR="/tmp/cve-indicator/"
|
||||
CVEBIN="${CVEDIR}/bin"
|
||||
REPORTS="reports"
|
||||
mkdir -p $REPORTS
|
||||
|
||||
dpkg -s python3 python3-requests python3-yaml python3-mako python3-six &> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Missing dependencies"
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3 python3-requests python3-yaml python3-mako python3-six
|
||||
|
||||
else
|
||||
echo "Dependecy check passed"
|
||||
fi
|
||||
|
||||
|
||||
if [ -d "$CVEDIR" ]; then
|
||||
### Take action if $DIR exists ###
|
||||
echo "${CVEDIR} exists running cvecheck"
|
||||
else
|
||||
### Control will jump here if $DIR does NOT exists ###
|
||||
echo "Error: cvecheck not found. getting from iopsys repo"
|
||||
git clone git@dev.iopsys.eu:iopsys/cve-indicator.git /tmp/cve-indicator
|
||||
fi
|
||||
CVEGENLIST=`${CVEBIN}/cve-indicator gen-list openwrt bin`
|
||||
CVEGETCVES=`${CVEBIN}/cve-indicator get-cves $CVEGENLIST --api_url http://cve.circl.lu/api/cvefor/`
|
||||
CVEGETRPRT=`${CVEBIN}/cve-indicator gen-rprt $CVEGETCVES`
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
|
||||
register_command "cvecheck" "Generate a CVE report on latest build"
|
||||
@@ -6,13 +6,9 @@ function extract_core {
|
||||
topdir=$(pwd)
|
||||
|
||||
# Paths to packages that should be exported.
|
||||
paths+='package/network/services/dnsmasq '
|
||||
paths+='package/network/config/firewall '
|
||||
paths+='package/network/config/netifd '
|
||||
paths+='package/network/config/qos-scripts '
|
||||
paths+='package/utils/busybox '
|
||||
paths+='package/base-files '
|
||||
paths+='package/system/procd '
|
||||
paths+='package/system/rpcd '
|
||||
paths+='package/network/services/openvpn '
|
||||
|
||||
@@ -24,7 +20,13 @@ function extract_core {
|
||||
echo ""
|
||||
echo "Example: $0 extract_core"
|
||||
echo " -p package/utils/busybox"
|
||||
echo " -r feeds/lede_core"
|
||||
echo " -r feeds/openwrt_core"
|
||||
echo " -b devel"
|
||||
echo ""
|
||||
echo "Extract all default packages:"
|
||||
echo "$0 extract_core"
|
||||
echo " -p default"
|
||||
echo " -r feeds/openwrt_core"
|
||||
echo " -b devel"
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ function feeds_update {
|
||||
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
./scripts/feeds install -f -p lede_core -a
|
||||
./scripts/feeds install -f -p openwrt_core -a
|
||||
fi
|
||||
|
||||
# targets need to be installed explicitly
|
||||
|
||||
@@ -18,7 +18,6 @@ function genconfig {
|
||||
brcm63xx_arm="target/linux/iopsys-brcm63xx-arm"
|
||||
ramips="target/linux/iopsys-ramips"
|
||||
intel_mips="target/linux/intel_mips"
|
||||
qca_ipq="target/linux/ipq"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -91,11 +90,9 @@ function genconfig {
|
||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
||||
[ -e $intel_mips/genconfig ] &&
|
||||
iopsys_intel_mips=$(cd $intel_mips; ./genconfig)
|
||||
[ -e $qca_ipq/genconfig ] &&
|
||||
iopsys_qca_ipq=$(cd $qca_ipq; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in iopsys_brcm63xx_mips iopsys_brcm63xx_arm iopsys_ramips iopsys_intel_mips iopsys_qca_ipq; do
|
||||
for list in iopsys_brcm63xx_mips iopsys_brcm63xx_arm iopsys_ramips iopsys_intel_mips; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -136,14 +133,6 @@ function genconfig {
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_qca_ipq; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq"
|
||||
config_path="$qca_ipq/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
git remote -v | grep -q http || {
|
||||
@@ -318,8 +307,6 @@ function genconfig {
|
||||
echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=y" >> .config
|
||||
device=$(echo $BOARDTYPE | tr a-z A-Z)
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${device}=y" >> .config
|
||||
elif [ "$target" = "ipq" ]; then
|
||||
:
|
||||
else
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
@@ -357,6 +344,8 @@ function genconfig {
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_TAG}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${GIT_TAG}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Pckage source tree override if selected
|
||||
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
|
||||
|
||||
@@ -77,16 +77,15 @@ build_wifilife_consumer() {
|
||||
}
|
||||
|
||||
build_mediatek_kernel() {
|
||||
local mediatek_commit kernel_version kernel
|
||||
local mediatek_commit kernel
|
||||
|
||||
mediatek_commit=$(grep CONFIG_KERNEL_GIT_COMMIT .config | cut -d '=' -f2 | tr -d '"')
|
||||
kernel_version=$(grep KERNEL_PATCHVER target/linux/iopsys-ramips/Makefile | cut -d '=' -f2)
|
||||
kernel=linux-${kernel_version}.*
|
||||
kernel=linux-git*
|
||||
[ -n "$mediatek_commit" ] || return
|
||||
ssh $SERVER "test -f $FPATH/mediatek-kernel-open-$mediatek_commit.tar.gz" && return
|
||||
echo "Building mediatek kernel tarball from kernel commit:"
|
||||
echo $mediatek_commit
|
||||
cd build_dir/target-mipsel_1004kc*/linux-iopsys-ramips*/$kernel
|
||||
cd build_dir/target-mipsel_1004kc*/linux-iopsys-ramips*/linux-git*
|
||||
|
||||
# Save Kconfig files to recreate the same kernel config,
|
||||
# delete everyting else.
|
||||
@@ -119,7 +118,7 @@ function generate_tarballs {
|
||||
git remote -v | grep -q http && return # do not continue if this is an open SDK environment
|
||||
|
||||
target=$(grep CONFIG_TARGET_BOARD .config | cut -d'=' -f2 | tr -d '"')
|
||||
board=$(grep CONFIG_TARGET_IBOARDID .config | cut -d'=' -f2 | tr -d '"')
|
||||
board=$(grep CONFIG_TARGET_FAMILY .config | cut -d'=' -f2 | tr -d '"')
|
||||
profile=$(grep CONFIG_BCM_KERNEL_PROFILE .config | cut -d'=' -f2 | tr -d '"')
|
||||
majver=$(grep CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"' | cut -f1 -d .)
|
||||
minver=$(grep CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"' | cut -f2 -d .)
|
||||
|
||||
35
iop/scripts/licenses_gen.sh
Normal file
35
iop/scripts/licenses_gen.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
function license_report {
|
||||
LICDIR="/tmp/licenses-generator/"
|
||||
LICBIN="${LICDIR}/bin"
|
||||
|
||||
|
||||
dpkg -s python3 python3-requests python3-yaml python3-mako python3-six &> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Missing dependencies"
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3 python3-requests python3-yaml python3-mako python3-six
|
||||
|
||||
else
|
||||
echo "Dependecy check passed"
|
||||
fi
|
||||
|
||||
|
||||
if [ -d "$LICDIR" ]; then
|
||||
### Take action if $DIR exists ###
|
||||
echo "Creating json licences file and html formated report"
|
||||
else
|
||||
### Control will jump here if $DIR does NOT exists ###
|
||||
echo "Error: licenses-generator not found. getting from iopsys repo"
|
||||
git clone git@dev.iopsys.eu:iopsys/licenses-generator.git $LICDIR
|
||||
fi
|
||||
LICGET=`${LICBIN}/licenses-generator gen-License bin/`
|
||||
echo $LICGET
|
||||
${LICBIN}/licenses-generator gen-licrprt $LICGET
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
|
||||
register_command "license_report" "Generate a Licence report on latest build in json format and html under reports"
|
||||
@@ -25,6 +25,7 @@ log_stdout=1 # set to 0 to prevent the log to also print to stdout
|
||||
upd_noreboot=0 # set to 1 if we should not reboot after programming
|
||||
upd_forceimage=0 # set this to force upgrade even if image is for wrong board.
|
||||
upd_forceboot=0 # set this to force upgrade of boot loader
|
||||
upd_keepconfig=0 # set this to keep the current configuration.
|
||||
###############################################################################
|
||||
# import external functions
|
||||
source /lib/upgrade/iopsys.sh
|
||||
@@ -51,25 +52,41 @@ function log {
|
||||
# anyhting it calls as stdout/stderr might no longer exist
|
||||
function finish {
|
||||
|
||||
if [ "$run_cleanup" == "1" ]
|
||||
if [ $run_cleanup -eq 1 ]
|
||||
then
|
||||
|
||||
function_call upd_cleanup
|
||||
run_cleanup=0
|
||||
log ""
|
||||
fi
|
||||
|
||||
if [ "$run_mount_cleanup" == "1" ]
|
||||
if [ $run_mount_cleanup -eq 1 ]
|
||||
then
|
||||
log "Cleaning up after mount"
|
||||
umount_newroot
|
||||
fi
|
||||
# always kill the timeout process, will leave the sleep but that is harmless
|
||||
# as long as the kill will nerver be run.
|
||||
kill $TIMEOUT_PID 2>/dev/null
|
||||
if [ -n "$TIMEOUT_PID" ]; then
|
||||
kill $TIMEOUT_PID 2>/dev/null
|
||||
TIMEOUT_PID=""
|
||||
fi
|
||||
|
||||
lock -u /tmp/iopu.lock
|
||||
}
|
||||
|
||||
function ctrl_c {
|
||||
|
||||
# on ctrl-c we remove the exit handler as it is called directly.
|
||||
trap - EXIT
|
||||
|
||||
# call cleanup function
|
||||
finish
|
||||
|
||||
# do not continue program
|
||||
exit 1
|
||||
}
|
||||
|
||||
function sig_pipe {
|
||||
log_stdout=0 # stdin,stdout,stderr do not exist anymore
|
||||
log "Got sigpipe. Turning of log printing to stdout"
|
||||
@@ -77,7 +94,6 @@ function sig_pipe {
|
||||
|
||||
# if a timout happens terminate
|
||||
function timeout {
|
||||
finish
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -133,6 +149,7 @@ function umount_newroot {
|
||||
umount /tmp/newroot_overlay/rom
|
||||
umount /tmp/newroot_overlay
|
||||
umount /tmp/newroot
|
||||
rmdir /tmp/newroot_overlay /tmp/newroot
|
||||
run_mount_cleanup=0
|
||||
}
|
||||
|
||||
@@ -141,11 +158,23 @@ function usage {
|
||||
echo ""
|
||||
echo "opts:"
|
||||
echo ""
|
||||
echo " -n Do not do the final reboot of the target board"
|
||||
echo " -c Keep configuration"
|
||||
echo " -x Force install even if firmware is not for this board"
|
||||
echo " -b Force install of bootloader regardless of version installed"
|
||||
echo " -r Jump into chroot env of other system"
|
||||
echo " -n Do not do the final reboot of the target board"
|
||||
echo " -c Keep configuration"
|
||||
echo " -x Force install even if firmware is not for this board"
|
||||
echo " -b Force install of bootloader regardless of version installed"
|
||||
echo " -r Jump into chroot env of other system"
|
||||
echo " -C \"command\" Execute command in chroot env of other system"
|
||||
}
|
||||
|
||||
# Execute command in newroot(other system root)
|
||||
function newroot_exec {
|
||||
|
||||
upd_vol=$(get_flashbank_next)
|
||||
mount_newroot
|
||||
(ENV=/sbin/iopu_chroot_env chroot /tmp/newroot_overlay "$@")
|
||||
echo ""
|
||||
umount_newroot
|
||||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -161,10 +190,11 @@ then
|
||||
fi
|
||||
|
||||
trap finish EXIT
|
||||
trap ctrl_c INT
|
||||
trap timeout SIGALRM
|
||||
trap sig_pipe SIGPIPE
|
||||
|
||||
while getopts "nrxbh" opt; do
|
||||
while getopts "nrxbhcC:" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
upd_noreboot=1
|
||||
@@ -175,13 +205,16 @@ while getopts "nrxbh" opt; do
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
c)
|
||||
upd_keepconfig=1
|
||||
;;
|
||||
r)
|
||||
upd_vol=$(get_flashbank_next)
|
||||
mount_newroot
|
||||
(ENV=/sbin/iopu_chroot_env chroot /tmp/newroot_overlay /bin/sh)
|
||||
echo ""
|
||||
umount_newroot
|
||||
exit 0
|
||||
newroot_exec /bin/sh
|
||||
exit
|
||||
;;
|
||||
C)
|
||||
newroot_exec "${OPTARG}"
|
||||
exit
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
@@ -193,8 +226,7 @@ done
|
||||
# put a timeout on this if it takes longer than 120 seconds we should abort
|
||||
# and clean up
|
||||
(
|
||||
sleep 120 # if 2 minutes pass
|
||||
kill -ALRM $$ 2>/dev/null # send it a SIGALRM signal
|
||||
sleep 120 && kill -ALRM $$ 2>/dev/null # send it a SIGALRM signal
|
||||
)&
|
||||
TIMEOUT_PID=$!
|
||||
|
||||
@@ -211,7 +243,7 @@ fi
|
||||
cur_vol=$(get_flashbank_current)
|
||||
upd_vol=$(get_flashbank_next)
|
||||
|
||||
# convert volume name "rootfs_$upd_vol" into ubifs volume id
|
||||
# convert volume name "rootfs_$upd_vol" into ubi volume id
|
||||
upd_ubi_id=$(ubinfo -d 0 -N rootfs_$upd_vol | awk "/Volume ID:/ {print \$3}")
|
||||
log "installing Root Fileystem into UBI volume rootfs_$upd_vol"
|
||||
|
||||
@@ -227,29 +259,32 @@ function_call upd_conf_kernel
|
||||
log "now starting writing data to flash with [ iopupgrade $cmdline -M "$cmdline_match" -u ubi0_$upd_ubi_id ]"
|
||||
run_cleanup=1 # When we start to actually write data there might be some
|
||||
# things that need cleanup if we get an error/crash
|
||||
iopupgrade $cmdline -M "$cmdline_match" -u ubi0_$upd_ubi_id
|
||||
|
||||
# in case of any error we abort
|
||||
if [ $? -ne 0 ]; then
|
||||
log "iopupgrade program Failed"
|
||||
exit 1
|
||||
if ! iopupgrade $cmdline -M "$cmdline_match" -u ubi0_$upd_ubi_id; then
|
||||
log "iopupgrade program Failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Firmware programmed to flash."
|
||||
|
||||
|
||||
log "Transfering configuration to new system."
|
||||
|
||||
# Force upgrade of boot loader
|
||||
[ $upd_forceboot -eq 1 ] && chroot_cmdline="$chroot_cmdline -b"
|
||||
|
||||
if [ $upd_keepconfig -eq 1 ]; then
|
||||
log "Transfering configuration to new system."
|
||||
chroot_cmdline="$chroot_cmdline -c"
|
||||
fi
|
||||
|
||||
mount_newroot
|
||||
chroot /tmp/newroot_overlay /sbin/iopu_chroot $chroot_cmdline
|
||||
if ! chroot /tmp/newroot_overlay /sbin/iopu_chroot $chroot_cmdline; then
|
||||
log "Configuration migration failed!"
|
||||
exit 1
|
||||
fi
|
||||
umount_newroot
|
||||
|
||||
log "Update fully installed."
|
||||
log "New firmware fully installed."
|
||||
run_cleanup=0
|
||||
|
||||
|
||||
# Now make sure that we actually boot the new system on the next reboot
|
||||
upd_finnish
|
||||
|
||||
@@ -271,8 +306,3 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# by functions declared in this script
|
||||
upd_forceboot=0
|
||||
log_stdout=1 # set to 0 to prevent the log to also print to stdout
|
||||
upd_keepconfig=0 # set this to keep the current configuration.
|
||||
|
||||
###############################################################################
|
||||
# import external functions
|
||||
@@ -24,33 +25,36 @@ source /lib/upgrade/iopsys.sh
|
||||
|
||||
# only call function if it exists
|
||||
function_call() {
|
||||
if type "$1" 2>/dev/null >/dev/null
|
||||
then
|
||||
$1 $@
|
||||
fi
|
||||
if [ -n "$1" ] && type "$1" 2>/dev/null >/dev/null
|
||||
then
|
||||
$1 "$@" || exit
|
||||
fi
|
||||
}
|
||||
# Cleanup and error handling functions.
|
||||
function log {
|
||||
TIME=$(date)
|
||||
[ $log_stdout -eq 1 ] && echo "$@"
|
||||
echo "[$TIME] $@" >>/root/upd_log
|
||||
TIME=$(date)
|
||||
[ $log_stdout -eq 1 ] && echo "$@"
|
||||
echo "[$TIME] $@" >>/root/upd_log
|
||||
}
|
||||
|
||||
|
||||
while getopts "hb" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
upd_usage
|
||||
exit 1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
while getopts "hbc" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
upd_usage
|
||||
exit 1
|
||||
;;
|
||||
c)
|
||||
upd_keepconfig=1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# copy old install log over
|
||||
@@ -59,3 +63,9 @@ cp /tmp/oldroot/tmp/upd_log /root/upd_log
|
||||
# Upgrade boot loader if needed.
|
||||
function_call upd_program_boot
|
||||
|
||||
# Let the new upgrade do whatever it needs,
|
||||
# such as configuration migration etc.
|
||||
if [ $upd_keepconfig -eq 1 -a -x /lib/upgrade/post-rootfs-fixup ]; then
|
||||
(/lib/upgrade/post-rootfs-fixup /dev/null /tmp/oldroot) || exit
|
||||
fi
|
||||
|
||||
|
||||
32
json-editor/Makefile
Normal file
32
json-editor/Makefile
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Copyright (C) 2019 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=json-editor
|
||||
PKG_RELEASE:=1.0.0
|
||||
|
||||
PKG_SOURCE_VERSION:=44b32937a062ec4ffc9f7355841dc94ab6efa50f
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=git@dev.iopsys.eu:iopsys/json-editor.git
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/json-editor
|
||||
SECTION:=base
|
||||
CATEGORY:=Libraries
|
||||
DEPENDS:=+libjson-c +libblobmsg-json
|
||||
TITLE:=JSON-editor
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/src/json-editor.h $(1)/usr/include/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libjson-editor.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,json-editor))
|
||||
56
libmicroxml/Makefile
Normal file
56
libmicroxml/Makefile
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (C) 2012-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libmicroxml
|
||||
PKG_VERSION:=2012-06-11
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=git://dev.freecwmp.org/microxml
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=72965423184f24cc0b963d91c2d1863cdb01b6aa
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_LICENSE:=LGPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libmicroxml
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=XML library
|
||||
MAINTAINER:=Luka Perkov <luka@openwrt.org>
|
||||
endef
|
||||
|
||||
define Package/libmicroxml/description
|
||||
A micro sized XML library
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--disable-threads \
|
||||
--enable-static \
|
||||
--enable-shared
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/microxml.h $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libmicroxml.so* $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_BUILD_DIR)/microxml.pc $(1)/usr/lib/pkgconfig
|
||||
endef
|
||||
|
||||
define Package/libmicroxml/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libmicroxml.so* $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libmicroxml))
|
||||
130
libmicroxml/patches/100-fix-memleak.patch
Normal file
130
libmicroxml/patches/100-fix-memleak.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
diff --git a/mxml-file.c b/mxml-file.c
|
||||
index 02eca9d..f10d202 100644
|
||||
--- a/mxml-file.c
|
||||
+++ b/mxml-file.c
|
||||
@@ -363,9 +363,12 @@ mxmlSaveFile(mxml_node_t *node, /* I - Node to write */
|
||||
* Write the node...
|
||||
*/
|
||||
|
||||
- if ((col = mxml_write_node(node, fp, cb, 0, mxml_file_putc, global)) < 0)
|
||||
+ if ((col = mxml_write_node(node, fp, cb, 0, mxml_file_putc, global)) < 0){
|
||||
+ global_free(global);
|
||||
return (-1);
|
||||
-
|
||||
+ }
|
||||
+
|
||||
+ global_free(global);
|
||||
if (col > 0)
|
||||
if (putc('\n', fp) < 0)
|
||||
return (-1);
|
||||
@@ -1448,6 +1451,7 @@ mxml_load_data(
|
||||
if ((buffer = malloc(64)) == NULL)
|
||||
{
|
||||
mxml_error("Unable to allocate string buffer!");
|
||||
+ global_free(global);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -2083,11 +2087,12 @@ mxml_load_data(
|
||||
node->parent ? node->parent->value.element.name : "(null)");
|
||||
|
||||
mxmlDelete(first);
|
||||
-
|
||||
+ global_free(global);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
+ global_free(global);
|
||||
if (parent)
|
||||
return (parent);
|
||||
else
|
||||
@@ -2102,7 +2107,7 @@ error:
|
||||
mxmlDelete(first);
|
||||
|
||||
free(buffer);
|
||||
-
|
||||
+ global_free(global);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
diff --git a/mxml-private.c b/mxml-private.c
|
||||
index 4378ca3..ea6e452 100644
|
||||
--- a/mxml-private.c
|
||||
+++ b/mxml-private.c
|
||||
@@ -41,6 +41,32 @@
|
||||
* This code currently supports AIX, HP-UX, Linux, Mac OS X, Solaris, and
|
||||
* Windows. It might work on the BSDs and IRIX, but I haven't tested that.
|
||||
*/
|
||||
+void *global_mem[16] = {0};
|
||||
+
|
||||
+static void *global_calloc(int x, int size)
|
||||
+{
|
||||
+ int i;
|
||||
+ void *m = calloc(x, size);
|
||||
+ for (i = ((sizeof(global_mem)/sizeof(global_mem[0])) - 1); i > 0; i--) {
|
||||
+ global_mem[i] = global_mem[i-1];
|
||||
+ }
|
||||
+ global_mem[0] = m;
|
||||
+ return m;
|
||||
+}
|
||||
+
|
||||
+void global_free(void *m)
|
||||
+{
|
||||
+ int i;
|
||||
+ if (m == NULL)
|
||||
+ return;
|
||||
+ for (i = ((sizeof(global_mem)/sizeof(global_mem[0])) - 1); i >= 0; i--) {
|
||||
+ if (global_mem[i] == m) {
|
||||
+ global_mem[i] = NULL;
|
||||
+ free(m);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
||||
#if defined(__sun) || defined(_AIX)
|
||||
# pragma fini(_mxml_fini)
|
||||
@@ -148,7 +174,6 @@ mxml_real_cb(mxml_node_t *node) /* I - Current node */
|
||||
return (MXML_REAL);
|
||||
}
|
||||
|
||||
-
|
||||
#ifdef HAVE_PTHREAD_H /**** POSIX threading ****/
|
||||
# include <pthread.h>
|
||||
|
||||
@@ -190,7 +215,6 @@ _MXML_FINI(void)
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* '_mxml_global()' - Get global data.
|
||||
*/
|
||||
@@ -205,7 +229,7 @@ _mxml_global(void)
|
||||
|
||||
if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) == NULL)
|
||||
{
|
||||
- global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t));
|
||||
+ global = (_mxml_global_t *)global_calloc(1, sizeof(_mxml_global_t));
|
||||
pthread_setspecific(_mxml_key, global);
|
||||
|
||||
global->num_entity_cbs = 1;
|
||||
@@ -288,7 +312,7 @@ _mxml_global(void)
|
||||
|
||||
if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) == NULL)
|
||||
{
|
||||
- global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t));
|
||||
+ global = (_mxml_global_t *)global_calloc(1, sizeof(_mxml_global_t));
|
||||
|
||||
global->num_entity_cbs = 1;
|
||||
global->entity_cbs[0] = _mxml_entity_cb;
|
||||
diff --git a/mxml-private.h b/mxml-private.h
|
||||
index c591208..72ed338 100644
|
||||
--- a/mxml-private.h
|
||||
+++ b/mxml-private.h
|
||||
@@ -43,3 +43,4 @@ typedef struct _mxml_global_s
|
||||
extern _mxml_global_t *_mxml_global(void);
|
||||
extern int _mxml_entity_cb(const char *name);
|
||||
|
||||
+extern void global_free(void *m);
|
||||
@@ -14,6 +14,8 @@ PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=7875222706cb6999af0361ef0aebdc85cd75c127
|
||||
PKG_NAME:=libpicoevent
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
|
||||
33
librpc/Makefile
Normal file
33
librpc/Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=librpc
|
||||
PKG_RELEASE=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(LEDE_GIT)/project/librpc-uclibc.git
|
||||
PKG_SOURCE_DATE:=2015-11-04
|
||||
PKG_SOURCE_VERSION:=a921e3ded051746f9f7cd5e5a312fb6771716aac
|
||||
PKG_MIRROR_HASH:=22c8dc55e1c4e8e31635a37708a3ce622a6ca33ebd918a4321b0be6ffce89b21
|
||||
CMAKE_INSTALL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/librpc
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=uClibc RPC library
|
||||
endef
|
||||
|
||||
define Package/librpc/install
|
||||
$(INSTALL_DIR) $(1)/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/librpc.so $(1)/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,librpc))
|
||||
@@ -16,6 +16,8 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mqtt-ciotc
|
||||
|
||||
@@ -16,7 +16,7 @@ PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=9e2236989ff58d0db897f938b6b07b535144e0e2
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE:=PROPRIETARY RTX
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
@@ -12,7 +12,7 @@ PKG_BUILD_DIR:=${BUILD_DIR}/ndt-$(PKG_VERSION)
|
||||
PKG_SOURCE:=ndt-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://software.internet2.edu/sources/ndt
|
||||
|
||||
PKG_LICENSE:=NONSTANDARD
|
||||
PKG_LICENSE:=NONSTANDARD_PERMISSIV
|
||||
PKG_LICENSE_FILES:=COPYRIGHT
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -18,8 +18,8 @@ config interface 'lan'
|
||||
config interface 'wan'
|
||||
option type 'anywan'
|
||||
option proto 'dhcp'
|
||||
option hostname 'iopsys-$MAC'
|
||||
option vendorid '$HARDWAREID'
|
||||
#option hostname AUTO-CREATED AT FIRST BOOT
|
||||
#option vendorid AUTO-CREATED AT FIRST BOOT
|
||||
option ifname 'ptm0.1 atm0.1 $WAN.1'
|
||||
option ipv6 '1'
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ config wifi-iface
|
||||
option device 'wl0'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'iopsys-$BSSID4'
|
||||
#option ssid AUTO-CREATED AT FIRST BOOT
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
#option key AUTO-CREATED AT FIRST BOOT
|
||||
option gtk_rekey '3600'
|
||||
option macfilter 'disable'
|
||||
option wps '1'
|
||||
@@ -78,10 +78,10 @@ config wifi-iface
|
||||
option device 'wl1'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'iopsys-$BSSID4'
|
||||
#option ssid AUTO-CREATED AT FIRST BOOT
|
||||
option encryption 'mixed-psk'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
#option key AUTO-CREATED AT FIRST BOOT
|
||||
option gtk_rekey '3600'
|
||||
option macfilter 'disable'
|
||||
option wps '1'
|
||||
|
||||
@@ -6,21 +6,24 @@ config interface 'loopback'
|
||||
|
||||
config device 'lan_dev'
|
||||
option name 'eth0.1'
|
||||
option macaddr '$MACLAN'
|
||||
# Unused?
|
||||
#option macaddr '$MACLAN'
|
||||
option vid 1
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option ifname 'eth0.2 eth0.1'
|
||||
option proto 'dhcp'
|
||||
option hostname 'iopsys-$MAC'
|
||||
#option hostname AUTO-CREATED AT FIRST BOOT
|
||||
option reqopts '66 67 128 224'
|
||||
option igmp_snooping '0'
|
||||
option macaddr '$MACWAN'
|
||||
# Unused?
|
||||
#option macaddr '$MACWAN'
|
||||
|
||||
config device 'wan_dev'
|
||||
option name 'eth0.2'
|
||||
option macaddr '$MACWAN'
|
||||
# Unused?
|
||||
#option macaddr '$MACWAN'
|
||||
option vid 2
|
||||
|
||||
config interface 'wan6'
|
||||
|
||||
@@ -19,9 +19,9 @@ config wifi-iface
|
||||
option device ra0
|
||||
option network wan
|
||||
option mode ap
|
||||
option ssid iopsys-$BSSID4
|
||||
#option ssid AUTO-CREATED AT FIRST BOOT
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
#option key AUTO-CREATED AT FIRST BOOT
|
||||
option ifname ra0
|
||||
option wps 1
|
||||
|
||||
@@ -38,9 +38,9 @@ config wifi-iface
|
||||
option device rai0
|
||||
option network wan
|
||||
option mode ap
|
||||
option ssid iopsys-$BSSID4
|
||||
#option ssid AUTO-CREATED AT FIRST BOOT
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
#option key AUTO-CREATED AT FIRST BOOT
|
||||
option ifname rai0
|
||||
option wps 1
|
||||
|
||||
@@ -48,8 +48,8 @@ config wifi-iface
|
||||
option device rai0
|
||||
option network wan
|
||||
option mode wet
|
||||
option ssid iopsys-$BSSID4
|
||||
#option ssid AUTO-CREATED AT FIRST BOOT
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
#option key AUTO-CREATED AT FIRST BOOT
|
||||
option ifname apclii0
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ config interface 'lan'
|
||||
config interface 'wan'
|
||||
option type 'anywan'
|
||||
option proto 'dhcp'
|
||||
option hostname 'iopsys-$MAC'
|
||||
option vendorid '$HARDWAREID'
|
||||
#option hostname AUTO-CREATED AT FIRST BOOT
|
||||
#option vendorid AUTO-CREATED AT FIRST BOOT
|
||||
option ifname 'ptm0.1 atm0.1 $WAN.1'
|
||||
option ipv6 '1'
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ config wifi-iface
|
||||
option device 'wl0'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'iopsys-$BSSID4'
|
||||
#option ssid AUTO-CREATED AT FIRST BOOT
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
#option key AUTO-CREATED AT FIRST BOOT
|
||||
option gtk_rekey '3600'
|
||||
option macfilter 'disable'
|
||||
option wps '1'
|
||||
@@ -78,10 +78,10 @@ config wifi-iface
|
||||
option device 'wl1'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'iopsys-$BSSID4'
|
||||
#option ssid AUTO-CREATED AT FIRST BOOT
|
||||
option encryption 'mixed-psk'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
#option key AUTO-CREATED AT FIRST BOOT
|
||||
option gtk_rekey '3600'
|
||||
option macfilter 'disable'
|
||||
option wps '1'
|
||||
|
||||
@@ -15,19 +15,21 @@ config interface 'lan'
|
||||
|
||||
config device 'lan_dev'
|
||||
option name 'eth0.1'
|
||||
option macaddr '$MACLAN'
|
||||
# Unused?
|
||||
#option macaddr '$MACLAN'
|
||||
option vid 1
|
||||
|
||||
config interface 'wan'
|
||||
option ifname 'eth0.2'
|
||||
option proto 'dhcp'
|
||||
option hostname 'iopsys-$MAC'
|
||||
option vendorid '$HARDWAREID'
|
||||
#option hostname AUTO-CREATED AT FIRST BOOT
|
||||
#option vendorid AUTO-CREATED AT FIRST BOOT
|
||||
option reqopts '66 67 128 224'
|
||||
|
||||
config device 'wan_dev'
|
||||
option name 'eth0.2'
|
||||
option macaddr '$MACWAN'
|
||||
# Unused?
|
||||
#option macaddr '$MACWAN'
|
||||
option vid 2
|
||||
|
||||
config interface 'wan6'
|
||||
|
||||
@@ -244,17 +244,16 @@ revert_netmode() {
|
||||
|
||||
ubus call leds set '{"state" : "allflash"}'
|
||||
logger -s -p user.info -t "netmode" "Could not switch to '$from' mode; going back to '$to' mode" > /dev/console
|
||||
cp -af $CONF_BACKUP_DIR/* /etc/config/
|
||||
sync
|
||||
uci -q set netmode.setup.curmode="$to"
|
||||
uci -q set netmode.setup.repeaterready="$rready"
|
||||
uci commit netmode
|
||||
cp -af $CONF_BACKUP_DIR/* /etc/config/
|
||||
sync
|
||||
rm -rf $CONF_BACKUP_DIR
|
||||
rm -rf $OLD_MODE_FILE
|
||||
|
||||
logger -s -p user.info -t "netmode" "Restarting network services" > /dev/console
|
||||
ubus call network reload
|
||||
wifi reload
|
||||
/etc/init.d/network restart
|
||||
ubus call router.network reload
|
||||
ubus call leds set '{"state" : "normal"}'
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_VERSION:=2.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=f362163d5a660a18081ec8665851c8db90d6f238
|
||||
PKG_SOURCE_VERSION:=9c7921c8e39acfc31f563bd08220faba1012a834
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/obuspa.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
@@ -51,7 +51,8 @@ define Package/obuspa/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/obuspa
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/obuspa $(1)/usr/sbin/
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/obuspa $(1)/etc/init.d/
|
||||
$(INSTALL_DATA) ./files/etc/config/obuspa $(1)/etc/config/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,obuspa))
|
||||
|
||||
@@ -1,15 +1,41 @@
|
||||
# controller, mtp, connection makes a group and related to one another
|
||||
# ex: first controller will be mapped to first mtp and first connection
|
||||
# details, always defined in groups
|
||||
|
||||
config obuspa
|
||||
option cert '/etc/obuspa/rootCA.pem'
|
||||
option interface 'wan'
|
||||
option debug 'false'
|
||||
|
||||
config controller
|
||||
option endpointid 'self::usp-controller.com'
|
||||
option enable 'true'
|
||||
# Trust cerificate number
|
||||
option AssignedRole 1
|
||||
option PeriodicNotifInterval "86400"
|
||||
option PeriodicNotifTime "0001-01-01T00:00:00Z"
|
||||
option USPRetryMinimumWaitInterval "5"
|
||||
option USPRetryIntervalMultiplier "2000"
|
||||
option ControllerCode ""
|
||||
option protocol 'STOMP'
|
||||
|
||||
config mtp
|
||||
option enable 'true'
|
||||
option protocol 'STOMP'
|
||||
option destination 'uspq'
|
||||
option destination ''
|
||||
|
||||
config connection
|
||||
option host 'usp-controller.com'
|
||||
option username 'username'
|
||||
option password 'password'
|
||||
option encryption 'false'
|
||||
option interface 'wan'
|
||||
option encryption 'true'
|
||||
option enable 'true'
|
||||
option port 61613
|
||||
option virtualhost '/'
|
||||
option EnableHeartbeats "true"
|
||||
option OutgoingHeartbeat "30000"
|
||||
option IncomingHeartbeat "300000"
|
||||
option ServerRetryInitialInterval "60"
|
||||
option ServerRetryIntervalMultiplier "2000"
|
||||
option ServerRetryMaxInterval "30720"
|
||||
|
||||
|
||||
@@ -5,107 +5,210 @@ USE_PROCD=1
|
||||
|
||||
PROG=/usr/sbin/obuspa
|
||||
l3device=""
|
||||
|
||||
CTRL_PATH="Device.LocalAgent.Controller.1."
|
||||
MTP_PATH="Device.LocalAgent.MTP.1."
|
||||
CONN_PATH="Device.STOMP.Connection.1."
|
||||
certificate=""
|
||||
PARAM_FILE="/tmp/obuspa_param_reset.txt"
|
||||
conn_num=1
|
||||
mtp_num=1
|
||||
stomp_num=1
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t obuspa -p debug
|
||||
}
|
||||
|
||||
db_set() {
|
||||
log "DBSET param|${1}| value|${2}|"
|
||||
${PROG} -c dbset ${1} ${2}
|
||||
if [ -n "${1}" ]; then
|
||||
echo "${1} \"${2}\"">>${PARAM_FILE}
|
||||
else
|
||||
echo >>${PARAM_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
validate_obuspa_section()
|
||||
{
|
||||
uci_validate_section obuspa obuspa "${1}" \
|
||||
'cert:string:"/etc/obuspa/rootCA.pem"' \
|
||||
'interface:string:wan' \
|
||||
'debug:bool:false'
|
||||
}
|
||||
|
||||
validate_controller_section()
|
||||
{
|
||||
uci_validate_section obuspa controller "${1}" \
|
||||
'endpointid:string:"self:usp-controller.com"'
|
||||
'endpointid:string:"self:usp-controller.com"' \
|
||||
'enable:bool:true' \
|
||||
'AssignedRole:uinteger:1' \
|
||||
'PeriodicNotifInterval:uinteger:86400' \
|
||||
'PeriodicNotifTime:string:"0001-01-01T00:00:00Z"' \
|
||||
'USPRetryMinimumWaitInterval:uinteger:5' \
|
||||
'USPRetryIntervalMultiplier:uinteger:2000' \
|
||||
'ControllerCode:string' \
|
||||
'protocol:or("STOMP","CoAP")' \
|
||||
'CoAPHost:string' \
|
||||
'CoAPPath:string' \
|
||||
'CoAPPort:uinteger'
|
||||
}
|
||||
|
||||
validate_mtp_section()
|
||||
{
|
||||
uci_validate_section obuspa mtp "${1}" \
|
||||
'enable:bool:true' \
|
||||
'protocol:string:"STOMP"' \
|
||||
'destination:string:'
|
||||
'protocol:or("STOMP","CoAP")' \
|
||||
'destination:string' \
|
||||
'CoAPPath:string' \
|
||||
'CoAPPort:uinteger'
|
||||
}
|
||||
|
||||
validate_connection_section()
|
||||
{
|
||||
uci_validate_section obuspa connection "${1}" \
|
||||
'host:string:"usp-controller.com"' \
|
||||
'username:string:username' \
|
||||
'password:string:password' \
|
||||
'username:string:""' \
|
||||
'password:string:""' \
|
||||
'encryption:bool:true' \
|
||||
'interface:string:wan'
|
||||
'enable:bool:true' \
|
||||
'port:uinteger:61613' \
|
||||
'virtualhost:string:"/"' \
|
||||
'EnableHeartbeats:bool:true' \
|
||||
'OutgoingHeartbeat:uinteger:30000' \
|
||||
'IncomingHeartbeat:uinteger:300000' \
|
||||
'ServerRetryInitialInterval:uinteger:60' \
|
||||
'ServerRetryIntervalMultiplier:uinteger:2000' \
|
||||
'ServerRetryMaxInterval:uinteger:30720'
|
||||
}
|
||||
|
||||
configure_controller() {
|
||||
local endpointid
|
||||
local endpointid enable AssignedRole PeriodicNotifInterval PeriodicNotifTime USPRetryMinimumWaitInterval
|
||||
local USPRetryIntervalMultiplier ControllerCode protocol CoAPHost CoAPPath CoAPPort
|
||||
|
||||
validate_controller_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
db_set "${CTRL_PATH}EndpointID" ${endpointid}
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.EndpointID "${endpointid}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.Alias "cpe-${conn_num}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.Enable "true"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.AssignedRole "Device.LocalAgent.ControllerTrust.Role.${AssignedRole}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.PeriodicNotifInterval "${PeriodicNotifInterval}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.PeriodicNotifTime "${PeriodicNotifTime}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.USPRetryMinimumWaitInterval "${USPRetryMinimumWaitInterval}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.USPRetryIntervalMultiplier "${USPRetryIntervalMultiplier}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.ControllerCode "${ControllerCode}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.Alias "cpe-${conn_num}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.Enable "${enable}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.Protocol "${protocol}"
|
||||
if [ "${protocol}"=="STOMP" ]; then
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.STOMP.Reference "Device.STOMP.Connection.${conn_num}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.STOMP.Destination "controller-notify-dest"
|
||||
elif [ "${protocol}"=="CoAP" ]; then
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.CoAP.Host "${CoAPHost}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.CoAP.Path "${CoAPPath}"
|
||||
db_set Device.LocalAgent.Controller.${conn_num}.MTP.${conn_num}.CoAP.Port "${CoAPPort}"
|
||||
else
|
||||
log "Unsupported protocol ${protocol}"
|
||||
fi
|
||||
db_set
|
||||
conn_num=$((conn_num+1))
|
||||
}
|
||||
|
||||
configure_mtp() {
|
||||
local protocol enable destination
|
||||
local protocol enable destination CoAPPath CoAPPort
|
||||
|
||||
validate_mtp_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
db_set "${MTP_PATH}Enable" ${enable}
|
||||
db_set "${MTP_PATH}Protocol" ${protocol}
|
||||
db_set "${MTP_PATH}STOMP.Destination" ${destination}
|
||||
db_set Device.LocalAgent.MTP.${mtp_num}.Alias "cpe-${mtp_num}"
|
||||
db_set Device.LocalAgent.MTP.${mtp_num}.Enable "${enable}"
|
||||
db_set Device.LocalAgent.MTP.${mtp_num}.Protocol "${protocol}"
|
||||
if [ "${protocol}"=="STOMP" ]; then
|
||||
db_set Device.LocalAgent.MTP.${mtp_num}.STOMP.Reference "Device.STOMP.Connection.${mtp_num}"
|
||||
db_set Device.LocalAgent.MTP.${mtp_num}.STOMP.Destination "${destination}"
|
||||
elif [ "${protocol}"=="CoAP" ]; then
|
||||
db_set Device.LocalAgent.MTP.${mtp_num}.CoAP.Path "${CoAPPath}"
|
||||
db_set Device.LocalAgent.MTP.${mtp_num}.CoAP.Port "${CoAPPort}"
|
||||
else
|
||||
log "Unsupported protocol ${protocol}"
|
||||
fi
|
||||
db_set
|
||||
mtp_num=$((mtp_num+1))
|
||||
}
|
||||
|
||||
configure_connection() {
|
||||
local host username password encryption interface
|
||||
local host username password encryption enable port virtualhost EnableHeartbeats
|
||||
local OutgoingHeartbeat IncomingHeartbeat ServerRetryInitialInterval
|
||||
local ServerRetryIntervalMultiplier ServerRetryMaxInterval
|
||||
|
||||
validate_connection_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
db_set Device.STOMP.Connection.${stomp_num}.Host "${host}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.Username "${username}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.Password "${password}"
|
||||
|
||||
db_set Device.STOMP.Connection.${stomp_num}.Alias "cpe-${stomp_num}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.Enable "${enable}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.Port "${port}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.X_ARRIS-COM_EnableEncryption "${encryption}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.VirtualHost "${virtualhost}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.EnableHeartbeats "${EnableHeartbeats}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.OutgoingHeartbeat "${OutgoingHeartbeat}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.IncomingHeartbeat "${IncomingHeartbeat}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.ServerRetryInitialInterval "${ServerRetryInitialInterval}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.ServerRetryIntervalMultiplier "${ServerRetryIntervalMultiplier}"
|
||||
db_set Device.STOMP.Connection.${stomp_num}.ServerRetryMaxInterval "${ServerRetryMaxInterval}"
|
||||
db_set
|
||||
stomp_num=$((stomp_num+1))
|
||||
}
|
||||
|
||||
configure_obuspa() {
|
||||
local cert interface debug
|
||||
|
||||
validate_obuspa_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ ${debug} -eq 1 ]; then
|
||||
# Forward stdout of the command to logd
|
||||
procd_set_param stdout 1
|
||||
# Same for stderr
|
||||
procd_set_param stderr 1
|
||||
fi
|
||||
|
||||
# Get wan L3 interface
|
||||
json_load "$(ubus call network.interface.${interface} status)"
|
||||
json_load "$(ubus -t 2 call network.interface.${interface} status)"
|
||||
json_get_var l3device l3_device
|
||||
echo "l3device ${l3device}">/dev/console
|
||||
export USP_BOARD_IFNAME=${l3device}
|
||||
|
||||
# Set this variable for root user
|
||||
echo "export USP_BOARD_IFNAME=${l3device}">/root/.profile
|
||||
|
||||
db_set "${CONN_PATH}Host" ${host}
|
||||
db_set "${CONN_PATH}Username" ${username}
|
||||
db_set "${CONN_PATH}Password" ${password}
|
||||
db_set "${CONN_PATH}X_ARRIS-COM_EnableEncryption" ${encryption}
|
||||
}
|
||||
[ -f $cert ] && certificate=$cert
|
||||
|
||||
}
|
||||
db_init() {
|
||||
[ -f ${PARAM_FILE} ] && rm -f ${PARAM_FILE}
|
||||
[ -f /tmp/usp.db ] && rm -f /tmp/usp.db
|
||||
|
||||
config_load obuspa
|
||||
config_foreach configure_connection connection
|
||||
config_foreach configure_obuspa obuspa
|
||||
config_foreach configure_controller controller
|
||||
config_foreach configure_connection connection
|
||||
config_foreach configure_mtp mtp
|
||||
db_set Internal.Reboot.Cause "LocalFactoryReset"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance obuspa
|
||||
db_init
|
||||
procd_open_instance
|
||||
procd_set_param env USP_BOARD_IFNAME=${l3device}
|
||||
# Forward stdout of the command to logd
|
||||
# procd_set_param stdout 1
|
||||
# Same for stderr
|
||||
# procd_set_param stderr 1
|
||||
procd_set_param command ${PROG}
|
||||
procd_append_param command -p -v 4
|
||||
procd_append_param command -p -v 4 -r ${PARAM_FILE}
|
||||
if [ -f "${certificate}" ]; then
|
||||
procd_append_param command -t ${certificate}
|
||||
fi
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
48
opkgd/Makefile
Executable file
48
opkgd/Makefile
Executable file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Copyright (C) 2019 IOPSYS
|
||||
#
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=opkgd
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=d3da32eca6e50b6be6e846a7f82c8e93c74c45a4
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/opkgd.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/opkgd
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=OPKG ubus backend
|
||||
DEPENDS:=+libuci +libubox +ubus +libuuid
|
||||
endef
|
||||
|
||||
define Package/opkgd/description
|
||||
Ubus based backend for OPKG which can be used by other applications running on top of it.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
define Package/opkgd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/opkgd.init $(1)/etc/init.d/opkgd
|
||||
$(INSTALL_DIR) $(1)/etc/opkg
|
||||
$(INSTALL_CONF) ./files/map_du $(1)/etc/opkg/map_du
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/opkgd $(1)/usr/sbin/opkgd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,opkgd))
|
||||
0
opkgd/files/map_du
Normal file
0
opkgd/files/map_du
Normal file
@@ -1,20 +1,20 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=96
|
||||
START=94
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/wifixd
|
||||
PROG=/usr/sbin/opkgd
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command ${PROG}
|
||||
# procd_set_param env IOP_LLA_LIBS_DEBUG=3 #for debugging only
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/owsd.git
|
||||
PKG_SOURCE_VERSION:=a83448ed65e1c76411b9c6553d64b5d623b8bcd7
|
||||
PKG_SOURCE_VERSION:=1c6efa76a23b9a8236a8f6d3b43349cf1e23655a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=${PKG_NAME}-${PKG_VERSION}
|
||||
PKG_INSTALL:=1
|
||||
|
||||
@@ -39,7 +39,7 @@ define Package/peripheral_manager
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Application deamon for handling of peripheral
|
||||
URL:=
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json @+PACKAGE_bcmkernel:bcmkernel @+PACKAGE_bcmopen:bcmopen
|
||||
endef
|
||||
|
||||
define Package/peripheral_manager/description
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=picolisp
|
||||
PKG_VERSION=3.1.10
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/picoLisp
|
||||
PKG_SOURCE:=picoLisp-$(PKG_VERSION).tgz
|
||||
PKG_SOURCE_URL:=http://software-lab.de/
|
||||
PKG_MD5SUM:=ac19fd6ff4d05dd2b15ea00d1ed591e7
|
||||
|
||||
PKG_BUILD_DEPENDS+= +libopenssl +@OPENSSL_WITH_EC2M
|
||||
|
||||
PKG_LICENSE:=MIT-X11
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/picolisp
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=PicoLisp interpreter
|
||||
DEPENDS:= +libopenssl +@OPENSSL_WITH_EC2M
|
||||
URL:=http://www.picolisp.org/
|
||||
MAINTAINER:=Jeronimo Pellegrini <j_p@aleph0.info>
|
||||
endef
|
||||
|
||||
define Package/picolisp/description
|
||||
Picolisp is yet another dialect of the Lisp language, specially written to be radically practical and simple.
|
||||
endef
|
||||
|
||||
TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
|
||||
# A hack to make picoLisp's Makefile see the include path:
|
||||
MAKE_FLAGS += C_INCLUDE_PATH+=$(STAGING_DIR)/usr/include/
|
||||
|
||||
define Package/picolisp/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib/picolisp/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/picolisp/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/pil $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/psh $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/watchdog $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/picolisp $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/*.l $(1)/usr/lib/picolisp/
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/ht \
|
||||
$(PKG_BUILD_DIR)/lib/ext \
|
||||
$(PKG_BUILD_DIR)/lib/adm.l \
|
||||
$(PKG_BUILD_DIR)/lib/app.l \
|
||||
$(PKG_BUILD_DIR)/lib/boss.l \
|
||||
$(PKG_BUILD_DIR)/lib/btree.l \
|
||||
$(PKG_BUILD_DIR)/lib/conDbgc.l \
|
||||
$(PKG_BUILD_DIR)/lib/db.l \
|
||||
$(PKG_BUILD_DIR)/lib/debug.l \
|
||||
$(PKG_BUILD_DIR)/lib/edit.l \
|
||||
$(PKG_BUILD_DIR)/lib/ed.l \
|
||||
$(PKG_BUILD_DIR)/lib/form.l \
|
||||
$(PKG_BUILD_DIR)/lib/frac.l \
|
||||
$(PKG_BUILD_DIR)/lib/heartbeat.l \
|
||||
$(PKG_BUILD_DIR)/lib/http.l \
|
||||
$(PKG_BUILD_DIR)/lib/import.l \
|
||||
$(PKG_BUILD_DIR)/lib/led.l \
|
||||
$(PKG_BUILD_DIR)/lib/lint.l \
|
||||
$(PKG_BUILD_DIR)/lib/math32.l \
|
||||
$(PKG_BUILD_DIR)/lib/math64.l \
|
||||
$(PKG_BUILD_DIR)/lib/math.l \
|
||||
$(PKG_BUILD_DIR)/lib/misc.l \
|
||||
$(PKG_BUILD_DIR)/lib/pilog.l \
|
||||
$(PKG_BUILD_DIR)/lib/prof.l \
|
||||
$(PKG_BUILD_DIR)/lib/ps.l \
|
||||
$(PKG_BUILD_DIR)/lib/rsa.l \
|
||||
$(PKG_BUILD_DIR)/lib/scrape.l \
|
||||
$(PKG_BUILD_DIR)/lib/simul.l \
|
||||
$(PKG_BUILD_DIR)/lib/sq.l \
|
||||
$(PKG_BUILD_DIR)/lib/too.l \
|
||||
$(PKG_BUILD_DIR)/lib/xhtml.l \
|
||||
$(PKG_BUILD_DIR)/lib/xm.l \
|
||||
$(PKG_BUILD_DIR)/lib/xml.l \
|
||||
$(PKG_BUILD_DIR)/lib/xmlrpc.l $(1)/usr/lib/picolisp/lib/
|
||||
touch $(1)/usr/lib/picolisp/lib/tags
|
||||
$(STRIP) $(1)/usr/bin/picolisp
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,picolisp))
|
||||
@@ -1,43 +0,0 @@
|
||||
diff -Nur picoLisp/Makefile picoLisp-new/Makefile
|
||||
--- picoLisp/Makefile 1969-12-31 21:00:00.000000000 -0300
|
||||
+++ picoLisp-new/Makefile 2015-06-02 15:38:07.469726899 -0300
|
||||
@@ -0,0 +1,6 @@
|
||||
+all:
|
||||
+ (cd src; make)
|
||||
+
|
||||
+clean:
|
||||
+ (cd src; make clean)
|
||||
+
|
||||
diff -Nur picoLisp/src/Makefile picoLisp-new/src/Makefile
|
||||
--- picoLisp/src/Makefile 2015-03-31 15:48:22.000000000 -0300
|
||||
+++ picoLisp-new/src/Makefile 2015-06-02 15:40:43.541491599 -0300
|
||||
@@ -6,9 +6,13 @@
|
||||
|
||||
picoFiles = main.c gc.c apply.c flow.c sym.c subr.c big.c io.c net.c tab.c
|
||||
|
||||
-CC = gcc
|
||||
+#CC = gcc
|
||||
# CCLD is the cc (compiler frontend) to use for the link step.
|
||||
-CCLD = gcc
|
||||
+#CCLD = gcc
|
||||
+
|
||||
+# Honor the $(CC) variable, inherited form the environment (it's essential
|
||||
+# when cross-compiling)
|
||||
+CCLD = $(CC)
|
||||
|
||||
CFLAGS = -c -O2 -pipe \
|
||||
-falign-functions=32 -fomit-frame-pointer -fno-strict-aliasing \
|
||||
@@ -19,10 +23,10 @@
|
||||
|
||||
ifeq ($(shell uname), Linux)
|
||||
OS = Linux
|
||||
- CFLAGS += -m32
|
||||
- PICOLISP-FLAGS = -m32 -rdynamic
|
||||
+ CFLAGS += -mabi=32 -fPIC
|
||||
+ PICOLISP-FLAGS = -rdynamic
|
||||
LIB-FLAGS = -lm -ldl
|
||||
- DYNAMIC-LIB-FLAGS = -m32 -shared -export-dynamic
|
||||
+ DYNAMIC-LIB-FLAGS = -shared -export-dynamic -fPIC
|
||||
LCRYPT = -lcrypt
|
||||
STRIP = strip
|
||||
else
|
||||
@@ -4,7 +4,7 @@ PKG_NAME:=port-management
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/port-management
|
||||
|
||||
@@ -3,6 +3,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=power-management
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
PKG_NAME:=questd
|
||||
PKG_VERSION:=4.1.1
|
||||
|
||||
#PKG_SOURCE_VERSION:=04eb78c28d96801951b204bc434f84d43d4a0d03
|
||||
# FIXME
|
||||
PKG_SOURCE_VERSION:=qcom
|
||||
PKG_SOURCE_VERSION:=89619c1ae8243812a71cdc0ae31491e74866f4be
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/questd
|
||||
|
||||
@@ -18,7 +16,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@@ -38,8 +36,6 @@ QUESTD_TARGET:=-DIOPSYS_MEDIATEK
|
||||
QUESTD_CFLAGS:=\
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl-tiny
|
||||
else ifeq ($(CONFIG_TARGET_ipq),y)
|
||||
QUESTD_TARGET:=-DIOPSYS_QCA
|
||||
else
|
||||
$(info (UNEXPECTED CONFIG TARGET))
|
||||
endif
|
||||
@@ -51,7 +47,7 @@ export QUESTD_CFLAGS
|
||||
|
||||
define Package/questd
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread +TARGET_iopsys_ramips:swconfig +TARGET_iopsys_ramips:libnl-tiny +libopenssl +easy-soc-libs
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread +TARGET_iopsys_ramips:swconfig +TARGET_iopsys_ramips:libnl-tiny +libopenssl
|
||||
TITLE:=router info daemon
|
||||
endef
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=${PKG_NAME}-${PKG_VERSION}
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
223
samba2/Makefile
223
samba2/Makefile
@@ -1,223 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=samba2
|
||||
PKG_VERSION:=2.2.12
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/samba2.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=d687d07a137981f4fe78cc289b040e6426c61e29
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/samba2/Default
|
||||
SUBMENU:=Filesystem
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=samba - NetBIOS/SMB implementation
|
||||
DEPENDS:= +libreadline +ncurses +popt
|
||||
URL:=http://www.samba.org/
|
||||
endef
|
||||
|
||||
define Package/samba2/Default/description
|
||||
The Samba software suite is a collection of programs that implements the
|
||||
SMB protocol for unix systems, allowing you to serve files and printers to
|
||||
Windows, NT, OS/2 and DOS clients. This protocol is sometimes also referred
|
||||
to as the LanManager or Netbios protocol.
|
||||
endef
|
||||
|
||||
define Package/samba2-common
|
||||
$(call Package/samba2/Default)
|
||||
MENU:=1
|
||||
TITLE:=NetBIOS/SMB server and client shared files
|
||||
endef
|
||||
|
||||
#define Package/samba2-server
|
||||
# $(call Package/samba2/Default)
|
||||
# TITLE:=NetBIOS/SMB file and print server
|
||||
# DEPENDS:=samba2-common
|
||||
#endef
|
||||
|
||||
define Package/samba2-client
|
||||
$(call Package/samba2/Default)
|
||||
TITLE:=NetBIOS/SMB simple client
|
||||
DEPENDS:=samba2-common
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
WERR := -Werror=format-security
|
||||
TARGET_CFLAGS_WITHOUT_WERR := $(filter-out $(WERR),$(TARGET_CFLAGS))
|
||||
|
||||
define Build/Compile
|
||||
rm -rf $(PKG_INSTALL_DIR)
|
||||
mkdir -p $(PKG_INSTALL_DIR)
|
||||
(cd $(PKG_BUILD_DIR)/source ; rm -rf config.{cache,status} ; \
|
||||
CFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE" \
|
||||
./configure \
|
||||
$(HOST_CONFIGURE_VARS) \
|
||||
$(HOST_CONFIGURE_ARGS) \
|
||||
--program-prefix="" \
|
||||
--program-suffix="" \
|
||||
--prefix=/usr \
|
||||
--exec-prefix=/usr \
|
||||
--bindir=/usr/bin \
|
||||
--datadir=/usr/share \
|
||||
--includedir=/usr/include \
|
||||
--infodir=/usr/share/info \
|
||||
--libdir=/usr/lib \
|
||||
--libexecdir=/usr/lib \
|
||||
--localstatedir=/var/log/samba2 \
|
||||
--mandir=/usr/share/man \
|
||||
--sbindir=/usr/sbin \
|
||||
--sysconfdir=/etc/samba2 \
|
||||
$(DISABLE_NLS) \
|
||||
--with-included-popt \
|
||||
--with-lockdir=/var/run/samba2 \
|
||||
--with-privatedir=/etc/samba2 \
|
||||
--with-readline=no \
|
||||
);
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/source \
|
||||
bin/make_smbcodepage bin/make_unicodemap
|
||||
(cd $(PKG_BUILD_DIR)/source/bin ; \
|
||||
mv -f make_smbcodepage make_smbcodepage.old ; \
|
||||
mv -f make_unicodemap make_unicodemap.old ; \
|
||||
);
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/source \
|
||||
clean
|
||||
(cd $(PKG_BUILD_DIR)/source; rm -rf config.{cache,status}; \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS_WITHOUT_WERR) -D_GNU_SOURCE -DNDEBUG -DSHMEM_SIZE=524288" \
|
||||
CPPFLAGS="$(TARGET_CPPFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) $(LIBGCC_S)" \
|
||||
ac_cv_lib_cups_httpConnect=no \
|
||||
samba_cv_FTRUNCATE_NEEDS_ROOT=no \
|
||||
samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no \
|
||||
samba_cv_HAVE_BROKEN_GETGROUPS=no \
|
||||
samba_cv_HAVE_BROKEN_READDIR=no \
|
||||
samba_cv_HAVE_FCNTL_LOCK=yes \
|
||||
samba_cv_HAVE_FNMATCH=yes \
|
||||
samba_cv_HAVE_FTRUNCATE_EXTEND=no \
|
||||
samba_cv_HAVE_GETTIMEOFDAY_TZ=yes \
|
||||
samba_cv_HAVE_IFACE_AIX=no \
|
||||
samba_cv_HAVE_IFACE_IFCONF=yes \
|
||||
samba_cv_HAVE_IFACE_IFREQ=yes \
|
||||
samba_cv_HAVE_INO64_T=yes \
|
||||
samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no \
|
||||
samba_cv_HAVE_OFF64_T=yes \
|
||||
samba_cv_HAVE_ROOT=yes \
|
||||
samba_cv_HAVE_SECURE_MKSTEMP=yes \
|
||||
samba_cv_HAVE_SHARED_MMAP=yes \
|
||||
samba_cv_HAVE_STRUCT_FLOCK64=yes \
|
||||
samba_cv_HAVE_SYSV_IPC=no \
|
||||
samba_cv_HAVE_TRUNCATED_SALT=no \
|
||||
samba_cv_HAVE_UNION_SEMUN=no \
|
||||
samba_cv_HAVE_UNSIGNED_CHAR=yes \
|
||||
samba_cv_NEED_SGI_SEMUN_HACK=no \
|
||||
samba_cv_REPLACE_INET_NTOA=no \
|
||||
samba_cv_SIZEOF_INO_T=4 \
|
||||
samba_cv_SIZEOF_OFF_T=4 \
|
||||
samba_cv_SYSCONF_SC_NGROUPS_MAX=yes \
|
||||
samba_cv_USE_SETEUID=yes \
|
||||
samba_cv_USE_SETRESUID=no \
|
||||
samba_cv_USE_SETREUID=yes \
|
||||
samba_cv_USE_SETUIDX=no \
|
||||
samba_cv_have_longlong=yes \
|
||||
samba_cv_have_setresgid=no \
|
||||
samba_cv_have_setresuid=no \
|
||||
./configure \
|
||||
--target=$(GNU_TARGET_NAME) \
|
||||
--host=$(GNU_TARGET_NAME) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--program-prefix="" \
|
||||
--program-suffix="" \
|
||||
--prefix=/usr \
|
||||
--exec-prefix=/usr \
|
||||
--bindir=/usr/bin \
|
||||
--datadir=/usr/share \
|
||||
--includedir=/usr/include \
|
||||
--infodir=/usr/share/info \
|
||||
--libdir=/usr/lib \
|
||||
--libexecdir=/usr/lib \
|
||||
--localstatedir=/var/log/samba2 \
|
||||
--mandir=/usr/share/man \
|
||||
--sbindir=/usr/sbin \
|
||||
--sysconfdir=/etc/samba2 \
|
||||
$(DISABLE_NLS) \
|
||||
--with-included-popt \
|
||||
--with-lockdir=/var/run/samba2 \
|
||||
--with-privatedir=/etc/samba2 \
|
||||
--with-readline=no \
|
||||
--with-syslog \
|
||||
);
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/source \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CODEPAGEDIR="/usr/share/samba2" \
|
||||
all
|
||||
(cd $(PKG_BUILD_DIR)/source/bin ; \
|
||||
mv -f make_smbcodepage.old make_smbcodepage ; touch make_smbcodepage ; \
|
||||
mv -f make_unicodemap.old make_unicodemap ; touch make_unicodemap ; \
|
||||
);
|
||||
mkdir -p $(PKG_INSTALL_DIR)/usr/share/samba2
|
||||
mkdir -p $(PKG_INSTALL_DIR)/var/log
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/source \
|
||||
BASEDIR="$(PKG_INSTALL_DIR)/usr" \
|
||||
BINDIR="$(PKG_INSTALL_DIR)/usr/bin" \
|
||||
SBINDIR="$(PKG_INSTALL_DIR)/usr/bin" \
|
||||
LIBDIR="$(PKG_INSTALL_DIR)/usr/lib" \
|
||||
VARDIR="$(PKG_INSTALL_DIR)/var/log/samba2" \
|
||||
MANDIR="$(PKG_INSTALL_DIR)/usr/share/man" \
|
||||
CONFIGDIR="$(PKG_INSTALL_DIR)/etc/samba2" \
|
||||
PRIVATEDIR="$(PKG_INSTALL_DIR)/etc/samba2" \
|
||||
SWATDIR="$(PKG_INSTALL_DIR)/usr/swat" \
|
||||
LOCKDIR="$(PKG_INSTALL_DIR)/var/run/samba2" \
|
||||
SAMBABOOK="$(PKG_INSTALL_DIR)/usr/swat/using_samba2" \
|
||||
CODEPAGEDIR="$(PKG_INSTALL_DIR)/usr/share/samba2" \
|
||||
install
|
||||
endef
|
||||
|
||||
define Package/samba2-common/install
|
||||
$(INSTALL_DIR) $(1)/etc/samba2
|
||||
# $(INSTALL_DATA) ./files/smb.conf $(1)/etc/samba2/smb.conf
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/smbpasswd.shared $(1)/usr/bin/smbpasswd
|
||||
$(INSTALL_DIR) $(1)/usr/share/samba2
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/samba2/codepage.{437,850} $(1)/usr/share/samba2/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/samba2/unicode_map.{437,850,ISO8859-1,ISO8859-15} $(1)/usr/share/samba2/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/samba2/codepage.852 $(1)/usr/share/samba2/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/samba2/unicode_map.{852,ISO8859-2} $(1)/usr/share/samba2/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/samba2/codepage.{866,1251} $(1)/usr/share/samba2/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/samba2/unicode_map.{866,ISO8859-5,KOI8-R,1251} $(1)/usr/share/samba2/
|
||||
endef
|
||||
|
||||
define Package/samba2-common/conffiles
|
||||
/etc/samba2/smb.conf
|
||||
endef
|
||||
|
||||
#define Package/samba2-server/install
|
||||
# $(INSTALL_DIR) $(1)/etc/init.d
|
||||
# $(INSTALL_BIN) ./files/samba2.init $(1)/etc/init.d/samba2
|
||||
# $(INSTALL_DIR) $(1)/usr/lib
|
||||
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/libsmb.so $(1)/usr/lib/
|
||||
# $(INSTALL_DIR) $(1)/usr/sbin
|
||||
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/nmbd.shared $(1)/usr/sbin/nmbd
|
||||
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/smbd.shared $(1)/usr/sbin/smbd
|
||||
#endef
|
||||
|
||||
define Package/samba2-client/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rpcclient $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,samba2-common))
|
||||
#$(eval $(call BuildPackage,samba2-server))
|
||||
$(eval $(call BuildPackage,samba2-client))
|
||||
@@ -18,6 +18,8 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/samba-$(PKG_VERSION)
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
#PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
|
||||
50
shflags/Makefile
Normal file
50
shflags/Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# Copyright (C) 2012-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=shflags
|
||||
PKG_VERSION:=2012-06-11
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/kward/shflags.git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=c12b30cebb92b49c5edb6df255c0952c65b4ddc6
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/shflags
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=shflags
|
||||
DEPENDS:=+getopt
|
||||
URL:=http://code.google.com/p/shflags/
|
||||
MAINTAINER:=Luka Perkov <luka@openwrt.org>
|
||||
endef
|
||||
|
||||
define Package/shflags/description
|
||||
command-line flags module for Unix shell scripts
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Build/Install
|
||||
endef
|
||||
|
||||
define Package/shflags/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/shflags
|
||||
$(CP) $(PKG_BUILD_DIR)/source/1.0/src/shflags $(1)/usr/share/shflags/shflags.sh
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,shflags))
|
||||
763
shflags/patches/000-strip.patch
Normal file
763
shflags/patches/000-strip.patch
Normal file
@@ -0,0 +1,763 @@
|
||||
--- a/source/1.0/src/shflags
|
||||
+++ b/source/1.0/src/shflags
|
||||
@@ -1,91 +1,10 @@
|
||||
-# $Id$
|
||||
-# vim:et:ft=sh:sts=2:sw=2
|
||||
-#
|
||||
-# Copyright 2008 Kate Ward. All Rights Reserved.
|
||||
-# Released under the LGPL (GNU Lesser General Public License)
|
||||
-#
|
||||
-# shFlags -- Advanced command-line flag library for Unix shell scripts.
|
||||
-# http://code.google.com/p/shflags/
|
||||
-#
|
||||
-# Author: kate.ward@forestent.com (Kate Ward)
|
||||
-#
|
||||
-# This module implements something like the google-gflags library available
|
||||
-# from http://code.google.com/p/google-gflags/.
|
||||
-#
|
||||
-# FLAG TYPES: This is a list of the DEFINE_*'s that you can do. All flags take
|
||||
-# a name, default value, help-string, and optional 'short' name (one-letter
|
||||
-# name). Some flags have other arguments, which are described with the flag.
|
||||
-#
|
||||
-# DEFINE_string: takes any input, and intreprets it as a string.
|
||||
-#
|
||||
-# DEFINE_boolean: typically does not take any argument: say --myflag to set
|
||||
-# FLAGS_myflag to true, or --nomyflag to set FLAGS_myflag to false.
|
||||
-# Alternately, you can say
|
||||
-# --myflag=true or --myflag=t or --myflag=0 or
|
||||
-# --myflag=false or --myflag=f or --myflag=1
|
||||
-# Passing an option has the same affect as passing the option once.
|
||||
-#
|
||||
-# DEFINE_float: takes an input and intreprets it as a floating point number. As
|
||||
-# shell does not support floats per-se, the input is merely validated as
|
||||
-# being a valid floating point value.
|
||||
-#
|
||||
-# DEFINE_integer: takes an input and intreprets it as an integer.
|
||||
-#
|
||||
-# SPECIAL FLAGS: There are a few flags that have special meaning:
|
||||
-# --help (or -?) prints a list of all the flags in a human-readable fashion
|
||||
-# --flagfile=foo read flags from foo. (not implemented yet)
|
||||
-# -- as in getopt(), terminates flag-processing
|
||||
-#
|
||||
-# EXAMPLE USAGE:
|
||||
-#
|
||||
-# -- begin hello.sh --
|
||||
-# #! /bin/sh
|
||||
-# . ./shflags
|
||||
-# DEFINE_string name 'world' "somebody's name" n
|
||||
-# FLAGS "$@" || exit $?
|
||||
-# eval set -- "${FLAGS_ARGV}"
|
||||
-# echo "Hello, ${FLAGS_name}."
|
||||
-# -- end hello.sh --
|
||||
-#
|
||||
-# $ ./hello.sh -n Kate
|
||||
-# Hello, Kate.
|
||||
-#
|
||||
-# NOTE: Not all systems include a getopt version that supports long flags. On
|
||||
-# these systems, only short flags are recognized.
|
||||
-
|
||||
-#==============================================================================
|
||||
-# shFlags
|
||||
-#
|
||||
-# Shared attributes:
|
||||
-# flags_error: last error message
|
||||
-# flags_return: last return value
|
||||
-#
|
||||
-# __flags_longNames: list of long names for all flags
|
||||
-# __flags_shortNames: list of short names for all flags
|
||||
-# __flags_boolNames: list of boolean flag names
|
||||
-#
|
||||
-# __flags_opts: options parsed by getopt
|
||||
-#
|
||||
-# Per-flag attributes:
|
||||
-# FLAGS_<flag_name>: contains value of flag named 'flag_name'
|
||||
-# __flags_<flag_name>_default: the default flag value
|
||||
-# __flags_<flag_name>_help: the flag help string
|
||||
-# __flags_<flag_name>_short: the flag short name
|
||||
-# __flags_<flag_name>_type: the flag type
|
||||
-#
|
||||
-# Notes:
|
||||
-# - lists of strings are space separated, and a null value is the '~' char.
|
||||
-
|
||||
-# return if FLAGS already loaded
|
||||
[ -n "${FLAGS_VERSION:-}" ] && return 0
|
||||
FLAGS_VERSION='1.0.3'
|
||||
|
||||
-# return values
|
||||
FLAGS_TRUE=0
|
||||
FLAGS_FALSE=1
|
||||
FLAGS_ERROR=2
|
||||
|
||||
-# reserved flag names
|
||||
FLAGS_RESERVED='ARGC ARGV ERROR FALSE HELP PARENT RESERVED TRUE VERSION'
|
||||
|
||||
_flags_debug() { echo "flags:DEBUG $@" >&2; }
|
||||
@@ -93,7 +12,6 @@ _flags_warn() { echo "flags:WARN $@" >&2
|
||||
_flags_error() { echo "flags:ERROR $@" >&2; }
|
||||
_flags_fatal() { echo "flags:FATAL $@" >&2; }
|
||||
|
||||
-# specific shell checks
|
||||
if [ -n "${ZSH_VERSION:-}" ]; then
|
||||
setopt |grep "^shwordsplit$" >/dev/null
|
||||
if [ $? -ne ${FLAGS_TRUE} ]; then
|
||||
@@ -107,20 +25,15 @@ if [ -n "${ZSH_VERSION:-}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
-#
|
||||
-# constants
|
||||
-#
|
||||
|
||||
-# getopt version
|
||||
__FLAGS_GETOPT_VERS_STD=0
|
||||
__FLAGS_GETOPT_VERS_ENH=1
|
||||
__FLAGS_GETOPT_VERS_BSD=2
|
||||
|
||||
getopt >/dev/null 2>&1
|
||||
case $? in
|
||||
- 0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;; # bsd getopt
|
||||
+ 0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;;
|
||||
2)
|
||||
- # TODO(kward): look into '-T' option to test the internal getopt() version
|
||||
if [ "`getopt --version`" = '-- ' ]; then
|
||||
__FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD}
|
||||
else
|
||||
@@ -133,82 +46,49 @@ case $? in
|
||||
;;
|
||||
esac
|
||||
|
||||
-# getopt optstring lengths
|
||||
__FLAGS_OPTSTR_SHORT=0
|
||||
__FLAGS_OPTSTR_LONG=1
|
||||
|
||||
__FLAGS_NULL='~'
|
||||
|
||||
-# flag info strings
|
||||
__FLAGS_INFO_DEFAULT='default'
|
||||
__FLAGS_INFO_HELP='help'
|
||||
__FLAGS_INFO_SHORT='short'
|
||||
__FLAGS_INFO_TYPE='type'
|
||||
|
||||
-# flag lengths
|
||||
__FLAGS_LEN_SHORT=0
|
||||
__FLAGS_LEN_LONG=1
|
||||
|
||||
-# flag types
|
||||
__FLAGS_TYPE_NONE=0
|
||||
__FLAGS_TYPE_BOOLEAN=1
|
||||
__FLAGS_TYPE_FLOAT=2
|
||||
__FLAGS_TYPE_INTEGER=3
|
||||
__FLAGS_TYPE_STRING=4
|
||||
|
||||
-# set the constants readonly
|
||||
__flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'`
|
||||
for __flags_const in ${__flags_constants}; do
|
||||
- # skip certain flags
|
||||
case ${__flags_const} in
|
||||
FLAGS_HELP) continue ;;
|
||||
FLAGS_PARENT) continue ;;
|
||||
esac
|
||||
- # set flag readonly
|
||||
if [ -z "${ZSH_VERSION:-}" ]; then
|
||||
readonly ${__flags_const}
|
||||
- else # handle zsh
|
||||
+ else
|
||||
case ${ZSH_VERSION} in
|
||||
[123].*) readonly ${__flags_const} ;;
|
||||
- *) readonly -g ${__flags_const} ;; # declare readonly constants globally
|
||||
+ *) readonly -g ${__flags_const} ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
unset __flags_const __flags_constants
|
||||
|
||||
-#
|
||||
-# internal variables
|
||||
-#
|
||||
-
|
||||
-__flags_boolNames=' ' # space separated list of boolean flag names
|
||||
-__flags_longNames=' ' # space separated list of long flag names
|
||||
-__flags_shortNames=' ' # space separated list of short flag names
|
||||
-
|
||||
-__flags_columns='' # screen width in columns
|
||||
-__flags_opts='' # temporary storage for parsed getopt flags
|
||||
-
|
||||
-#------------------------------------------------------------------------------
|
||||
-# private functions
|
||||
-#
|
||||
-
|
||||
-# Define a flag.
|
||||
-#
|
||||
-# Calling this function will define the following info variables for the
|
||||
-# specified flag:
|
||||
-# FLAGS_flagname - the name for this flag (based upon the long flag name)
|
||||
-# __flags_<flag_name>_default - the default value
|
||||
-# __flags_flagname_help - the help string
|
||||
-# __flags_flagname_short - the single letter alias
|
||||
-# __flags_flagname_type - the type of flag (one of __FLAGS_TYPE_*)
|
||||
-#
|
||||
-# Args:
|
||||
-# _flags__type: integer: internal type of flag (__FLAGS_TYPE_*)
|
||||
-# _flags__name: string: long flag name
|
||||
-# _flags__default: default flag value
|
||||
-# _flags__help: string: help string
|
||||
-# _flags__short: string: (optional) short flag name
|
||||
-# Returns:
|
||||
-# integer: success of operation, or error
|
||||
+
|
||||
+__flags_boolNames=' '
|
||||
+__flags_longNames=' '
|
||||
+__flags_shortNames=' '
|
||||
+__flags_columns=''
|
||||
+__flags_opts=''
|
||||
+
|
||||
_flags_define()
|
||||
{
|
||||
if [ $# -lt 4 ]; then
|
||||
@@ -226,16 +106,13 @@ _flags_define()
|
||||
|
||||
_flags_return_=${FLAGS_TRUE}
|
||||
|
||||
- # TODO(kward): check for validity of the flag name (e.g. dashes)
|
||||
|
||||
- # check whether the flag name is reserved
|
||||
echo " ${FLAGS_RESERVED} " |grep " ${_flags_name_} " >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
flags_error="flag name (${_flags_name_}) is reserved"
|
||||
_flags_return_=${FLAGS_ERROR}
|
||||
fi
|
||||
|
||||
- # require short option for getopt that don't support long options
|
||||
if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
|
||||
-a ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} \
|
||||
-a "${_flags_short_}" = "${__FLAGS_NULL}" ]
|
||||
@@ -244,7 +121,6 @@ _flags_define()
|
||||
_flags_return_=${FLAGS_ERROR}
|
||||
fi
|
||||
|
||||
- # check for existing long name definition
|
||||
if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
|
||||
if _flags_itemInList "${_flags_name_}" \
|
||||
${__flags_longNames} ${__flags_boolNames}
|
||||
@@ -255,7 +131,6 @@ _flags_define()
|
||||
fi
|
||||
fi
|
||||
|
||||
- # check for existing short name definition
|
||||
if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
|
||||
-a "${_flags_short_}" != "${__FLAGS_NULL}" ]
|
||||
then
|
||||
@@ -266,9 +141,6 @@ _flags_define()
|
||||
fi
|
||||
fi
|
||||
|
||||
- # handle default value. note, on several occasions the 'if' portion of an
|
||||
- # if/then/else contains just a ':' which does nothing. a binary reversal via
|
||||
- # '!' is not done because it does not work on all shells.
|
||||
if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
|
||||
case ${_flags_type_} in
|
||||
${__FLAGS_TYPE_BOOLEAN})
|
||||
@@ -301,7 +173,7 @@ _flags_define()
|
||||
fi
|
||||
;;
|
||||
|
||||
- ${__FLAGS_TYPE_STRING}) ;; # everything in shell is a valid string
|
||||
+ ${__FLAGS_TYPE_STRING}) ;;
|
||||
|
||||
*)
|
||||
flags_error="unrecognized flag type '${_flags_type_}'"
|
||||
@@ -311,7 +183,6 @@ _flags_define()
|
||||
fi
|
||||
|
||||
if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
|
||||
- # store flag information
|
||||
eval "FLAGS_${_flags_name_}='${_flags_default_}'"
|
||||
eval "__flags_${_flags_name_}_${__FLAGS_INFO_TYPE}=${_flags_type_}"
|
||||
eval "__flags_${_flags_name_}_${__FLAGS_INFO_DEFAULT}=\
|
||||
@@ -319,7 +190,6 @@ _flags_define()
|
||||
eval "__flags_${_flags_name_}_${__FLAGS_INFO_HELP}=\"${_flags_help_}\""
|
||||
eval "__flags_${_flags_name_}_${__FLAGS_INFO_SHORT}='${_flags_short_}'"
|
||||
|
||||
- # append flag name(s) to list of names
|
||||
__flags_longNames="${__flags_longNames}${_flags_name_} "
|
||||
__flags_shortNames="${__flags_shortNames}${_flags_short_} "
|
||||
[ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \
|
||||
@@ -333,17 +203,6 @@ _flags_define()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# Return valid getopt options using currently defined list of long options.
|
||||
-#
|
||||
-# This function builds a proper getopt option string for short (and long)
|
||||
-# options, using the current list of long options for reference.
|
||||
-#
|
||||
-# Args:
|
||||
-# _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*)
|
||||
-# Output:
|
||||
-# string: generated option string for getopt
|
||||
-# Returns:
|
||||
-# boolean: success of operation (always returns True)
|
||||
_flags_genOptStr()
|
||||
{
|
||||
_flags_optStrType_=$1
|
||||
@@ -358,7 +217,6 @@ _flags_genOptStr()
|
||||
${_flags_flag_} ${__FLAGS_INFO_SHORT}`
|
||||
if [ "${_flags_shortName_}" != "${__FLAGS_NULL}" ]; then
|
||||
_flags_opts_="${_flags_opts_}${_flags_shortName_}"
|
||||
- # getopt needs a trailing ':' to indicate a required argument
|
||||
[ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
|
||||
_flags_opts_="${_flags_opts_}:"
|
||||
fi
|
||||
@@ -366,7 +224,6 @@ _flags_genOptStr()
|
||||
|
||||
${__FLAGS_OPTSTR_LONG})
|
||||
_flags_opts_="${_flags_opts_:+${_flags_opts_},}${_flags_flag_}"
|
||||
- # getopt needs a trailing ':' to indicate a required argument
|
||||
[ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
|
||||
_flags_opts_="${_flags_opts_}:"
|
||||
;;
|
||||
@@ -379,15 +236,6 @@ _flags_genOptStr()
|
||||
return ${FLAGS_TRUE}
|
||||
}
|
||||
|
||||
-# Returns flag details based on a flag name and flag info.
|
||||
-#
|
||||
-# Args:
|
||||
-# string: long flag name
|
||||
-# string: flag info (see the _flags_define function for valid info types)
|
||||
-# Output:
|
||||
-# string: value of dereferenced flag variable
|
||||
-# Returns:
|
||||
-# integer: one of FLAGS_{TRUE|FALSE|ERROR}
|
||||
_flags_getFlagInfo()
|
||||
{
|
||||
_flags_name_=$1
|
||||
@@ -399,13 +247,6 @@ _flags_getFlagInfo()
|
||||
if [ -n "${_flags_value_}" ]; then
|
||||
flags_return=${FLAGS_TRUE}
|
||||
else
|
||||
- # see if the _flags_name_ variable is a string as strings can be empty...
|
||||
- # note: the DRY principle would say to have this function call itself for
|
||||
- # the next three lines, but doing so results in an infinite loop as an
|
||||
- # invalid _flags_name_ will also not have the associated _type variable.
|
||||
- # Because it doesn't (it will evaluate to an empty string) the logic will
|
||||
- # try to find the _type variable of the _type variable, and so on. Not so
|
||||
- # good ;-)
|
||||
_flags_typeVar_="__flags_${_flags_name_}_${__FLAGS_INFO_TYPE}"
|
||||
_flags_strToEval_="_flags_type_=\"\${${_flags_typeVar_}:-}\""
|
||||
eval "${_flags_strToEval_}"
|
||||
@@ -424,15 +265,6 @@ _flags_getFlagInfo()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# check for presense of item in a list. passed a string (e.g. 'abc'), this
|
||||
-# function will determine if the string is present in the list of strings (e.g.
|
||||
-# ' foo bar abc ').
|
||||
-#
|
||||
-# Args:
|
||||
-# _flags__str: string: string to search for in a list of strings
|
||||
-# unnamed: list: list of strings
|
||||
-# Returns:
|
||||
-# boolean: true if item is in the list
|
||||
_flags_itemInList()
|
||||
{
|
||||
_flags_str_=$1
|
||||
@@ -449,34 +281,22 @@ _flags_itemInList()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# Returns the width of the current screen.
|
||||
-#
|
||||
-# Output:
|
||||
-# integer: width in columns of the current screen.
|
||||
_flags_columns()
|
||||
{
|
||||
if [ -z "${__flags_columns}" ]; then
|
||||
- # determine the value and store it
|
||||
if eval stty size >/dev/null 2>&1; then
|
||||
- # stty size worked :-)
|
||||
set -- `stty size`
|
||||
__flags_columns=$2
|
||||
elif eval tput cols >/dev/null 2>&1; then
|
||||
set -- `tput cols`
|
||||
__flags_columns=$1
|
||||
else
|
||||
- __flags_columns=80 # default terminal width
|
||||
+ __flags_columns=80
|
||||
fi
|
||||
fi
|
||||
echo ${__flags_columns}
|
||||
}
|
||||
|
||||
-# Validate a boolean.
|
||||
-#
|
||||
-# Args:
|
||||
-# _flags__bool: boolean: value to validate
|
||||
-# Returns:
|
||||
-# bool: true if the value is a valid boolean
|
||||
_flags_validateBoolean()
|
||||
{
|
||||
_flags_bool_=$1
|
||||
@@ -492,12 +312,6 @@ _flags_validateBoolean()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# Validate a float.
|
||||
-#
|
||||
-# Args:
|
||||
-# _flags__float: float: value to validate
|
||||
-# Returns:
|
||||
-# bool: true if the value is a valid float
|
||||
_flags_validateFloat()
|
||||
{
|
||||
_flags_float_=$1
|
||||
@@ -507,10 +321,10 @@ _flags_validateFloat()
|
||||
else
|
||||
flags_return=${FLAGS_TRUE}
|
||||
case ${_flags_float_} in
|
||||
- -*) # negative floats
|
||||
+ -*)
|
||||
_flags_test_=`expr "${_flags_float_}" : '\(-[0-9][0-9]*\.[0-9][0-9]*\)'`
|
||||
;;
|
||||
- *) # positive floats
|
||||
+ *)
|
||||
_flags_test_=`expr "${_flags_float_}" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
|
||||
;;
|
||||
esac
|
||||
@@ -521,22 +335,16 @@ _flags_validateFloat()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# Validate an integer.
|
||||
-#
|
||||
-# Args:
|
||||
-# _flags__integer: interger: value to validate
|
||||
-# Returns:
|
||||
-# bool: true if the value is a valid integer
|
||||
_flags_validateInteger()
|
||||
{
|
||||
_flags_int_=$1
|
||||
|
||||
flags_return=${FLAGS_TRUE}
|
||||
case ${_flags_int_} in
|
||||
- -*) # negative ints
|
||||
+ -*)
|
||||
_flags_test_=`expr "${_flags_int_}" : '\(-[0-9][0-9]*\)'`
|
||||
;;
|
||||
- *) # positive ints
|
||||
+ *)
|
||||
_flags_test_=`expr "${_flags_int_}" : '\([0-9][0-9]*\)'`
|
||||
;;
|
||||
esac
|
||||
@@ -546,23 +354,12 @@ _flags_validateInteger()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# Parse command-line options using the standard getopt.
|
||||
-#
|
||||
-# Note: the flag options are passed around in the global __flags_opts so that
|
||||
-# the formatting is not lost due to shell parsing and such.
|
||||
-#
|
||||
-# Args:
|
||||
-# @: varies: command-line options to parse
|
||||
-# Returns:
|
||||
-# integer: a FLAGS success condition
|
||||
_flags_getoptStandard()
|
||||
{
|
||||
flags_return=${FLAGS_TRUE}
|
||||
_flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
|
||||
|
||||
- # check for spaces in passed options
|
||||
for _flags_opt_ in "$@"; do
|
||||
- # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
|
||||
_flags_match_=`echo "x${_flags_opt_}x" |sed 's/ //g'`
|
||||
if [ "${_flags_match_}" != "x${_flags_opt_}x" ]; then
|
||||
flags_error='the available getopt does not support spaces in options'
|
||||
@@ -585,15 +382,6 @@ _flags_getoptStandard()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# Parse command-line options using the enhanced getopt.
|
||||
-#
|
||||
-# Note: the flag options are passed around in the global __flags_opts so that
|
||||
-# the formatting is not lost due to shell parsing and such.
|
||||
-#
|
||||
-# Args:
|
||||
-# @: varies: command-line options to parse
|
||||
-# Returns:
|
||||
-# integer: a FLAGS success condition
|
||||
_flags_getoptEnhanced()
|
||||
{
|
||||
flags_return=${FLAGS_TRUE}
|
||||
@@ -617,17 +405,6 @@ _flags_getoptEnhanced()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# Dynamically parse a getopt result and set appropriate variables.
|
||||
-#
|
||||
-# This function does the actual conversion of getopt output and runs it through
|
||||
-# the standard case structure for parsing. The case structure is actually quite
|
||||
-# dynamic to support any number of flags.
|
||||
-#
|
||||
-# Args:
|
||||
-# argc: int: original command-line argument count
|
||||
-# @: varies: output from getopt parsing
|
||||
-# Returns:
|
||||
-# integer: a FLAGS success condition
|
||||
_flags_parseGetopt()
|
||||
{
|
||||
_flags_argc_=$1
|
||||
@@ -638,35 +415,26 @@ _flags_parseGetopt()
|
||||
if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
|
||||
set -- $@
|
||||
else
|
||||
- # note the quotes around the `$@' -- they are essential!
|
||||
eval set -- "$@"
|
||||
fi
|
||||
|
||||
- # provide user with number of arguments to shift by later
|
||||
- # NOTE: the FLAGS_ARGC variable is obsolete as of 1.0.3 because it does not
|
||||
- # properly give user access to non-flag arguments mixed in between flag
|
||||
- # arguments. Its usage was replaced by FLAGS_ARGV, and it is being kept only
|
||||
- # for backwards compatibility reasons.
|
||||
FLAGS_ARGC=`expr $# - 1 - ${_flags_argc_}`
|
||||
|
||||
- # handle options. note options with values must do an additional shift
|
||||
while true; do
|
||||
_flags_opt_=$1
|
||||
_flags_arg_=${2:-}
|
||||
_flags_type_=${__FLAGS_TYPE_NONE}
|
||||
_flags_name_=''
|
||||
|
||||
- # determine long flag name
|
||||
case "${_flags_opt_}" in
|
||||
- --) shift; break ;; # discontinue option parsing
|
||||
+ --) shift; break ;;
|
||||
|
||||
- --*) # long option
|
||||
+ --*)
|
||||
_flags_opt_=`expr "${_flags_opt_}" : '--\(.*\)'`
|
||||
_flags_len_=${__FLAGS_LEN_LONG}
|
||||
if _flags_itemInList "${_flags_opt_}" ${__flags_longNames}; then
|
||||
_flags_name_=${_flags_opt_}
|
||||
else
|
||||
- # check for negated long boolean version
|
||||
if _flags_itemInList "${_flags_opt_}" ${__flags_boolNames}; then
|
||||
_flags_name_=`expr "${_flags_opt_}" : 'no\(.*\)'`
|
||||
_flags_type_=${__FLAGS_TYPE_BOOLEAN}
|
||||
@@ -675,12 +443,10 @@ _flags_parseGetopt()
|
||||
fi
|
||||
;;
|
||||
|
||||
- -*) # short option
|
||||
+ -*)
|
||||
_flags_opt_=`expr "${_flags_opt_}" : '-\(.*\)'`
|
||||
_flags_len_=${__FLAGS_LEN_SHORT}
|
||||
if _flags_itemInList "${_flags_opt_}" ${__flags_shortNames}; then
|
||||
- # yes. match short name to long name. note purposeful off-by-one
|
||||
- # (too high) with awk calculations.
|
||||
_flags_pos_=`echo "${__flags_shortNames}" \
|
||||
|awk 'BEGIN{RS=" ";rn=0}$0==e{rn=NR}END{print rn}' \
|
||||
e=${_flags_opt_}`
|
||||
@@ -690,14 +456,12 @@ _flags_parseGetopt()
|
||||
;;
|
||||
esac
|
||||
|
||||
- # die if the flag was unrecognized
|
||||
if [ -z "${_flags_name_}" ]; then
|
||||
flags_error="unrecognized option (${_flags_opt_})"
|
||||
flags_return=${FLAGS_ERROR}
|
||||
break
|
||||
fi
|
||||
|
||||
- # set new flag value
|
||||
[ ${_flags_type_} -eq ${__FLAGS_TYPE_NONE} ] && \
|
||||
_flags_type_=`_flags_getFlagInfo \
|
||||
"${_flags_name_}" ${__FLAGS_INFO_TYPE}`
|
||||
@@ -746,7 +510,6 @@ _flags_parseGetopt()
|
||||
;;
|
||||
esac
|
||||
|
||||
- # handle special case help flag
|
||||
if [ "${_flags_name_}" = 'help' ]; then
|
||||
if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then
|
||||
flags_help
|
||||
@@ -756,12 +519,10 @@ _flags_parseGetopt()
|
||||
fi
|
||||
fi
|
||||
|
||||
- # shift the option and non-boolean arguements out.
|
||||
shift
|
||||
[ ${_flags_type_} != ${__FLAGS_TYPE_BOOLEAN} ] && shift
|
||||
done
|
||||
|
||||
- # give user back non-flag arguments
|
||||
FLAGS_ARGV=''
|
||||
while [ $# -gt 0 ]; do
|
||||
FLAGS_ARGV="${FLAGS_ARGV:+${FLAGS_ARGV} }'$1'"
|
||||
@@ -773,43 +534,18 @@ _flags_parseGetopt()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-#------------------------------------------------------------------------------
|
||||
-# public functions
|
||||
-#
|
||||
-
|
||||
-# A basic boolean flag. Boolean flags do not take any arguments, and their
|
||||
-# value is either 1 (false) or 0 (true). For long flags, the false value is
|
||||
-# specified on the command line by prepending the word 'no'. With short flags,
|
||||
-# the presense of the flag toggles the current value between true and false.
|
||||
-# Specifying a short boolean flag twice on the command results in returning the
|
||||
-# value back to the default value.
|
||||
-#
|
||||
-# A default value is required for boolean flags.
|
||||
-#
|
||||
-# For example, lets say a Boolean flag was created whose long name was 'update'
|
||||
-# and whose short name was 'x', and the default value was 'false'. This flag
|
||||
-# could be explicitly set to 'true' with '--update' or by '-x', and it could be
|
||||
-# explicitly set to 'false' with '--noupdate'.
|
||||
+
|
||||
DEFINE_boolean() { _flags_define ${__FLAGS_TYPE_BOOLEAN} "$@"; }
|
||||
|
||||
-# Other basic flags.
|
||||
DEFINE_float() { _flags_define ${__FLAGS_TYPE_FLOAT} "$@"; }
|
||||
DEFINE_integer() { _flags_define ${__FLAGS_TYPE_INTEGER} "$@"; }
|
||||
DEFINE_string() { _flags_define ${__FLAGS_TYPE_STRING} "$@"; }
|
||||
|
||||
-# Parse the flags.
|
||||
-#
|
||||
-# Args:
|
||||
-# unnamed: list: command-line flags to parse
|
||||
-# Returns:
|
||||
-# integer: success of operation, or error
|
||||
FLAGS()
|
||||
{
|
||||
- # define a standard 'help' flag if one isn't already defined
|
||||
[ -z "${__flags_help_type:-}" ] && \
|
||||
DEFINE_boolean 'help' false 'show this help' 'h'
|
||||
|
||||
- # parse options
|
||||
if [ $# -gt 0 ]; then
|
||||
if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
|
||||
_flags_getoptStandard "$@"
|
||||
@@ -818,7 +554,6 @@ FLAGS()
|
||||
fi
|
||||
flags_return=$?
|
||||
else
|
||||
- # nothing passed; won't bother running getopt
|
||||
__flags_opts='--'
|
||||
flags_return=${FLAGS_TRUE}
|
||||
fi
|
||||
@@ -832,23 +567,11 @@ FLAGS()
|
||||
return ${flags_return}
|
||||
}
|
||||
|
||||
-# This is a helper function for determining the `getopt` version for platforms
|
||||
-# where the detection isn't working. It simply outputs debug information that
|
||||
-# can be included in a bug report.
|
||||
-#
|
||||
-# Args:
|
||||
-# none
|
||||
-# Output:
|
||||
-# debug info that can be included in a bug report
|
||||
-# Returns:
|
||||
-# nothing
|
||||
flags_getoptInfo()
|
||||
{
|
||||
- # platform info
|
||||
_flags_debug "uname -a: `uname -a`"
|
||||
_flags_debug "PATH: ${PATH}"
|
||||
|
||||
- # shell info
|
||||
if [ -n "${BASH_VERSION:-}" ]; then
|
||||
_flags_debug 'shell: bash'
|
||||
_flags_debug "BASH_VERSION: ${BASH_VERSION}"
|
||||
@@ -857,7 +580,6 @@ flags_getoptInfo()
|
||||
_flags_debug "ZSH_VERSION: ${ZSH_VERSION}"
|
||||
fi
|
||||
|
||||
- # getopt info
|
||||
getopt >/dev/null
|
||||
_flags_getoptReturn=$?
|
||||
_flags_debug "getopt return: ${_flags_getoptReturn}"
|
||||
@@ -866,39 +588,16 @@ flags_getoptInfo()
|
||||
unset _flags_getoptReturn
|
||||
}
|
||||
|
||||
-# Returns whether the detected getopt version is the enhanced version.
|
||||
-#
|
||||
-# Args:
|
||||
-# none
|
||||
-# Output:
|
||||
-# none
|
||||
-# Returns:
|
||||
-# bool: true if getopt is the enhanced version
|
||||
flags_getoptIsEnh()
|
||||
{
|
||||
test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH}
|
||||
}
|
||||
|
||||
-# Returns whether the detected getopt version is the standard version.
|
||||
-#
|
||||
-# Args:
|
||||
-# none
|
||||
-# Returns:
|
||||
-# bool: true if getopt is the standard version
|
||||
flags_getoptIsStd()
|
||||
{
|
||||
test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD}
|
||||
}
|
||||
|
||||
-# This is effectively a 'usage()' function. It prints usage information and
|
||||
-# exits the program with ${FLAGS_FALSE} if it is ever found in the command line
|
||||
-# arguments. Note this function can be overridden so other apps can define
|
||||
-# their own --help flag, replacing this one, if they want.
|
||||
-#
|
||||
-# Args:
|
||||
-# none
|
||||
-# Returns:
|
||||
-# integer: success of operation (always returns true)
|
||||
flags_help()
|
||||
{
|
||||
if [ -n "${FLAGS_HELP:-}" ]; then
|
||||
@@ -953,19 +652,14 @@ flags_help()
|
||||
echo "${flags_helpStr_}" >&2
|
||||
else
|
||||
echo " ${flags_flagStr_} ${flags_help_}" >&2
|
||||
- # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
|
||||
- # because it doesn't like empty strings when used in this manner.
|
||||
flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \
|
||||
|awk '{printf "%"length($0)-2"s", ""}'`"
|
||||
flags_helpStr_=" ${flags_emptyStr_} ${flags_defaultStr_}"
|
||||
flags_helpStrLen_=`expr "${flags_helpStr_}" : '.*'`
|
||||
if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \
|
||||
-o ${flags_helpStrLen_} -lt ${flags_columns_} ]; then
|
||||
- # indented to match help string
|
||||
echo "${flags_helpStr_}" >&2
|
||||
else
|
||||
- # indented four from left to allow for longer defaults as long flag
|
||||
- # names might be used too, making things too long
|
||||
echo " ${flags_defaultStr_}" >&2
|
||||
fi
|
||||
fi
|
||||
@@ -978,12 +672,6 @@ flags_help()
|
||||
return ${FLAGS_TRUE}
|
||||
}
|
||||
|
||||
-# Reset shflags back to an uninitialized state.
|
||||
-#
|
||||
-# Args:
|
||||
-# none
|
||||
-# Returns:
|
||||
-# nothing
|
||||
flags_reset()
|
||||
{
|
||||
for flags_name_ in ${__flags_longNames}; do
|
||||
@@ -1000,7 +688,6 @@ flags_reset()
|
||||
eval ${flags_strToEval_}
|
||||
done
|
||||
|
||||
- # reset internal variables
|
||||
__flags_boolNames=' '
|
||||
__flags_longNames=' '
|
||||
__flags_shortNames=' '
|
||||
@@ -15,7 +15,8 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.routemeister.net/projects/sipcalc/files \
|
||||
http://download.google.com/mirror
|
||||
PKG_MD5SUM:=8d59e70d21d8f0568e310d342e3e2306
|
||||
|
||||
PKG_LICENSE:=NONSTANDARD_PERMISSIV
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sipcalc
|
||||
@@ -23,7 +24,6 @@ define Package/sipcalc
|
||||
CATEGORY:=Network
|
||||
TITLE:=IPv6 IPv4 Calculation Program
|
||||
URL:=http://www.routemeister.net/projects/sipcalc/
|
||||
DEPENDS:=+kmod-ipv6
|
||||
endef
|
||||
|
||||
define Package/sipcalc/description
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
|
||||
PKG_NAME:=speedtest-cli
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE:=speedtest_cli.py
|
||||
PKG_SOURCE_URL:=https://raw.githubusercontent.com/sivel/speedtest-cli/master
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/speedtest-cli
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=speedtest-cli utility
|
||||
DEPENDS:=+python +python-mini +python-openssl +python-expat
|
||||
URL:=https://github.com/sivel/speedtest-cli
|
||||
endef
|
||||
|
||||
define Package/speedtest-cli/description
|
||||
Command line interface for testing internet bandwidth using speedtest.net.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/speedtest-cli/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) $(DL_DIR)/speedtest_cli.py $(1)/sbin/
|
||||
chmod 744 $(1)/sbin/speedtest_cli.py
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,speedtest-cli))
|
||||
@@ -15,7 +15,8 @@ PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/topologyd.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/topologyd
|
||||
|
||||
@@ -11,7 +11,8 @@ PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/tptest.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
|
||||
@@ -11,7 +11,7 @@ PKG_SOURCE_VERSION:=e53d492a09c433718a520987c419cb6a4d4ae8dc
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1-only Apache-2.0
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_TR064_DEBUG \
|
||||
CONFIG_TR064_DEVEL
|
||||
@@ -24,7 +24,7 @@ define Package/tr064
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=tr064
|
||||
DEPENDS:=+libubus +libuci +libubox +libmicroxml +libjson-c +libpthread +libdatamodel +libopenssl +libubus +libubox
|
||||
DEPENDS:=+libubus +libuci +libubox +libmicroxml +libjson-c +libpthread +libopenssl +libubus +libubox
|
||||
endef
|
||||
|
||||
define Package/tr064/description
|
||||
|
||||
@@ -5,16 +5,18 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libtr098
|
||||
PKG_VERSION:=1.0-2019-09-25
|
||||
PKG_VERSION:=1.0-2019-12-28
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/tr-098
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=c2de93e288907da239652bd137f2ddee389b5042
|
||||
PKG_SOURCE_VERSION:=e5f1adf47f9604602a8b5c40e00a2497907f209a
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSI
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
# u-boot for mips_intel do not build in parallel.
|
||||
#PKG_BUILD_PARALLEL:=1
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=NONE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uspd
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_VERSION:=1.0.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e570b892c5ff57c908ca36b86dc3cd75c0acea0f
|
||||
PKG_SOURCE_VERSION:=ad23aa1ce58fe769c7cfa57673376400c0556580
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/uspd.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ PKG_NAME:=voice-client
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
@@ -29,7 +29,7 @@ define Package/voice-client
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=voice-client
|
||||
DEPENDS:=+asterisk13
|
||||
DEPENDS:=@TARGET_HAS_VOICE
|
||||
endef
|
||||
|
||||
define Package/voice-client/description
|
||||
|
||||
@@ -153,7 +153,6 @@ assemble_and_copy_config()
|
||||
[ -f $TMPL_ASTERISK ] && cp $TMPL_ASTERISK $WORKDIR/asterisk.conf
|
||||
[ -f $TMPL_CDR ] && cp $TMPL_CDR $WORKDIR/cdr.conf
|
||||
[ -f $TMPL_CEL ] && cp $TMPL_CEL $WORKDIR/cel.conf
|
||||
[ -f $TMPL_INDICATIONS ] && cp $TMPL_INDICATIONS $WORKDIR/indications.conf
|
||||
[ -f $TMPL_MANAGER ] && cp $TMPL_MANAGER $WORKDIR/manager.conf
|
||||
[ -f $TMPL_MODULES ] && cp $TMPL_MODULES $WORKDIR/modules.conf
|
||||
[ -f $TMPL_EXTENSIONS_MACRO ] && cp $TMPL_EXTENSIONS_MACRO $WORKDIR/extensions_macro.conf
|
||||
@@ -165,6 +164,14 @@ assemble_and_copy_config()
|
||||
[ -f $TMPL_UDPTL ] && cp $TMPL_UDPTL $WORKDIR/udptl.conf
|
||||
[ -f $SPECRATECFG ] && cp $SPECRATECFG $WORKDIR/special_rate_nr.cfg
|
||||
|
||||
[ -f $TMPL_INDICATIONS ] && {
|
||||
cp $TMPL_INDICATIONS $WORKDIR/indications.conf
|
||||
|
||||
config_get country TEL country
|
||||
country_code=$(supportedCountries |grep $country |cut -d':' -f3 |tr [A-Z] [a-z])
|
||||
sed -i "s/^country=.*/country=${country_code}/g" $WORKDIR/indications.conf
|
||||
}
|
||||
|
||||
test -e $TMPL_MEETME && cp $TMPL_MEETME $WORKDIR/meetme.conf
|
||||
|
||||
# Handle extensions_extra, carry over old file to new config if there is one
|
||||
@@ -256,9 +263,7 @@ read_codecs_ptime()
|
||||
#
|
||||
read_lines()
|
||||
{
|
||||
local line call_lines lineid ldx lines llength clength
|
||||
local loffset=$(ubus -t 1 call voice.asterisk platform | jsonfilter -e @.lineoffset)
|
||||
loffset=${loffset:-0}
|
||||
local line call_lines lines clength
|
||||
|
||||
config_get call_lines $1 call_lines
|
||||
|
||||
@@ -267,28 +272,17 @@ read_lines()
|
||||
# convert line format to <LINENAME><LINEID>
|
||||
case $line in
|
||||
[0-9])
|
||||
line="$LINENAME$line"
|
||||
;;
|
||||
"$CHANNELNAME"/[0-9])
|
||||
# get the index from channel name
|
||||
clength=$(echo $CHANNELNAME | wc -c)
|
||||
line="$LINENAME${line:$clength}"
|
||||
line="${line:$clength}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# get the index from line name
|
||||
# llength=$(echo $LINENAME | wc -c)
|
||||
# lineid="${lineid:$llength}"
|
||||
[ -n "$line" ] || continue
|
||||
|
||||
# get the index from uci config order
|
||||
lineid="$(uci show voice_client | grep =tel_line | grep -wn $line | cut -d ':' -f1)"
|
||||
|
||||
[ -n "$lineid" ] || continue
|
||||
|
||||
# -1 to match the line's uci config index number
|
||||
# +loffset to match the correct number in channel driver
|
||||
ldx=$((lineid-1+loffset))
|
||||
|
||||
lines="$lines$CHANNELNAME/$ldx&"
|
||||
lines="$lines$CHANNELNAME/$line&"
|
||||
done
|
||||
|
||||
lines=$(escape_sed_substitution $lines)
|
||||
@@ -1795,6 +1789,7 @@ configure_tel()
|
||||
local fac
|
||||
local echocancel
|
||||
local hold_target_before_refer
|
||||
local calleridtype
|
||||
|
||||
config_get jbenable TEL jbenable
|
||||
config_get jbforce TEL jbforce
|
||||
@@ -1805,6 +1800,7 @@ configure_tel()
|
||||
config_get fac TEL fac
|
||||
config_get echocancel TEL echo_cancel
|
||||
config_get hold_target_before_refer TEL hold_target_before_refer
|
||||
config_get calleridtype TEL calleridtype
|
||||
|
||||
CHANNEL_FAC="$CHANNEL_FAC $fac"
|
||||
# Convert whitespace to commas
|
||||
@@ -1823,6 +1819,12 @@ configure_tel()
|
||||
sed -i "s/|CHANNELS|/$(db get hw.board.VoicePorts)/" $WORKDIR/$LINENAME.tmp
|
||||
sed -i "s/|ECHOCANCEL|/$(getEchoCancellingValue $echocancel)/" $WORKDIR/$LINENAME.tmp
|
||||
|
||||
if [ -n "${calleridtype}" ] ; then
|
||||
sed -i "s/^calleridtype *=.*/calleridtype = ${calleridtype}/g" $WORKDIR/$LINENAME.tmp
|
||||
else
|
||||
sed -i "/^calleridtype *=.*/d" $WORKDIR/$LINENAME.tmp
|
||||
fi
|
||||
|
||||
if [ "$dtmfmode" == "compatibility" ] ; then
|
||||
dtmfcompatibility="1"
|
||||
else
|
||||
@@ -2243,6 +2245,7 @@ reload_service() {
|
||||
# FXS channel module must be reloaded before sip module. Otherwise some attributes like
|
||||
# line's registration state which is updated by SIP module through callback might be
|
||||
# reset.
|
||||
asterisk -rx "config reload $ASTERISKDIR/indications.conf"
|
||||
asterisk -rx "$(getChipVendor) reload"
|
||||
asterisk -rx "config reload $ASTERISKDIR/sip.conf"
|
||||
sleep 1
|
||||
|
||||
@@ -37,27 +37,6 @@ EOT
|
||||
|
||||
}
|
||||
|
||||
# Default phone volume for iopsysWrt 4.X.
|
||||
uci -q batch <<-EOT
|
||||
set voice_client.$(getLineName)0.txgain=4
|
||||
set voice_client.$(getLineName)0.rxgain=4
|
||||
set voice_client.$(getLineName)1.txgain=4
|
||||
set voice_client.$(getLineName)1.rxgain=4
|
||||
set voice_client.$(getLineName)2.txgain=4
|
||||
set voice_client.$(getLineName)2.rxgain=4
|
||||
set voice_client.$(getLineName)3.txgain=4
|
||||
set voice_client.$(getLineName)3.rxgain=4
|
||||
set voice_client.$(getLineName)4.txgain=4
|
||||
set voice_client.$(getLineName)4.rxgain=4
|
||||
set voice_client.$(getLineName)5.txgain=4
|
||||
set voice_client.$(getLineName)5.rxgain=4
|
||||
set voice_client.$(getLineName)6.txgain=4
|
||||
set voice_client.$(getLineName)6.rxgain=4
|
||||
set voice_client.$(getLineName)7.txgain=4
|
||||
set voice_client.$(getLineName)7.rxgain=4
|
||||
commit voice_client
|
||||
EOT
|
||||
|
||||
# Add firewall include
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.sip
|
||||
|
||||
@@ -22,7 +22,7 @@ getBaseMAC() {
|
||||
}
|
||||
|
||||
getAllLines() {
|
||||
echo "BRCM/0&BRCM/1&BRCM/2&BRCM/3&BRCM/4&BRCM/5&BRCM/6"
|
||||
echo "BRCM/0&BRCM/1&BRCM/2&BRCM/3&BRCM/4&BRCM/5"
|
||||
}
|
||||
|
||||
getLineIdx() {
|
||||
|
||||
@@ -28,12 +28,11 @@ getBaseMAC() {
|
||||
}
|
||||
|
||||
getAllLines() {
|
||||
echo "TAPI/1&TAPI/2&TAPI/3&TAPI/4&TAPI/5&TAPI/6"
|
||||
echo "TAPI/0&TAPI/1"
|
||||
}
|
||||
|
||||
getLineIdx() {
|
||||
i=$1
|
||||
echo $((i+1))
|
||||
echo $1
|
||||
}
|
||||
|
||||
getEchoCancellingValue() {
|
||||
@@ -52,5 +51,14 @@ getEchoCancellingValue() {
|
||||
}
|
||||
|
||||
supportedCountries() {
|
||||
echo "ETSI:ETS"
|
||||
echo "Austria:AUT:AT"
|
||||
echo "Denmark:DNK:DK"
|
||||
echo "Estonia:EST:EE"
|
||||
echo "Germany:DEU:DE"
|
||||
echo "Netherlands:NLD:NL"
|
||||
echo "Norway:NOR:NO"
|
||||
echo "Spain:ESP:ES"
|
||||
echo "Sweden:SWE:SE"
|
||||
echo "Switzerland:CHE:CH"
|
||||
echo "United Kingdom:GBR:UK"
|
||||
}
|
||||
|
||||
@@ -103,9 +103,8 @@ case "$1" in
|
||||
echo $uniqueid | grep "[A-Z,a-z]" && continue
|
||||
from="$(echo $line | cut -d',' -f2)"
|
||||
to="$(echo $line | cut -d',' -f3)"
|
||||
callok=0
|
||||
uci show voice_client | grep user | grep -wq "$from\|$to" && callok=1
|
||||
[ $callok -eq 0 ] && continue
|
||||
# "from" will be empty for call log of internal call (beween extension numbers)
|
||||
[ -z "$from" ] && [ -z "$to" ] && continue
|
||||
account="$(echo $line | cut -d',' -f4)"
|
||||
actok=0
|
||||
uci show voice_client | grep sip_service_provider | grep -wq "$account" && actok=1
|
||||
@@ -138,8 +137,8 @@ case "$1" in
|
||||
json_add_int chanoffset 0
|
||||
;;
|
||||
"tapi")
|
||||
json_add_int lineoffset 1
|
||||
json_add_int chanoffset -1
|
||||
json_add_int lineoffset 0
|
||||
json_add_int chanoffset 0
|
||||
;;
|
||||
*)
|
||||
# Error, unknown platform
|
||||
|
||||
@@ -18,7 +18,8 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/voicesec
|
||||
|
||||
@@ -7,9 +7,12 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=wifilife
|
||||
PKG_VERSION:=2.5.0
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=e875c8060eae9d83d4dc35aea2c9dde7c80df0df
|
||||
PKG_SOURCE_VERSION:=878ad93c0f1ad49bd187f776808e0b86402b2238
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
ifeq ($(CONFIG_WIFILIFE_OPEN),y)
|
||||
TARGET_PROD=$(shell echo $(CONFIG_TARGET_BOARD) | sed s/\"//g)
|
||||
PKG_SOURCE_URL:=http://download.iopsys.eu/iopsys/opensdk/
|
||||
|
||||
@@ -5,15 +5,17 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifimngr
|
||||
PKG_VERSION:=2.4.0
|
||||
PKG_VERSION:=2.5.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=c4063e9c5581fed6e75037d0b13698b7cb2d6c2a
|
||||
PKG_SOURCE_VERSION:=00e29842d8082a6240fbdb3bbceb36b09dc53861
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wifimngr.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -36,15 +38,6 @@ TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
#MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)"
|
||||
|
||||
#define Build/Compile
|
||||
# +$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
||||
#endef
|
||||
|
||||
define Package/wifimngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/wifimngr.init $(1)/etc/init.d/wifimngr
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 Iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifixd
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=7aae246602af0df883ddefb83147010a457c2725
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wifimngr.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/wifixd
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi status and configration utility (Deprecated)
|
||||
DEPENDS:=+libwifix +libuci +libubox +ubus +libpthread +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/wifixd/description
|
||||
This package can be used to configure and provide status about
|
||||
the WiFi modules through UBUS.
|
||||
It does this in an implementation agnostic manner through APIs
|
||||
exposed by the libwifi library.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
#MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)"
|
||||
|
||||
#define Build/Compile
|
||||
# +$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
||||
#endef
|
||||
|
||||
define Package/wifixd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/wifix.init $(1)/etc/init.d/wifix
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wifixd $(1)/usr/sbin/wifixd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,wifixd))
|
||||
Reference in New Issue
Block a user