🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
#
# Copyright (C) 2009-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:=switch-lan-play
PKG_VERSION:=0.2.3
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=1be20e1905f6ed2b2136f29f0c5aa66f2f8de04e
PKG_SOURCE_URL:=https://github.com/spacemeowx2/switch-lan-play.git
PKG_MIRROR_HASH:=skip
#PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE.TXT
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_BINARY_SUBDIR := build-openwrt
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Lan-play
DEPENDS:=+libpcap +libpthread +libstdcpp +libatomic @!USE_UCLIBC
TITLE:=Switch Lan Play Client
endef
define Package/switch-lan-play/conffiles
/etc/config/switchlanplay
endef
define Package/$(PKG_NAME)/description
Make you and your friends play games like in a LAN.
endef
#define Build/Prepare
# mkdir -p $(PKG_BUILD_DIR)
# $(CP) ./$(PKG_NAME)/* $(PKG_BUILD_DIR)/
#endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/build-openwrt/src/lan-play $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/switchlanplay.config $(1)/etc/config/switchlanplay
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/switchlanplay.init $(1)/etc/init.d/switchlanplay
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
@@ -0,0 +1,6 @@
config switch-lan-play
option enable '0'
option ifname 'br-lan'
option relay_server_host '127.0.0.1'
option relay_server_port '11451'
option pmtu '0'
+58
View File
@@ -0,0 +1,58 @@
#!/bin/sh /etc/rc.common
START=99
SERVICE=switchlanplay
USE_PROCD=1
run_switch_lan_play()
{
config_get_bool enable $1 enable
if [ "$enable" -gt 0 ]; then
local ifname
config_get ifname $1 ifname
local relay_server_host
local relay_server_port
config_get relay_server_host $1 relay_server_host
config_get relay_server_port $1 relay_server_port
config_get pmtu $1 pmtu
if [ "$pmtu" -gt 0 ]; then
PROG="lan-play --relay-server-addr $relay_server_host:$relay_server_port --netif $ifname --pmtu $pmtu"
else
PROG="lan-play --relay-server-addr $relay_server_host:$relay_server_port --netif $ifname"
fi
echo "switch-lan-play client started."
else
PROG="lan-play --version"
echo "switch-lan-play is disabled. check configuration?"
fi
}
start_service()
{
config_load switchlanplay
config_foreach run_switch_lan_play switch-lan-play
procd_open_instance
procd_set_param command $PROG
procd_close_instance
echo $PROG
}
stop_service()
{
pgrep lan-play | xargs -r kill -9
echo "switch-lan-play client stopped."
}
reload_service()
{
stop
start
}
service_triggers()
{
procd_add_reload_trigger "/etc/config/switchlanplay" "switchlanplay"
}