HSIAO-YANG CHEN 发布的文章

补料申请单需要手动选生产订单号和行号,效率低,操作不方便,特写这个小工具,批量填充,曲线救国。
捕获.PNG

;**** 参数创建于 AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <WinAPIConstants.au3>
; *** End added by AutoIt3Wrapper ***
#Region
#AutoIt3Wrapper_Icon=msra.ico
#AutoIt3Wrapper_Outfile_x64=U8补料申请单批量处理.exe
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Comment=U8补料申请单批量处理
#AutoIt3Wrapper_Res_Description=U8补料申请单批量处理
#AutoIt3Wrapper_Res_Fileversion=3.2.0.0
#AutoIt3Wrapper_Res_ProductName=U8补料申请单批量处理
#AutoIt3Wrapper_Res_ProductVersion=2.0
#AutoIt3Wrapper_Res_LegalCopyright=HSIAOYANG CHEN
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=2052
#AutoIt3Wrapper_Res_requestedExecutionLevel=None
#EndRegion


#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <AutoItConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

#include <Misc.au3>
If _Singleton("SHOYO", 1) = 0 Then ;禁止多个程序同时运行
    ;MsgBox($MB_SYSTEMMODAL, "Warning", "An occurrence of test is already running")
    Exit
EndIf

main()

;将设置的参数从注册表读取出来使用
Func init()

    Global $pn, $pny, $num, $origx, $origy, $high, $wide, $line, $stop
    RegEnumVal("HKEY_CURRENT_USER\SOFTWARE\SHOYO", 1)
    If @error = 0 Then
        GUICtrlSetData($idFile1, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "pn"))
        GUICtrlSetData($idFile2, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "pny"))
        GUICtrlSetData($idFile3, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "num"))
        GUICtrlSetData($idFile4, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "origx"))
        GUICtrlSetData($idFile5, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "high"))
        GUICtrlSetData($idFile6, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "origy"))
        GUICtrlSetData($idFile7, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "wide"))
        GUICtrlSetData($idFile8, RegRead("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "line"))
    EndIf

EndFunc   ;==>init

;鼠标操作核心算法
Func start()
    Local $hWnd = WinGetHandle("[CLASS:ThunderRT6FormDC]")  ; 获取U8窗口句柄

    If $hWnd Then

        ProcessSetPriority("EnterprisePortal.exe", $PROCESS_ABOVENORMAL);提高U8响应优先级

        ;Mod($num,10)  一组10次,求余数
        ;Int($num/10)  一组10次,求操作趟数

        BlockInput(1) ;禁止外设输入
        ;MouseMove($origx , $origy,100)
        ;MouseClick ( "left" , $origx , $origy, 1, 50 )
        ;Opt("MouseClickDelay", 500) ;10 milliseconds
        $tmp = $num ;tmp临时变量,作为$num和$i的储存
        GUICtrlSetColor($idFile8l, 0x0000FF)
        GUICtrlSetColor($idFile3l, 0x00FF00)
        GUICtrlSetColor($idBtn,0xFF0000)
        GUICtrlSetData($idFile3l, "剩余行数:")
        GUICtrlSetData($idBtn, "进行中...")
        GUICtrlSetData($idFile8l, "执行次数:")
        For $j = 0 To Int($num / 10)
            For $i = 0 To ($j = Int($num / 10) ? Mod($num, 10) - 1 : 9)
                MouseClick("left", $origx, $origy + $i * $high, 1, 30)
                Send($pn)
                MouseClick("left", $origx + $wide, $origy + $i * $high, 1, 30)
                Send($pny)
                $line += 1
                GUICtrlSetData($idFile8, $line)
                $tmp -= 1
                GUICtrlSetData($idFile3, $tmp)
                Sleep(10) ;休眠,暂停线程,给主程序处理esc事件提供时间
                If $stop = 1 Then
                    $tmp = $i
                    $i = ($j = Int($num / 10) ? Mod($num, 10) - 1 : 9)

                EndIf
            Next
            If $stop = 1 Then
                $i = $tmp + 1
            EndIf
            If Not ($j* 10 = $num) Then
                MouseClick("left", $origx - $wide / 2, $origy + ($i-1) * $high, 1, 30)
            EndIf

            Sleep(10) ;休眠,暂停线程,给主程序处理esc事件提供时间

            If ($tmp > 0) And ($stop = 0) Then

                Sleep(500 + 22000 * ($line / 1000)) ;数据行数越多,系统延迟越大,加长等待时间

                For $i = 0 To ((($j = Int($num / 10)) Or (($j+1) * 10 = $num)) ? -1 : 9) ;最尾页的处理:最后一页不进行翻页,整数页也不翻页处理。
                    MouseWheel($MOUSE_WHEEL_DOWN, 1)
                    Sleep(500 + 250 * ($line / 1000))
                Next

            EndIf
            If $stop = 1 Then
                $j = Int($num / 10)
            EndIf
        Next
        GUICtrlSetColor($idFile8l, 0x000000)
        GUICtrlSetData($idFile3l, "填充行数:")
        GUICtrlSetColor($idFile3l, 0x000000)
        GUICtrlSetData($idBtn,"开始填充")
        GUICtrlSetColor($idBtn,0x000000)
        BlockInput(0) ;允许外设输入
        ProcessSetPriority("EnterprisePortal.exe", $PROCESS_NORMAL);恢复默认U8响应优先级
    Else
        MsgBox($MB_ICONERROR, "", "未找到U8补料申请单窗口!", 10)
    EndIf

EndFunc   ;==>start

;绘制图形窗口
Func main()

    GUICreate("U8补料申请单批量处理", 320, 200, @DesktopWidth / 2 + 200, @DesktopHeight / 2 - 100, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST))
    GUISetIcon(@SystemDir & "\System32\msra.exe", 0)
    GUICtrlCreateLabel("生产订单号:", 10, 15, 100)     ;x=10,y=15,长度100
    Global $idFile1 = GUICtrlCreateInput("2024040003", 100, 10, 200, 20)     ;x=100,y=10,长度200,高度20
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateLabel("生产订单行号:", 10, 15 + 30, 90)
    Global $idFile2 = GUICtrlCreateInput("1", 100, 40, 50, 20, $ES_NUMBER)     ;限制数字类型
    GUICtrlSetStyle(-1, $SS_RIGHT)
    GUICtrlSetLimit(-1, 4, 1)      ;限制字符最大长度4,最小1,
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    Global $idFile3l = GUICtrlCreateLabel("填充行数:", 180, 15 + 30, 70)
    Global $idFile3 = GUICtrlCreateInput("10", 250, 40, 50, 20, $ES_NUMBER)
    GUICtrlSetStyle(-1, $SS_RIGHT)
    GUICtrlSetLimit(-1, 3, 1)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateLabel("原点坐标X:", 10, 15 + 30 + 30, 90)
    Global $idFile4 = GUICtrlCreateInput("500", 100, 70, 50, 20, $ES_NUMBER)
    GUICtrlSetStyle(-1, $SS_RIGHT)
    GUICtrlSetLimit(-1, 4, 1)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateLabel("行高:", 180, 15 + 30 + 30, 70)
    Global $idFile5 = GUICtrlCreateInput("25", 250, 70, 50, 20, $ES_NUMBER)
    GUICtrlSetStyle(-1, $SS_RIGHT)
    GUICtrlSetLimit(-1, 2, 1)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateLabel("原点坐标Y:", 10, 15 + 30 + 30 + 30, 90)
    Global $idFile6 = GUICtrlCreateInput("320", 100, 100, 50, 20, $ES_NUMBER)
    GUICtrlSetStyle(-1, $SS_RIGHT)
    GUICtrlSetLimit(-1, 4, 1)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateLabel("行宽:", 180, 15 + 30 + 30 + 30, 70)
    Global $idFile7 = GUICtrlCreateInput("100", 250, 100, 50, 20, $ES_NUMBER)
    GUICtrlSetStyle(-1, $SS_RIGHT)
    GUICtrlSetLimit(-1, 3, 1)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    Global $idBtn = GUICtrlCreateButton("开始填充", 110, 140, 100, 40)
    ;GUICtrlSetFont(-1,16)
    GUICtrlCreateLabel("X/Y轴坐标:", 10, 15 + 30 + 30 + 30 + 30, 90)
    ;GUICtrlSetFont(-1,13)
    Global $Label1 = GUICtrlCreateLabel("0/0", 10, 15 + 30 + 30 + 30 + 30 + 20, 90)
    GUICtrlSetFont($Label1, 12)

    Global $idFile8l = GUICtrlCreateLabel("执行次数:", 245, 15 + 30 + 30 + 30 + 30, 100)
    Global $idFile8 = GUICtrlCreateInput("1", 250, 15 + 30 + 30 + 30 + 30 + 20, 50, 20, $ES_NUMBER)
    GUICtrlSetStyle(-1, $SS_RIGHT)
    GUICtrlSetLimit(-1, 4, 1)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)

    GUISetState(@SW_SHOW)

    init()

    HotKeySet("{Esc}", "_Stop")
    Global $_whand = DllCallbackRegister("_Mouse_Events_Handler", "int", "int;ptr;ptr")
    Local $_whmod = _WinAPI_GetModuleHandle(0)
    Global $_whook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($_whand), $_whmod)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "pn", "REG_SZ", GUICtrlRead($idFile1))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "pny", "REG_SZ", GUICtrlRead($idFile2))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "num", "REG_SZ", GUICtrlRead($idFile3))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "origx", "REG_SZ", GUICtrlRead($idFile4))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "high", "REG_SZ", GUICtrlRead($idFile5))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "origy", "REG_SZ", GUICtrlRead($idFile6))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "wide", "REG_SZ", GUICtrlRead($idFile7))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\SHOYO", "line", "REG_SZ", GUICtrlRead($idFile8))
                Sleep(100)
                ExitLoop
            Case $idBtn
                $pn = GUICtrlRead($idFile1)
                $pny = GUICtrlRead($idFile2)
                $num = GUICtrlRead($idFile3)
                $origx = GUICtrlRead($idFile4)
                $high = GUICtrlRead($idFile5)
                $origy = GUICtrlRead($idFile6)
                $wide = GUICtrlRead($idFile7)
                $line = GUICtrlRead($idFile8)
                $stop = 0
                If MsgBox($MB_YESNO, "🐇执行信息核对", "生产订单号:" & $pn & @CRLF & "生产订单行号:" & $pny & @CRLF & "填充行数:" & $num & @CRLF & "原点坐标X/Y:" & $origx & "/" & $origy & @CRLF & "行高/行宽:" & $high & "/" & $wide & @CRLF & @CRLF & "按ESC键,可中断运行!" & @CRLF) < 7 Then
                    start()
                EndIf

        EndSwitch
    WEnd

EndFunc   ;==>main

Func _Mouse_Events_Handler($wnCode, $wwParam, $wlParam)
    Switch $wwParam
        Case $WM_MOUSEMOVE         ;
            Local $aPos = MouseGetPos()
            Local $iX = $aPos[0]
            Local $iY = $aPos[1]

            GUICtrlSetData($Label1, $iX & '/' & $iY & @CRLF)
            ;ConsoleWrite($iX & '/' & $iY & @CRLF)
    EndSwitch
EndFunc   ;==>_Mouse_Events_Handler


Func _Stop()
    $stop = 1
EndFunc   ;==>_Stop

下载地址:U8补料申请单批量处理.zip

跟随官方更新了

--- feeds/thunder/openwrt/luci-app-thunder/luasrc/model/cbi/thunder/client.lua
+++ feeds/thunder/openwrt/luci-app-thunder/luasrc/model/cbi/thunder/client.lua
@@ -1,3 +1,6 @@
+local sys  = require "luci.sys"
+local util = require "luci.util"
+
 local m, s
 
 m = Map("thunder", translate("Thunder"))
@@ -15,8 +18,16 @@
 o = s:option(Flag, "debug", translate("Debug"))
 o.rmempty = false
 
-o = s:option(Value, "bind", translate("Bind"))
-o.default = "0.0.0.0:5055"
+user = s:option(ListValue, "user", translate("Run daemon as user"))
+local p_user
+for _, p_user in util.vspairs(util.split(sys.exec("cat /etc/passwd | cut -f 1 -d :"))) do
+    user:value(p_user)
+end
+
+
+
+o = s:option(Value, "port", translate("Port"))
+o.default = "5055"
 
 o = s:option(Value, "auth_password", translate("Password"))


--- feeds/thunder/openwrt/thunder/files/thunder.config
+++ feeds/thunder/openwrt/thunder/files/thunder.config
@@ -2,7 +2,7 @@
 config thunder
     option 'enabled' '0'
     option 'debug' '0'
-    option 'bind' '0.0.0.0:5055'
+    option 'user' 'root'
     option 'port' '5055'
     option 'auth_password' ''
     option 'download_path' '/opt/thunder/downloads'

--- feeds/thunder/openwrt/thunder/files/thunder.init
+++ feeds/thunder/openwrt/thunder/files/thunder.init
@@ -7,7 +7,8 @@
 get_config() {
     config_get_bool enabled $1 enabled 0
     config_get_bool debug $1 debug 0
-    config_get bind $1 bind "0.0.0.0:5055"
+    config_get port $1 port "5055"
+    config_get user $1 user "root"
     config_get auth_password $1 auth_password ''
     config_get config_path $1 config_path "/opt/thunder"
     config_get download_path $1 download_path "/opt/thunder/downloads"
@@ -41,12 +42,6 @@
         rm /usr/syno/synoman/webman/modules/authenticate.cgi
     fi
 
-    rm -rf /var/packages/pan-xunlei-com
-    mkdir -p /var/packages/pan-xunlei-com
-    ln -s /usr/share/thunder/target /var/packages/pan-xunlei-com
-    ln -s /usr/share/thunder/target/host/etc/synoinfo.conf /etc/synoinfo.conf
-    ln -s /usr/share/thunder/target/host/usr/syno/synoman/webman/modules/authenticate.cgi /usr/syno/synoman/webman/modules/authenticate.cgi
-
     if [ ! -d "$config_path" ]; then
         mkdir -p $config_path
     fi
@@ -58,8 +53,36 @@
     if [ ! -d "$mount_bind_download_path" ]; then
         mkdir -p $mount_bind_download_path
     fi
+
+    if [  -f  "$config_path/packages/pan-xunlei-com/target/version"  ] ; then
+        mv $config_path "${config_path}_bak"
+    fi
     
-    args="--bind $bind --config-path $config_path --download-path $download_path --mount-bind-download-path $mount_bind_download_path"
+    /bin/sh -c "$PROG uninstall  >>/var/log/thunder.log 2>&1"
+
+    if [ ! -d  "$config_path/packages" ] ; then
+        mkdir -p $config_path/packages
+        chown -R $user:root $config_path
+    fi
+
+    if [ ! -d  "/var/packages" ] ; then
+        ln -s $config_path/packages  /var/packages
+    fi
+
+    #ln -s /usr/share/thunder/target /tmp/packages/pan-xunlei-com
+    #ln -s /usr/share/thunder/target/host/etc/synoinfo.conf /etc/synoinfo.conf
+    #ln -s /usr/share/thunder/target/host/usr/syno/synoman/webman/modules/authenticate.cgi /usr/syno/synoman/webman/modules/authenticate.cgi
+
+    if [  ! -f  "/var/packages/pan-xunlei-com/target/version"  ] ; then
+        /bin/sh -c "$PROG install --uid $(awk -F: '/'$user'/{print $3}' /etc/passwd)  --gid 0  --config-path $config_path --download-path $download_path --mount-bind-download-path $mount_bind_download_path  >>/var/log/thunder.log 2>&1"
+    fi
+
+    if [  -d  "${config_path}_bak" ] ; then
+        rm -rf $config_path
+        mv "${config_path}_bak" $config_path
+    fi
+
+    args="--bind 0.0.0.0:$port"
 
     if [ -n "$auth_password" ]; then
         args="$args --auth-password $auth_password"
@@ -68,9 +91,9 @@
     if [ $debug -ne 0 ]; then 
         args="$args --debug"
     fi
-    
+
     procd_open_instance
-    procd_set_param command /bin/sh -c "$PROG launcher $args >>/var/log/thunder.log 2>&1"
+    procd_set_param command /bin/sh -c "$PROG start $args >>/var/log/thunder.log 2>&1"
     procd_set_param stdout 0
     procd_set_param stderr 0
     procd_set_param pidfile /var/run/thunder.pid
@@ -91,3 +114,9 @@
     done
     start
 }
+
+stop_service() {
+    /bin/sh -c "$PROG stop"
+
+}
+


--- feeds/thunder/openwrt/thunder/Makefile
+++ feeds/thunder/openwrt/thunder/Makefile
@@ -2,7 +2,7 @@
 
 PKG_NAME:=thunder
 
-PKG_VERSION:=3.11.2-32
+PKG_VERSION:=1.0.3
 
 PKG_LICENSE:=MIT
 PKG_MAINTAINER:=gngpp <gngppz@gmail.com>
@@ -42,7 +42,8 @@
     rm $(PKG_SOURCE).sha256 $(PKG_SOURCE)
 
     tar -xvf $(DL_DIR)/$(PKG_SOURCE)
-    mv thunder-$(PKG_VERSION)-$(ARCH)-unknown-linux-musl/* $(PKG_BUILD_DIR)/
+    #mv thunder-$(PKG_VERSION)-$(ARCH)-unknown-linux-musl/* $(PKG_BUILD_DIR)/
+    mv thunder $(PKG_BUILD_DIR)/
 endef
 
 define Build/Compile
@@ -69,7 +70,7 @@
     $(INSTALL_DIR) $(1)/usr/share/thunder/target
     $(INSTALL_DIR) $(1)/usr/share/thunder/target/host
     $(INSTALL_DIR) $(1)/usr/share/thunder/target/etc
-    $(CP) $(PKG_BUILD_DIR)/bin/* $(1)/usr/share/thunder/target/
+    #$(CP) $(PKG_BUILD_DIR)/bin/* $(1)/usr/share/thunder/target/
 
     $(INSTALL_DIR) $(1)/etc/init.d
     $(INSTALL_BIN) $(CURDIR)/files/thunder.init $(1)/etc/init.d/thunder

补丁下载:06_fix-thunder.zip

本补丁文件,修正了V1.0.0版本的适配问题。新增了用户运行权限。
微信图片_20231229001008.png

--- feeds/thunder/openwrt/luci-app-thunder/luasrc/view/thunder/thunder_status.htm
+++ feeds/thunder/openwrt/luci-app-thunder/luasrc/view/thunder/thunder_status.htm
@@ -7,7 +7,7 @@
             {
                 if (data.running)
                 {
-                    tb.innerHTML = '<em style=\"color:green\"><b>' + data.application + '<%:RUNNING%></b></em>' + "<input class=\"cbi-button cbi-button-reload mar-10\" type=\"button\" value=\" <%:Open Web Interface%> \" onclick=\"window.open('//" + window.location.hostname + ":" + <%=luci.sys.exec("uci -q get thunder.@thunder[0].port"):gsub("^%s*(.-)%s*$", "%1")%> + "/')\"/>";
+                    tb.innerHTML = '<em style=\"color:green\"><b>' + data.application + '<%:RUNNING%></b></em>' + "<input class=\"cbi-button cbi-button-reload mar-10\" type=\"button\" value=\" <%:Open Web Interface%> \" onclick=\"window.open('//" + window.location.hostname + ":" + <%=luci.sys.exec("uci -q get thunder.@thunder[0].bind | awk -F: '//{print $2}'"):gsub("^%s*(.-)%s*$", "%1")%> + "/')\"/>";
                 }
                 else
                 {


--- feeds/thunder/openwrt/luci-app-thunder/luasrc/model/cbi/thunder/client.lua
+++ feeds/thunder/openwrt/luci-app-thunder/luasrc/model/cbi/thunder/client.lua
@@ -1,3 +1,6 @@
+local sys  = require "luci.sys"
+local util = require "luci.util"
+
 local m, s
 
 m = Map("thunder", translate("Thunder"))
@@ -15,6 +18,12 @@
 o = s:option(Flag, "debug", translate("Debug"))
 o.rmempty = false
 
+user = s:option(ListValue, "user", translate("Run daemon as user"))
+local p_user
+for _, p_user in util.vspairs(util.split(sys.exec("cat /etc/passwd | cut -f 1 -d :"))) do
+    user:value(p_user)
+end
+
 o = s:option(Value, "bind", translate("Bind"))
 o.default = "0.0.0.0:5055"
 

--- feeds/thunder/openwrt/thunder/files/thunder.init
+++ feeds/thunder/openwrt/thunder/files/thunder.init
@@ -8,6 +8,7 @@
     config_get_bool enabled $1 enabled 0
     config_get_bool debug $1 debug 0
     config_get bind $1 bind "0.0.0.0:5055"
+    config_get user $1 user "root"
     config_get auth_password $1 auth_password ''
     config_get config_path $1 config_path "/opt/thunder"
     config_get download_path $1 download_path "/opt/thunder/downloads"
@@ -42,10 +43,19 @@
     fi
 
     rm -rf /var/packages/pan-xunlei-com
-    mkdir -p /var/packages/pan-xunlei-com
-    ln -s /usr/share/thunder/target /var/packages/pan-xunlei-com
-    ln -s /usr/share/thunder/target/host/etc/synoinfo.conf /etc/synoinfo.conf
-    ln -s /usr/share/thunder/target/host/usr/syno/synoman/webman/modules/authenticate.cgi /usr/syno/synoman/webman/modules/authenticate.cgi
+    #mkdir -p /var/packages/pan-xunlei-com
+    if [ ! -d  "/opt/pan-xunlei-com" ] ; then
+        ln -s /mnt/sdb1 /opt
+    fi
+    ln -s /opt/pan-xunlei-com /var/packages/pan-xunlei-com
+    #ln -s /usr/share/thunder/target /var/packages/pan-xunlei-com
+    #ln -s /usr/share/thunder/target/host/etc/synoinfo.conf /etc/synoinfo.conf
+    #ln -s /usr/share/thunder/target/host/usr/syno/synoman/webman/modules/authenticate.cgi /usr/syno/synoman/webman/modules/authenticate.cgi
+
+    /bin/sh -c "$PROG uninstall --uid 0 --gid 0 "
+
+    /bin/sh -c "$PROG install --uid $(awk -F: '/'$user'/{print $3}' /etc/passwd)  --gid 0  --config-path $config_path --download-path $download_path --mount-bind-download-path $mount_bind_download_path"
+
 
     if [ ! -d "$config_path" ]; then
         mkdir -p $config_path
@@ -59,7 +69,7 @@
         mkdir -p $mount_bind_download_path
     fi
     
-    args="--bind $bind --config-path $config_path --download-path $download_path --mount-bind-download-path $mount_bind_download_path"
+    args="--bind $bind"
 
     if [ -n "$auth_password" ]; then
         args="$args --auth-password $auth_password"
@@ -70,7 +80,7 @@
     fi
     
     procd_open_instance
-    procd_set_param command /bin/sh -c "$PROG launcher $args >>/var/log/thunder.log 2>&1"
+    procd_set_param command /bin/sh -c "$PROG start $args >>/var/log/thunder.log 2>&1"
     procd_set_param stdout 0
     procd_set_param stderr 0
     procd_set_param pidfile /var/run/thunder.pid
@@ -91,3 +101,8 @@
     done
     start
 }
+
+stop_service() {
+    /bin/sh -c "$PROG stop --uid 0 --gid 0 "
+
+}


--- feeds/thunder/openwrt/thunder/files/thunder.config
+++ feeds/thunder/openwrt/thunder/files/thunder.config
@@ -3,7 +3,7 @@
     option 'enabled' '0'
     option 'debug' '0'
     option 'bind' '0.0.0.0:5055'
-    option 'port' '5055'
+    option 'user' 'root'
     option 'auth_password' ''
     option 'download_path' '/opt/thunder/downloads'
     option 'mount_bind_download_path' '/thunder'


--- feeds/thunder/openwrt/thunder/Makefile
+++ feeds/thunder/openwrt/thunder/Makefile
@@ -2,7 +2,7 @@
 
 PKG_NAME:=thunder
 
-PKG_VERSION:=3.11.2-32
+PKG_VERSION:=1.0.0
 
 PKG_LICENSE:=MIT
 PKG_MAINTAINER:=gngpp <gngppz@gmail.com>
@@ -42,7 +42,7 @@
     rm $(PKG_SOURCE).sha256 $(PKG_SOURCE)
 
     tar -xvf $(DL_DIR)/$(PKG_SOURCE)
-    mv thunder-$(PKG_VERSION)-$(ARCH)-unknown-linux-musl/* $(PKG_BUILD_DIR)/
+    mv thunder $(PKG_BUILD_DIR)/
 endef
 
 define Build/Compile
@@ -69,7 +69,7 @@
     $(INSTALL_DIR) $(1)/usr/share/thunder/target
     $(INSTALL_DIR) $(1)/usr/share/thunder/target/host
     $(INSTALL_DIR) $(1)/usr/share/thunder/target/etc
-    $(CP) $(PKG_BUILD_DIR)/bin/* $(1)/usr/share/thunder/target/
+    #$(CP) $(PKG_BUILD_DIR)/bin/* $(1)/usr/share/thunder/target/
 
     $(INSTALL_DIR) $(1)/etc/init.d
     $(INSTALL_BIN) $(CURDIR)/files/thunder.init $(1)/etc/init.d/thunder

补丁文件下载:071_fix-thunder.zip

有买这个开发板的可以先刷breed-mt7621-newifi-d1的引导程序,原厂的bootload不怎么好用,而且不支持新板的lzma内核解压。微信图片_20231229005124.jpg

--- target/linux/ramips/dts/mt7621_hilink_hlk-7621a.dts
+++ target/linux/ramips/dts/mt7621_hilink_hlk-7621a.dts
@@ -1,14 +1,26 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
-/dts-v1/;
 
 #include "mt7621.dtsi"
 
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
 / {
     compatible = "hilink,hlk-7621a", "mediatek,mt7621-soc";
     model = "HiLink HLK-7621A";
 
     chosen {
-        bootargs = "console=ttyS0,57600";
+        bootargs = "console=ttyS0,115200";
+    };
+
+    keys {
+        compatible = "gpio-keys";
+
+        reset {
+            label = "reset";
+            gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+            linux,code = <KEY_RESTART>;
+        };
     };
 };
 
@@ -19,7 +31,8 @@
         compatible = "jedec,spi-nor";
         reg = <0>;
         spi-max-frequency = <44000000>;
-
+        broken-flash-reset;
+            
         partitions {
             compatible = "fixed-partitions";
             #address-cells = <1>;
@@ -53,51 +66,28 @@
 };
 
 &switch0 {
-    ports {
-        port@0 {
-            status = "okay";
-            label = "lan1";
-        };
-
-        port@1 {
-            status = "okay";
-            label = "lan2";
-        };
-
-        port@2 {
-            status = "okay";
-            label = "lan3";
-        };
-
-        port@3 {
-            status = "okay";
-            label = "lan4";
-        };
-
-        port@4 {
-            status = "okay";
-            label = "wan";
-        };
-    };
+    /* must delete compatible property */
+    /delete-property/ compatible;
 };
 
 &gmac0 {
-    mtd-mac-address = <&factory 0x8004>;
+    nvmem-cells = <&macaddr_factory_e000>;
+    nvmem-cell-names = "mac-address";
 };
 
 &state_default {
     gpio {
-        groups = "rgmii2", "jtag";
+        groups = "jtag", "uart", "wdt";
         function = "gpio";
     };
 };
 
 &uartlite2 {
-    status = "okay";
+    status = "disable";
 };
 
 &uartlite3 {
-    status = "okay";
+    status = "disable";
 };
 
 &xhci {
@@ -105,9 +95,80 @@
 };
 
 &sdhci {
-    status = "okay";
+    status = "disable";
 };
 
 &i2c {
-    status = "okay";
+    status = "disable";
+};
+
+&gmac1 {
+    nvmem-cells = <&macaddr_factory_e006>;
+    nvmem-cell-names = "mac-address";
+};
+
+&hnat {
+        mtketh-wan = "eth1";
+        mtketh-ppd = "eth0";
+        mtketh-lan = "eth0";
+    ext-devices = "radio0","radio1","radio2";
+        mtketh-max-gmac = <2>;
+        status = "okay";
+};
+
+&gsw {
+    mediatek,mdio = <&mdio>;
+    mediatek,portmap = "llllw";
+    mediatek,mcm;
+    mt7530,direct-phy-access;
+
+    resets = <&rstctrl 2>;
+    reset-names = "mcm";
+
+    port5: port@5 {
+        compatible = "mediatek,mt753x-port";
+        reg = <5>;
+        phy-mode = "rgmii";
+        fixed-link {
+            speed = <1000>;
+            full-duplex;
+        };
+    };
+
+    port6: port@6 {
+        compatible = "mediatek,mt753x-port";
+        reg = <6>;
+        phy-mode = "rgmii";
+        fixed-link {
+            speed = <1000>;
+            full-duplex;
+        };
+    };
+
+    mdio-bus {
+        #address-cells = <1>;
+        #size-cells = <0>;
+    };
+};
+
+&factory {
+    compatible = "nvmem-cells";
+    #address-cells = <1>;
+    #size-cells = <1>;
+
+    macaddr_factory_e000: macaddr@e000 {
+        reg = <0xe000 0x6>;
+    };
+
+    macaddr_factory_e006: macaddr@e006 {
+        reg = <0xe006 0x6>;
+    };
+};
+
+&pcie {
+    status = "okay";
+};
+
+&uartlite {
+    status = "okay";
 };

--- target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -54,6 +54,7 @@
         ucidef_add_switch "switch0" \
             "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
         ;;
+    hilink,hlk-7621a|\
     gehua,ghl-r-001)
         ucidef_add_switch "switch0" \
             "0:lan" "1:lan" "2:lan" "4:wan" "6u@eth0" "5u@eth1"

--- target/linux/ramips/image/mt7621.mk
+++ target/linux/ramips/image/mt7621.mk
@@ -778,10 +778,14 @@
 TARGET_DEVICES += hatlab_gateboard-one
 
 define Device/hilink_hlk-7621a
+  $(Device/dsa-migration)
+  $(Device/uimage-lzma-loader)
   IMAGE_SIZE := 32448k
   DEVICE_VENDOR := HiLink
   DEVICE_MODEL := HLK-7621A
-  DEVICE_PACKAGES := kmod-usb3
+  SUPPORTED_DEVICES += hlk-7621a
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_PACKAGES := kmod-usb3 
 endef
 TARGET_DEVICES += hilink_hlk-7621a
 
--- target/linux/ramips/Makefile
+++ target/linux/ramips/Makefile
@@ -10,8 +10,8 @@
 SUBTARGETS:=mt7620 mt7621 mt76x8 rt288x rt305x rt3883
 FEATURES:=squashfs gpio boot-part rootfs-part
 
-KERNEL_PATCHVER:=5.4
-KERNEL_TESTING_PATCHVER:=5.10
+KERNEL_PATCHVER:=5.10
+KERNEL_TESTING_PATCHVER:=5.15
 
 define Target/Description
     Build firmware images for Ralink RT288x/RT3xxx based boards.

补丁文件下载:12_fix_hlk-7621.zip