跟随官方更新了

--- 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

标签: none

添加新评论