chore:misc

This commit is contained in:
dichgrem
2026-01-18 14:26:02 +08:00
parent 3878369ed3
commit 467c942b81
18 changed files with 57 additions and 434 deletions

View File

@@ -57,16 +57,24 @@ jobs:
FILOGIC_URL: https://downloads.immortalwrt.org/releases/24.10.3/targets/mediatek/filogic/immortalwrt-sdk-24.10.3-mediatek-filogic_gcc-13.3.0_musl.Linux-x86_64.tar.zst FILOGIC_URL: https://downloads.immortalwrt.org/releases/24.10.3/targets/mediatek/filogic/immortalwrt-sdk-24.10.3-mediatek-filogic_gcc-13.3.0_musl.Linux-x86_64.tar.zst
X86_URL: https://downloads.immortalwrt.org/releases/24.10.3/targets/x86/64/immortalwrt-sdk-24.10.3-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst X86_URL: https://downloads.immortalwrt.org/releases/24.10.3/targets/x86/64/immortalwrt-sdk-24.10.3-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst
WORK_ROOT: ${{ github.workspace }}/imwrt-sdk WORK_ROOT: ${{ github.workspace }}/imwrt-sdk
CACHE_DIR: ${{ github.workspace }}/cache
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Cache SDK
uses: actions/cache@v4
id: sdk-cache
with:
path: ${{ env.WORK_ROOT }}
key: ${{ matrix.sdk }}-sdk-24.10.3
enableCrossOsArchive: true
- name: Install dependencies - name: Install dependencies
if: steps.sdk-cache.outputs.cache-hit != 'true'
run: | run: |
echo "👉 正在下载依赖项" sudo apt-get update -qq
sudo apt-get update sudo apt-get install -y -qq build-essential git wget python3 rsync zstd g++ make libncurses-dev
sudo apt-get install -y build-essential git wget python3 rsync zstd g++ make libncurses-dev
echo "✅ 下载完毕"
- name: Set SDK variables - name: Set SDK variables
run: | run: |
@@ -86,87 +94,73 @@ jobs:
echo "👉 正在编译 ${{ matrix.sdk }} 架构 (${{ env.PACKAGE_ARCH }})" echo "👉 正在编译 ${{ matrix.sdk }} 架构 (${{ env.PACKAGE_ARCH }})"
- name: Download & extract SDK - name: Download & extract SDK
if: steps.sdk-cache.outputs.cache-hit != 'true'
run: | run: |
set -euo pipefail set -euo pipefail
mkdir -p "$WORK_ROOT" mkdir -p "$WORK_ROOT"
cd "$WORK_ROOT" cd "$WORK_ROOT"
SDK_TAR="$(basename "$SDK_URL")" SDK_TAR="$(basename "$SDK_URL")"
echo "👉 正在下载SDK$SDK_TAR" echo "下载SDK: $SDK_TAR"
wget -q "$SDK_URL" -O "$SDK_TAR" wget -q --show-progress "$SDK_URL" -O "$SDK_TAR"
echo "📦 正在解压SDK..." echo "解压SDK..."
tar --use-compress-program="zstd -q -d" -xf "$SDK_TAR" >/dev/null 2>&1 tar --use-compress-program="zstd -q -d" -xf "$SDK_TAR"
echo "✅ SDK解压完成"
SDK_ROOT="$(find . -maxdepth 1 -type d -name 'immortalwrt-sdk*' | head -n 1)" SDK_ROOT="$(find . -maxdepth 1 -type d -name 'immortalwrt-sdk*' | head -n 1)"
if [ -z "$SDK_ROOT" ]; then
echo "❌ 未找到SDK目录" >&2
exit 1
fi
SDK_ROOT="$(cd "$SDK_ROOT" && pwd)" SDK_ROOT="$(cd "$SDK_ROOT" && pwd)"
echo "SDK_ROOT=$SDK_ROOT" >> $GITHUB_ENV echo "SDK_ROOT=$SDK_ROOT" >> $GITHUB_ENV
echo "📁 SDK路径: $SDK_ROOT"
- name: Setup feeds & clone source - name: Set SDK_ROOT from cache
if: steps.sdk-cache.outputs.cache-hit == 'true'
run: |
SDK_ROOT="$(find "$WORK_ROOT" -maxdepth 1 -type d -name 'immortalwrt-sdk*' | head -n 1)"
SDK_ROOT="$(cd "$SDK_ROOT" && pwd)"
echo "SDK_ROOT=$SDK_ROOT" >> $GITHUB_ENV
echo "使用缓存的SDK: $SDK_ROOT"
- name: Setup feeds
run: | run: |
set -euo pipefail set -euo pipefail
cd "$SDK_ROOT" cd "$SDK_ROOT"
echo "👉 正在设置feeds" echo "添加 zzz feed"
echo "src-git zzz https://github.com/Dichgrem/luci-app-zzz.git" >> feeds.conf.default
echo "更新 feeds"
./scripts/feeds update -a ./scripts/feeds update -a
./scripts/feeds update luci || true ./scripts/feeds update luci
./scripts/feeds install -a -p luci || ./scripts/feeds install luci || true ./scripts/feeds update zzz
echo " feeds下载完毕" echo "安装 feeds"
cd package ./scripts/feeds install -a -p luci
git clone https://github.com/Dichgrem/luci-app-nyn.git ./scripts/feeds install luci-app-zzz zzz
cp -r luci-app-nyn/luci-app-zzz . 2>/dev/null || true
cp -r luci-app-nyn/zzz . 2>/dev/null || true
rm -rf luci-app-nyn
- name: Build luci-app-zzz - name: Build packages
run: | run: |
set -euo pipefail set -euo pipefail
cd "$SDK_ROOT" cd "$SDK_ROOT"
make defconfig make defconfig
echo "👉 正在编译中" echo "编译 luci-app-zzz 和 zzz"
make package/luci-app-zzz/compile V=s make package/luci-app-zzz/compile V=s
echo "✅ 编译完成" make package/zzz/compile V=s
- name: Collect packages - name: Collect packages
run: | run: |
set -euo pipefail set -euo pipefail
SDK_ROOT="$SDK_ROOT"
OUT="$GITHUB_WORKSPACE/output" OUT="$GITHUB_WORKSPACE/output"
mkdir -p "$OUT" mkdir -p "$OUT"
echo "🔍 自动检测 SDK 包架构目录..." echo "所有编译的 ipk 文件:"
BASE_DIR=$(find "$SDK_ROOT/bin/packages" -type d -path "*/base" | head -n1 || true) find "$SDK_ROOT/bin/packages" -name "*.ipk" -type f
if [ -z "$BASE_DIR" ]; then
echo "❌ 未找到 base 目录" >&2
ls -R "$SDK_ROOT/bin/packages" || true
exit 1
fi
echo "📦 从: $BASE_DIR 收集 luci-app-zzz 与 zzz 包..." echo ""
ls -lah "$BASE_DIR" || true echo "复制 zzz 和 luci-app-zzz 包:"
find "$SDK_ROOT/bin/packages" \( -name "zzz_*.ipk" -o -name "luci-app-zzz_*.ipk" \) -type f -exec cp {} "$OUT"/ \;
cp -v "$BASE_DIR"/*luci-app-zzz*.ipk "$OUT"/ 2>/dev/null || true echo "输出目录内容:"
cp -v "$BASE_DIR"/*zzz*.ipk "$OUT"/ 2>/dev/null || true
echo "✅ 收集完成,输出目录内容:"
ls -lah "$OUT" ls -lah "$OUT"
shell: bash
- name: Upload package luci-app-zzz - name: Upload packages
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: luci-app-zzz-${{ matrix.sdk }} name: packages-${{ matrix.sdk }}
path: output/*luci-app-zzz*.ipk path: output/*.ipk
if-no-files-found: error
- name: Upload package zzz
uses: actions/upload-artifact@v4
with:
name: zzz-${{ matrix.sdk }}
path: output/*zzz*.ipk
if-no-files-found: error if-no-files-found: error

View File

@@ -1,13 +1,11 @@
# luci-app-nyn # luci-app-zzz
**luci-app-nyn** is a Front-end interface in openwrt for nyn - the modern 802.1x standard authentication client. **luci-app-zzz** is a Front-end interface in openwrt for zzz - the modern 802.1x standard authentication client.
<p align="center"> <p align="center">
<img src="https://github.com/Dichgrem/luci-app-nyn/blob/main/screenshot.png" width="400"> <img src="https://github.com/Dichgrem/luci-app-zzz/blob/main/screenshot.png" width="400">
</p> </p>
> Attention ! The nyn project is archived and it is recommended to use the c language version of zzz instead of it ! In order to commemorate nyn, the name of this project is not modified.
## How to use ## How to use
- Step 0: Make sure you have an ``openwrt router``, ``download the ipk`` in Releases in this project, and ``upload and install`` it in the system-package of the Luci background. - Step 0: Make sure you have an ``openwrt router``, ``download the ipk`` in Releases in this project, and ``upload and install`` it in the system-package of the Luci background.
@@ -22,11 +20,11 @@
- First clone this repository to the package directory of the openwrt you want to compile: - First clone this repository to the package directory of the openwrt you want to compile:
``` ```
cd ./package ## Add feed
git clone https://github.com/Dichgrem/luci-app-nyn.git echo "src-git zzz https://github.com/Dichgrem/luci-app-zzz.git" >> feeds.conf.default
cp -r ./luci-app-nyn/luci-app-zzz ./ ## Update and install feed
cp -r ./luci-app-nyn/zzz ./ ./scripts/feeds update
rm -rf ./luci-app-nyn ./scripts/feeds install luci-app-zzz zzz
``` ```
- Then select ``Network->zzz`` and ``LuCI->Applications->luci-app-zzz`` in make menuconfig and change them to "M" state; - Then select ``Network->zzz`` and ``LuCI->Applications->luci-app-zzz`` in make menuconfig and change them to "M" state;

View File

@@ -1,9 +0,0 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for NYN 802.1x Authentication Client
LUCI_DEPENDS:=+nyn +luci-base
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@@ -1,73 +0,0 @@
-- /usr/lib/lua/luci/controller/nyn.lua
module("luci.controller.nyn", package.seeall)
function index()
if not nixio.fs.access("/etc/config/nyn") then
return
end
-- Menu
entry({"admin", "network", "nyn"}, cbi("nyn"), "NyN", 60).dependent = false
-- Settings
entry({"admin", "network", "nyn", "service_control"}, call("service_control")).leaf = true
-- Status API
entry({"admin", "network", "nyn", "get_status"}, call("act_status")).leaf = true
end
function service_control()
local sys = require "luci.sys"
local action = luci.http.formvalue("action")
local result = { success = false, message = "" }
if action then
local cmd = ""
if action == "start" then
cmd = "/etc/rc.d/S99nyn start"
elseif action == "stop" then
cmd = "/etc/rc.d/S99nyn stop"
elseif action == "restart" then
cmd = "/etc/rc.d/S99nyn stop && sleep 2 && /etc/rc.d/S99nyn start"
end
if cmd ~= "" then
local ret = sys.call(cmd)
if ret == 0 then
result.success = true
result.message = action .. " 成功"
else
result.success = false
result.message = action .. " 失败"
end
end
end
luci.http.prepare_content("application/json")
luci.http.write_json(result)
end
function act_status()
local sys = require "luci.sys"
local util = require "luci.util"
local status = {}
-- Get status
status.running = (sys.call("pgrep -f nyn >/dev/null") == 0)
-- Get process info
if status.running then
status.process_info = util.trim(sys.exec("ps | grep -v grep | grep nyn"))
end
-- Get log
local log_file = "/tmp/nyn.log"
if nixio.fs.access(log_file) then
status.log = util.trim(sys.exec("tail -20 " .. log_file))
else
status.log = util.trim(sys.exec("logread | grep nyn | tail -10"))
end
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end

View File

@@ -1,117 +0,0 @@
-- /usr/lib/lua/luci/model/cbi/nyn.lua
local m, s, o
local sys = require "luci.sys"
-- control
local start_action = luci.http.formvalue("cbid.nyn.auth.start_service")
local stop_action = luci.http.formvalue("cbid.nyn.auth.stop_service")
local restart_action = luci.http.formvalue("cbid.nyn.auth.restart_service")
if start_action then
sys.call("/etc/rc.d/S99nyn start")
elseif stop_action then
sys.call("/etc/rc.d/S99nyn stop")
elseif restart_action then
sys.call("/etc/rc.d/S99nyn stop; sleep 2; /etc/rc.d/S99nyn start")
end
m = Map("nyn", "NYN 802.1x 认证客户端",
"配置使用 NYN 客户端进行网络访问的 802.1x 认证")
-- Authentication Settings
s = m:section(TypedSection, "auth", "认证设置")
s.anonymous = true
s.addremove = false
-- Service Status
o = s:option(DummyValue, "_status", "当前状态")
o.rawhtml = true
o.cfgvalue = function()
local sys = require "luci.sys"
local running = sys.call("pgrep nyn >/dev/null") == 0
if running then
return "<span style='color:green;font-weight:bold'>✔ 正在运行中</span>"
else
return "<span style='color:red;font-weight:bold'>✘ 未运行</span>"
end
end
-- control buttons
control_buttons = s:option(DummyValue, "_control", "服务控制")
control_buttons.rawhtml = true
control_buttons.cfgvalue = function()
return [[
<div style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;">
<input type="submit" class="cbi-button cbi-button-apply"
name="cbid.nyn.auth.start_service" value="启动服务" />
<input type="submit" class="cbi-button cbi-button-remove"
name="cbid.nyn.auth.stop_service" value="停止服务" />
<input type="submit" class="cbi-button cbi-button-reload"
name="cbid.nyn.auth.restart_service" value="重启服务" />
</div>
]]
end
-- Username
o = s:option(Value, "user", "用户名", "802.1x 认证用户名")
o.password = true
o.rmempty = false
-- Password
o = s:option(Value, "password", "密码", "802.1x 认证密码")
o.password = true
o.rmempty = false
-- Network Device
o = s:option(ListValue, "device", "网络接口", "用于认证的网络接口")
o.rmempty = false
o:value("eth0", "eth0")
o:value("eth1", "eth1")
o:value("wan", "WAN")
-- Add network interface
local interfaces = sys.net.devices()
for _, iface in ipairs(interfaces) do
if iface ~= "lo" then
o:value(iface, iface)
end
end
-- Auto start
auto_start = s:option(Flag, "auto_start", "启用定时启动")
auto_start.description = "启用后将在每周一至周五的 7:00 自动启动服务"
auto_start.rmempty = false
-- Get Status
auto_start.cfgvalue = function(self, section)
local has_cron = sys.call("crontab -l 2>/dev/null | grep 'S99nyn' >/dev/null") == 0
return has_cron and "1" or "0"
end
-- Crontab
auto_start.write = function(self, section, value)
if value == "1" then
-- 启用定时任务:每周一至周五 7:00 启动
sys.call("(crontab -l 2>/dev/null | grep -v 'S99nyn' | grep -v '# nyn auto') | crontab - 2>/dev/null")
sys.call("(crontab -l 2>/dev/null; echo '0 7 * * 1,2,3,4,5 /etc/rc.d/S99nyn start # nyn auto start') | crontab -")
sys.call("/etc/init.d/cron enable && /etc/init.d/cron restart")
else
-- 禁用定时任务
sys.call("(crontab -l 2>/dev/null | grep -v 'S99nyn' | grep -v '# nyn auto') | crontab - 2>/dev/null")
sys.call("/etc/init.d/cron restart")
end
end
-- Crontab Status
timer_status_display = s:option(DummyValue, "_timer_status_display", "定时任务状态")
timer_status_display.rawhtml = true
timer_status_display.cfgvalue = function()
local cron_output = sys.exec("crontab -l 2>/dev/null | grep 'S99nyn' || echo '未设置'")
if cron_output:match("S99nyn") then
return "<span style='color:green;font-weight:bold'>✔ 已启用 (每周一至周五 7:00 自动启动)</span>"
else
return "<span style='color:red;font-weight:bold'>✘ 未启用</span>"
end
end
return m

View File

@@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for NYN 802.1x Authentication Client LUCI_TITLE:=LuCI support for ZZZ 802.1x Authentication Client
LUCI_DEPENDS:=+zzz +luci-base LUCI_DEPENDS:=+zzz +luci-base
PKG_VERSION:=1.1.0 PKG_VERSION:=2.0.0
PKG_RELEASE:=1 PKG_RELEASE:=1
include $(TOPDIR)/feeds/luci/luci.mk include $(TOPDIR)/feeds/luci/luci.mk

View File

@@ -1,66 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nyn
PKG_VERSION:=0.0.3
PKG_RELEASE:=1
PKG_MAINTAINER:=Dichgrem <brcefy@gmail.com>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk
define Package/nyn
SECTION:=net
CATEGORY:=Network
TITLE:=NYN 802.1x Authentication Client
URL:=https://github.com/diredocks/nyn
DEPENDS:=+libpcap
endef
define Package/nyn/description
A 802.1x authentication client for OpenWrt routers.
Cross-compiled with musl toolchain for optimal compatibility.
endef
define Package/nyn/conffiles
/etc/config/nyn
/etc/nyn/config.toml
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/nyn/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/nyn
# Install precompiled binary based on architecture
$(if $(CONFIG_TARGET_x86_64),$(INSTALL_BIN) ./files/bin/nyn-x86_64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_armvirt_64),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_bcm27xx_bcm2711),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_ath79_generic),$(INSTALL_BIN) ./files/bin/nyn-mips64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_ramips_mt7621),$(INSTALL_BIN) ./files/bin/nyn-mips64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_mediatek_mt7622),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_rockchip_armv8),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
# Fallback - try to detect architecture
$(if $(findstring arm,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-armv7 $(1)/usr/bin/nyn)
$(if $(findstring aarch64,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(findstring mips,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-mips64 $(1)/usr/bin/nyn)
$(if $(findstring x86_64,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-x86_64 $(1)/usr/bin/nyn)
$(if $(findstring i386,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-i686 $(1)/usr/bin/nyn)
$(INSTALL_BIN) ./files/usr/bin/nyn-device-info $(1)/usr/bin/
$(INSTALL_CONF) ./files/etc/config/nyn $(1)/etc/config/
$(INSTALL_CONF) ./files/etc/nyn/config.toml $(1)/etc/nyn/
$(INSTALL_BIN) ./files/etc/init.d/nyn $(1)/etc/init.d/
endef
$(eval $(call BuildPackage,nyn))

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,16 +0,0 @@
config general 'general'
option enabled '0'
option timeout '5'
option retry '5'
option schedule_callback '0'
config crypto 'crypto'
option win_ver 'r70393861'
option client_key 'Oly5D62FaE94W7'
option client_version ''
config auth 'auth'
option user ''
option password ''
option device 'eth0'
option hardware_description ''

View File

@@ -1,41 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
CONFIG=/etc/nyn/config.toml
start_service() {
generate_config
procd_open_instance
procd_set_param command /usr/bin/nyn -config "$CONFIG"
procd_set_param respawn
procd_close_instance
}
stop_service() {
procd_kill nyn
}
generate_config() {
mkdir -p /etc/nyn
cat >"$CONFIG" <<EOF
# Auto-generated by UCI
[general]
timeout = $(uci -q get nyn.general.timeout)
retry = $(uci -q get nyn.general.retry)
schedule_callback = $([ "$(uci -q get nyn.general.schedule_callback)" = "1" ] && echo "true" || echo "false")
[crypto]
win_ver = "$(uci -q get nyn.crypto.win_ver)"
client_key = "$(uci -q get nyn.crypto.client_key)"
[[auth]]
user = "$(uci -q get nyn.auth.user)"
password = "$(uci -q get nyn.auth.password)"
device = "$(uci -q get nyn.auth.device)"
EOF
}

View File

@@ -1,18 +0,0 @@
# Default configuration for NYN 802.1x client
# This file will be generated by UCI system
[general]
timeout = 5
retry = 5
schedule_callback = false
[crypto]
win_ver = "r70393861"
client_key = "Oly5D62FaE94W7"
# client_version = ""
[[auth]]
user = ""
password = ""
device = "eth0"
# hardware_description = ""

View File

@@ -1,29 +0,0 @@
#!/bin/sh
# /usr/bin/nyn-device-info
# Helper script to get device information for NYN configuration
echo "Available network devices:"
echo "=========================="
if command -v nyn >/dev/null 2>&1; then
nyn -mode info 2>/dev/null | grep -E "(Found|device|hardware_description)" | while read line; do
echo "$line"
done
else
echo "NYN binary not found. Showing available network interfaces:"
for dev in /sys/class/net/*; do
if [ -d "$dev" ]; then
iface=$(basename "$dev")
if [ "$iface" != "lo" ]; then
echo "Device: $iface"
if [ -f "$dev/address" ]; then
echo " MAC: $(cat "$dev/address")"
fi
if [ -f "$dev/operstate" ]; then
echo " State: $(cat "$dev/operstate")"
fi
echo ""
fi
fi
done
fi

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=zzz PKG_NAME:=zzz
PKG_VERSION:=0.1.1 PKG_VERSION:=2.0.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=Dichgrem <brcefy@gmail.com> PKG_MAINTAINER:=Dichgrem <brcefy@gmail.com>