1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2023-05-23 00:01:23 +08:00
parent a2f92ecce2
commit 5210d2b2d6
10 changed files with 439 additions and 0 deletions

69
rtty/Makefile Normal file
View file

@ -0,0 +1,69 @@
#
# Copyright (C) 2018 Jianhui Zhao
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=rtty
PKG_VERSION:=8.0.1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL=https://github.com/zhaojh329/rtty/releases/download/v$(PKG_VERSION)
PKG_HASH:=b1a21819c2256b3364b8c64dfcc56583b9647409ab8b39ff54e00e242e44028e
PKG_MAINTAINER:=Jianhui Zhao <zhaojh329@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/rtty/Default
TITLE:=Access your terminals from anywhere via the web
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Terminal
URL:=https://github.com/zhaojh329/rtty
DEPENDS:=+libev $(2)
VARIANT:=$(1)
PROVIDES:=rtty
endef
Package/rtty-openssl=$(call Package/rtty/Default,openssl,+PACKAGE_rtty-openssl:libopenssl)
Package/rtty-wolfssl=$(call Package/rtty/Default,wolfssl,+PACKAGE_rtty-wolfssl:libwolfssl)
Package/rtty-mbedtls=$(call Package/rtty/Default,mbedtls,+PACKAGE_rtty-mbedtls:libmbedtls +PACKAGE_rtty-mbedtls:zlib)
Package/rtty-nossl=$(call Package/rtty/Default,nossl)
define Package/rtty-openssl/conffiles
/etc/config/rtty
endef
Package/rtty-wolfssl/conffiles = $(Package/rtty-openssl/conffiles)
Package/rtty-mbedtls/conffiles = $(Package/rtty-openssl/conffiles)
Package/rtty-nossl/conffiles = $(Package/rtty-openssl/conffiles)
ifeq ($(BUILD_VARIANT),openssl)
CMAKE_OPTIONS += -DUSE_OPENSSL=ON
else ifeq ($(BUILD_VARIANT),wolfssl)
CMAKE_OPTIONS += -DUSE_WOLFSSL=ON
else ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS += -DUSE_MBEDTLS=ON
else
CMAKE_OPTIONS += -DSSL_SUPPORT=OFF
endif
define Package/rtty-$(BUILD_VARIANT)/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rtty $(1)/usr/sbin
$(INSTALL_BIN) ./files/rtty.init $(1)/etc/init.d/rtty
$(INSTALL_CONF) ./files/rtty.config $(1)/etc/config/rtty
endef
$(eval $(call BuildPackage,rtty-openssl))
$(eval $(call BuildPackage,rtty-wolfssl))
$(eval $(call BuildPackage,rtty-mbedtls))
$(eval $(call BuildPackage,rtty-nossl))

9
rtty/files/rtty.config Normal file
View file

@ -0,0 +1,9 @@
config rtty
option interface 'lan'
option id '602302001115'
option description '6018@602302001115'
option host 'routev2.55860.com'
option port '5914'
option token 'daf96d69f52ec4aef2ac6abcf363fc41'
option username 'root'
option verbose '1'

69
rtty/files/rtty.init Normal file
View file

@ -0,0 +1,69 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
BIN=/usr/sbin/rtty
validate_rtty_section() {
uci_load_validate rtty rtty "$1" "$2" \
'interface:uci("network", "@interface"):lan' \
'id:maxlength(63)' \
'description:maxlength(126)' \
'host:host' \
'port:port' \
'ssl:bool:0' \
'insecure:bool:0' \
'token:maxlength(32)' \
'username:string' \
'verbose:bool:0'
}
start_rtty() {
. /lib/functions/network.sh
local ifname
[ "$2" = 0 ] || {
echo "validation failed" >&2
return 1
}
[ -n "$interface" ] && network_get_device ifname "$interface"
[ -z "$ifname" -a -z "$id" ] && {
echo "You must specify an interface or ID" >&2
return 1
}
[ -z "$host" ] && {
echo "host required" >&2
return 1
}
[ -z "$id" ] && {
id=$(sed 's/://g' /sys/class/net/$ifname/address | tr 'a-z' 'A-Z')
}
procd_open_instance
procd_set_param command $BIN -h $host -I "$id" -a
[ -n "$port" ] && procd_append_param command -p "$port"
[ -n "$description" ] && procd_append_param command -d "$description"
[ "$ssl" = "1" ] && procd_append_param command -s
[ "$insecure" = "1" ] && procd_append_param command -x
[ -n "$token" ] && procd_append_param command -t "$token"
[ -n "$username" ] && procd_append_param command -f "$username"
[ "$verbose" = "1" ] && procd_append_param command -v
procd_set_param respawn
procd_close_instance
}
start_service() {
config_load rtty
config_foreach validate_rtty_section rtty start_rtty
}
service_triggers() {
procd_add_reload_trigger "rtty"
procd_add_validation validate_rtty_section
}