diff --git a/.github/workflows/build-zzz.yml b/.github/workflows/build-zzz.yml index 6113258..124b4c5 100644 --- a/.github/workflows/build-zzz.yml +++ b/.github/workflows/build-zzz.yml @@ -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 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 + CACHE_DIR: ${{ github.workspace }}/cache steps: - name: Checkout 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 + if: steps.sdk-cache.outputs.cache-hit != 'true' run: | - echo "👉 正在下载依赖项" - sudo apt-get update - sudo apt-get install -y build-essential git wget python3 rsync zstd g++ make libncurses-dev - echo "✅ 下载完毕" + sudo apt-get update -qq + sudo apt-get install -y -qq build-essential git wget python3 rsync zstd g++ make libncurses-dev - name: Set SDK variables run: | @@ -86,87 +94,73 @@ jobs: echo "👉 正在编译 ${{ matrix.sdk }} 架构 (${{ env.PACKAGE_ARCH }})" - name: Download & extract SDK + if: steps.sdk-cache.outputs.cache-hit != 'true' run: | set -euo pipefail mkdir -p "$WORK_ROOT" cd "$WORK_ROOT" SDK_TAR="$(basename "$SDK_URL")" - echo "👉 正在下载SDK:$SDK_TAR" - wget -q "$SDK_URL" -O "$SDK_TAR" + echo "下载SDK: $SDK_TAR" + wget -q --show-progress "$SDK_URL" -O "$SDK_TAR" - echo "📦 正在解压SDK..." - tar --use-compress-program="zstd -q -d" -xf "$SDK_TAR" >/dev/null 2>&1 + echo "解压SDK..." + 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)" - if [ -z "$SDK_ROOT" ]; then - echo "❌ 未找到SDK目录" >&2 - exit 1 - fi SDK_ROOT="$(cd "$SDK_ROOT" && pwd)" 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: | set -euo pipefail 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 luci || true - ./scripts/feeds install -a -p luci || ./scripts/feeds install luci || true - echo "✅ feeds下载完毕" - cd package - git clone https://github.com/Dichgrem/luci-app-nyn.git - 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 + ./scripts/feeds update luci + ./scripts/feeds update zzz + echo "安装 feeds" + ./scripts/feeds install -a -p luci + ./scripts/feeds install luci-app-zzz zzz - - name: Build luci-app-zzz + - name: Build packages run: | set -euo pipefail cd "$SDK_ROOT" make defconfig - echo "👉 正在编译中" + echo "编译 luci-app-zzz 和 zzz" make package/luci-app-zzz/compile V=s - echo "✅ 编译完成" + make package/zzz/compile V=s - name: Collect packages run: | set -euo pipefail - SDK_ROOT="$SDK_ROOT" OUT="$GITHUB_WORKSPACE/output" mkdir -p "$OUT" - echo "🔍 自动检测 SDK 包架构目录..." - BASE_DIR=$(find "$SDK_ROOT/bin/packages" -type d -path "*/base" | head -n1 || true) - if [ -z "$BASE_DIR" ]; then - echo "❌ 未找到 base 目录" >&2 - ls -R "$SDK_ROOT/bin/packages" || true - exit 1 - fi + echo "所有编译的 ipk 文件:" + find "$SDK_ROOT/bin/packages" -name "*.ipk" -type f - echo "📦 从: $BASE_DIR 收集 luci-app-zzz 与 zzz 包..." - ls -lah "$BASE_DIR" || true + echo "" + 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 - cp -v "$BASE_DIR"/*zzz*.ipk "$OUT"/ 2>/dev/null || true - - echo "✅ 收集完成,输出目录内容:" + echo "输出目录内容:" ls -lah "$OUT" - shell: bash - - name: Upload package luci-app-zzz + - name: Upload packages uses: actions/upload-artifact@v4 with: - name: luci-app-zzz-${{ matrix.sdk }} - path: output/*luci-app-zzz*.ipk - if-no-files-found: error - - - name: Upload package zzz - uses: actions/upload-artifact@v4 - with: - name: zzz-${{ matrix.sdk }} - path: output/*zzz*.ipk + name: packages-${{ matrix.sdk }} + path: output/*.ipk if-no-files-found: error diff --git a/README.md b/README.md index 41098e4..0664147 100644 --- a/README.md +++ b/README.md @@ -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.

- +

-> 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 - 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: ``` -cd ./package -git clone https://github.com/Dichgrem/luci-app-nyn.git -cp -r ./luci-app-nyn/luci-app-zzz ./ -cp -r ./luci-app-nyn/zzz ./ -rm -rf ./luci-app-nyn +## Add feed +echo "src-git zzz https://github.com/Dichgrem/luci-app-zzz.git" >> feeds.conf.default +## Update and install feed +./scripts/feeds update +./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; diff --git a/luci-app-nyn/Makefile b/luci-app-nyn/Makefile deleted file mode 100644 index 5988f8f..0000000 --- a/luci-app-nyn/Makefile +++ /dev/null @@ -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 - diff --git a/luci-app-nyn/luasrc/controller/nyn.lua b/luci-app-nyn/luasrc/controller/nyn.lua deleted file mode 100644 index 9b38854..0000000 --- a/luci-app-nyn/luasrc/controller/nyn.lua +++ /dev/null @@ -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 diff --git a/luci-app-nyn/luasrc/model/cbi/nyn.lua b/luci-app-nyn/luasrc/model/cbi/nyn.lua deleted file mode 100644 index b28660a..0000000 --- a/luci-app-nyn/luasrc/model/cbi/nyn.lua +++ /dev/null @@ -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 "✔ 正在运行中" - else - return "✘ 未运行" - end -end - --- control buttons -control_buttons = s:option(DummyValue, "_control", "服务控制") -control_buttons.rawhtml = true -control_buttons.cfgvalue = function() - return [[ -
- - - -
- ]] -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 "✔ 已启用 (每周一至周五 7:00 自动启动)" - else - return "✘ 未启用" - end -end - -return m diff --git a/luci-app-zzz/Makefile b/luci-app-zzz/Makefile index 46443aa..c5607db 100644 --- a/luci-app-zzz/Makefile +++ b/luci-app-zzz/Makefile @@ -1,8 +1,8 @@ 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 -PKG_VERSION:=1.1.0 +PKG_VERSION:=2.0.0 PKG_RELEASE:=1 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/nyn/Makefile b/nyn/Makefile deleted file mode 100644 index ef50f49..0000000 --- a/nyn/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME:=nyn -PKG_VERSION:=0.0.3 -PKG_RELEASE:=1 - -PKG_MAINTAINER:=Dichgrem -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)) diff --git a/nyn/files/bin/nyn-aarch64 b/nyn/files/bin/nyn-aarch64 deleted file mode 100644 index de35d12..0000000 Binary files a/nyn/files/bin/nyn-aarch64 and /dev/null differ diff --git a/nyn/files/bin/nyn-armv7 b/nyn/files/bin/nyn-armv7 deleted file mode 100644 index cfc838d..0000000 Binary files a/nyn/files/bin/nyn-armv7 and /dev/null differ diff --git a/nyn/files/bin/nyn-i686 b/nyn/files/bin/nyn-i686 deleted file mode 100644 index 30b5318..0000000 Binary files a/nyn/files/bin/nyn-i686 and /dev/null differ diff --git a/nyn/files/bin/nyn-mips64 b/nyn/files/bin/nyn-mips64 deleted file mode 100644 index cb3a19b..0000000 Binary files a/nyn/files/bin/nyn-mips64 and /dev/null differ diff --git a/nyn/files/bin/nyn-riscv64 b/nyn/files/bin/nyn-riscv64 deleted file mode 100644 index 8f9568a..0000000 Binary files a/nyn/files/bin/nyn-riscv64 and /dev/null differ diff --git a/nyn/files/bin/nyn-x86_64 b/nyn/files/bin/nyn-x86_64 deleted file mode 100644 index c1b7f35..0000000 Binary files a/nyn/files/bin/nyn-x86_64 and /dev/null differ diff --git a/nyn/files/etc/config/nyn b/nyn/files/etc/config/nyn deleted file mode 100644 index 488bca6..0000000 --- a/nyn/files/etc/config/nyn +++ /dev/null @@ -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 '' diff --git a/nyn/files/etc/init.d/nyn b/nyn/files/etc/init.d/nyn deleted file mode 100644 index 7b7a3c8..0000000 --- a/nyn/files/etc/init.d/nyn +++ /dev/null @@ -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" </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 diff --git a/zzz/Makefile b/zzz/Makefile index f76a661..ed442b2 100644 --- a/zzz/Makefile +++ b/zzz/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zzz -PKG_VERSION:=0.1.1 +PKG_VERSION:=2.0.0 PKG_RELEASE:=1 PKG_MAINTAINER:=Dichgrem