mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-14 11:13:29 +00:00
udebug: add new package
This commit is contained in:
parent
de74afdd3a
commit
a4176bacdd
82
package/libs/udebug/Makefile
Normal file
82
package/libs/udebug/Makefile
Normal file
@ -0,0 +1,82 @@
|
||||
#
|
||||
# Copyright (C) 2023 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:=udebug
|
||||
CMAKE_INSTALL:=1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/udebug.git
|
||||
PKG_MIRROR_HASH:=553a58a14b59dc7b22755557acbc74f0655a431442a4faca56d28cdb1ef14fb4
|
||||
PKG_SOURCE_DATE:=2023-12-06
|
||||
PKG_SOURCE_VERSION:=6d3f51f9fda706f0cf4732c762e4dbe8c21e12cf
|
||||
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/libudebug
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=udebug client library
|
||||
DEPENDS:=+libubox +libubus
|
||||
endef
|
||||
|
||||
define Package/udebugd
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=OpenWrt debug service
|
||||
DEPENDS:=+libudebug
|
||||
endef
|
||||
|
||||
define Package/udebugd/conffiles
|
||||
/etc/config/udebug
|
||||
endef
|
||||
|
||||
define Package/ucode-mod-udebug
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=ucode udebug module
|
||||
DEPENDS:=+libucode +libudebug
|
||||
endef
|
||||
|
||||
define Package/udebug-cli
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=OpenWrt debug service CLI
|
||||
DEPENDS:=+udebugd +ucode-mod-udebug
|
||||
endef
|
||||
|
||||
define Package/libudebug/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ucode-mod-udebug/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ucode
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/ucode/*.so $(1)/usr/lib/ucode
|
||||
endef
|
||||
|
||||
define Package/udebugd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/udebug.config $(1)/etc/config/udebug
|
||||
$(INSTALL_BIN) ./files/udebug.init $(1)/etc/init.d/udebug
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/udebugd $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
define Package/udebug-cli/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/udebug-cli $(1)/usr/sbin/udebug
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libudebug))
|
||||
$(eval $(call BuildPackage,udebugd))
|
||||
$(eval $(call BuildPackage,ucode-mod-udebug))
|
||||
$(eval $(call BuildPackage,udebug-cli))
|
30
package/libs/udebug/files/udebug.config
Normal file
30
package/libs/udebug/files/udebug.config
Normal file
@ -0,0 +1,30 @@
|
||||
config service procd
|
||||
option enabled 0
|
||||
|
||||
config service log
|
||||
option enabled 0
|
||||
option debug 0
|
||||
option kernel 1
|
||||
option syslog 1
|
||||
|
||||
config service hostapd
|
||||
option enabled 0
|
||||
option wpa_log 1
|
||||
option wpa_nl_rx 0
|
||||
option wpa_nl_tx 0
|
||||
option wpa_nl_ctrl 0
|
||||
|
||||
config service wpa_supplicant
|
||||
option enabled 0
|
||||
option wpa_log 1
|
||||
option wpa_nl_rx 0
|
||||
option wpa_nl_tx 0
|
||||
option wpa_nl_ctrl 0
|
||||
|
||||
config service netifd
|
||||
option enabled 0
|
||||
option netifd_log 1
|
||||
option netifd_nl 0
|
||||
|
||||
config service umdns
|
||||
option enabled 0
|
55
package/libs/udebug/files/udebug.init
Executable file
55
package/libs/udebug/files/udebug.init
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (c) 2021 OpenWrt.org
|
||||
|
||||
START=11
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/udebugd
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
get_vars() {
|
||||
local cfg="$1"
|
||||
uci show "udebug.$cfg" | while read LINE; do
|
||||
cur="${LINE##udebug.$1.}"
|
||||
[[ "$cur" = "$LINE" ]] && continue
|
||||
var="${cur%%=*}"
|
||||
[[ "$cur" = "$var" ]] && continue
|
||||
echo "$var"
|
||||
done
|
||||
}
|
||||
|
||||
add_debug_service() {
|
||||
local cfg="$1"
|
||||
|
||||
json_add_object "$cfg"
|
||||
for var in $(get_vars "$cfg"); do
|
||||
config_get val "$cfg" "$var"
|
||||
json_add_string "$var" "$val"
|
||||
done
|
||||
json_close_object "$cfg"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
config_load udebug
|
||||
|
||||
json_init
|
||||
json_add_object service
|
||||
config_foreach add_debug_service service
|
||||
json_close_object
|
||||
ubus call udebug set_config "$(json_dump)"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger udebug
|
||||
}
|
||||
|
||||
service_running() {
|
||||
ubus -t 10 wait_for udebug
|
||||
[ $? = 0 ] && reload_service
|
||||
}
|
Loading…
Reference in New Issue
Block a user