diff --git a/package/lean/luci-app-qbittorrent/Makefile b/package/lean/luci-app-qbittorrent/Makefile index 693dfa64ca..ccca6c75d6 100644 --- a/package/lean/luci-app-qbittorrent/Makefile +++ b/package/lean/luci-app-qbittorrent/Makefile @@ -1,16 +1,15 @@ # Copyright (C) 2019 Openwrt.org # -# This is a free software, use it under Apache Licene 2.0 & GNU General Public License v3.0. +# This is free software, licensed under the Apache License, Version 2.0 . # include $(TOPDIR)/rules.mk -LUCI_TITLE:=qbittorrent-nox for LuCI +LUCI_TITLE:=LuCI support for qBittorrent LUCI_DEPENDS:=+qBittorrent +python LUCI_PKGARCH:=all -PKG_NAME:=luci-app-qbittorrent PKG_VERSION=1.0 -PKG_RELEASE:=9 +PKG_RELEASE:=13 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-qbittorrent/luasrc/controller/qbittorrent.lua b/package/lean/luci-app-qbittorrent/luasrc/controller/qbittorrent.lua index 11d169c6c6..77d58b971c 100644 --- a/package/lean/luci-app-qbittorrent/luasrc/controller/qbittorrent.lua +++ b/package/lean/luci-app-qbittorrent/luasrc/controller/qbittorrent.lua @@ -13,4 +13,4 @@ function act_status() e.running=luci.sys.call("pgrep qbittorrent-nox >/dev/null")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) -end +end \ No newline at end of file diff --git a/package/lean/luci-app-qbittorrent/luasrc/model/cbi/qbittorrent.lua b/package/lean/luci-app-qbittorrent/luasrc/model/cbi/qbittorrent.lua index b5dbe9d7e7..60fa83c5d2 100644 --- a/package/lean/luci-app-qbittorrent/luasrc/model/cbi/qbittorrent.lua +++ b/package/lean/luci-app-qbittorrent/luasrc/model/cbi/qbittorrent.lua @@ -1,5 +1,5 @@ local e=require"luci.model.uci".cursor() -local o=e:get_first("qbittorrent","Preferences","port") or 8080 +local o=e:get_first("qbittorrent","main","Port") or 8080 local a=(luci.sys.call("pidof qbittorrent-nox > /dev/null")==0) @@ -8,25 +8,365 @@ if a then t="

" end +function titlesplit(Value) + return "

" .. translate(Value) .. "

" +end + m = Map("qbittorrent", translate("qBittorrent"), translate("qBittorrent is a cross-platform free and open-source BitTorrent client")..t) -m:section(SimpleSection).template="qbittorrent/qbittorrent_status" +s = m:section(NamedSection, "main", "qbittorrent") -s_basic = m:section(TypedSection, "basic", translate("Basic Settings")) -s_basic.anonymous = true +s:tab("basic", translate("Basic Settings")) -enable = s_basic:option(Flag, "enable", translate("Enable")) -profile_dir = s_basic:option(Value,"profile_dir",translate("profile_dir"),translate("Store configuration files in the Path")) -profile_dir.default = "/root" +o = s:taboption("basic", Flag, "enabled", translate("Enabled")) +o.default = "1" -s_download = m:section(TypedSection, "Preferences", translate("Download Settings")) -s_download.anonymous = true -download_dir = s_download:option(Value,"download_dir",translate("download_dir"),translate("Store download files in the Path")) -download_dir.default = "/root/download" +o = s:taboption("basic", ListValue, "user", translate("Run daemon as user")) +local u +for u in luci.util.execi("cat /etc/passwd | cut -d ':' -f1") do + o:value(u) +end -s_webui = m:section(TypedSection, "Preferences", translate("WEBUI Settings")) -s_webui.anonymous = true -port = s_webui:option(Value,"port",translate("port"),translate("WEBUI listening port")) -port.default = "8080" +o = s:taboption("basic", Value, "profile", translate("Parent Path for Profile Folder"), translate("The path for storing profile folder using by command: --profile [PATH].")) +o.default = '/tmp' -return m \ No newline at end of file +o = s:taboption("basic", Value, "configuration", translate("Profile Folder Suffix"), translate("Suffix for profile folder, for example, qBittorrent_[NAME].")) + +o = s:taboption("basic", Value, "Locale", translate("Locale Language")) +o:value("en", translate("English")) +o:value("zh", translate("Chinese")) +o.default = "en" + +o = s:taboption("basic", Flag, "Enabled", translate("Enable Log"), translate("Enable logger to log file.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("basic", Value, "Path", translate("Log Path"), translate("The path for qbittorrent log.")) +o:depends("Enabled", "true") + +o = s:taboption("basic", Flag, "Backup", translate("Enable Backup"), translate("Backup log file when oversize the given size.")) +o:depends("Enabled", "true") +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("basic", Flag, "DeleteOld", translate("Delete Old Backup"), translate("Delete the old log file.")) +o:depends("Enabled", "true") +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("basic", Value, "MaxSizeBytes", translate("Log Max Size"), translate("The max size for qbittorrent log (Unit: Bytes).")) +o:depends("Enabled", "true") +o.placeholder = "66560" + +o = s:taboption("basic", Value, "SaveTime", translate("Log Saving Period"), translate("The log file will be deteted after given time. 1d -- 1 day, 1m -- 1 month, 1y -- 1 year")) +o:depends("Enabled", "true") +o.datatype = "string" + +s:tab("connection", translate("Connection Settings")) + +o = s:taboption("connection", Flag, "UPnP", translate("Use UPnP for Connections"), translate("Use UPnP/ NAT-PMP port forwarding from my router. Refer to the " + .. "wiki.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("connection", Flag, "UseRandomPort", translate("Use Random Port"), translate("Use different port on each startup voids the first" + .. " option, and randomly assigns a different port every time qBittorrent starts up.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("connection", Value, "PortRangeMin", translate("Connection Port"), translate("Generate Randomly")) +o:depends("UseRandomPort", false) +o.datatype = "range(1024,65535)" +o.template = "qbittorrent/qbt_value" +o.btnclick = "randomToken();" + +o = s:taboption("connection", Value, "GlobalDLLimit", translate("Global Download Speed"), translate("Global Download Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "0" + +o = s:taboption("connection", Value, "GlobalUPLimit", translate("Global Upload Speed"), translate("Global Upload Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "0" + +o = s:taboption("connection", Value, "GlobalDLLimitAlt", translate("Alternative Download Speed"), translate("Alternative Download Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "10" + +o = s:taboption("connection", Value, "GlobalUPLimitAlt", translate("Alternative Upload Speed"), translate("Alternative Upload Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "10" + +o = s:taboption("connection", ListValue, "BTProtocol", translate("Enabled protocol"), translate("The protocol that was enabled.")) +o:value("Both", translate("TCP and UTP")) +o:value("TCP", translate("TCP")) +o:value("UTP", translate("UTP")) +o.default = "Both" + +o = s:taboption("connection", Value, "InetAddress", translate("Inet Address"), translate("The address that respond to the trackers.")) + +s:tab("downloads", translate("Downloads Settings")) + +o = s:taboption("downloads", Flag, "CreateTorrentSubfolder", translate("Create Subfolder"), translate("Create subfolder for torrents with multiple files.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("downloads", Flag, "StartInPause", translate("Start In Pause"), translate("Do not start the download automatically.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("downloads", Flag, "AutoDeleteAddedTorrentFile", translate("Auto Delete Torrent File"), translate("The .torrent files will be deleted afterwards.")) +o.enabled = "IfAdded" +o.disabled = "Never" +o.default = o.disabled + +o = s:taboption("downloads", Flag, "PreAllocation", translate("Pre Allocation"), translate("Pre-allocate disk space for all files.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("downloads", Flag, "UseIncompleteExtension", translate("Use Incomplete Extension"), translate("The incomplete task will be added the extension of !qB.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("downloads", Value, "SavePath", translate("Save Path")) +o.placeholder = "/tmp/download" + +o = s:taboption("downloads", Flag, "TempPathEnabled", translate("Temp Path Enabled")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("downloads", Value, "TempPath", translate("Temp Path"), translate("The absolute and relative path can be set.")) +o:depends("TempPathEnabled", "true") +o.placeholder = "temp/" + +o = s:taboption("downloads", Value, "DiskWriteCacheSize", translate("Disk Cache Size (MiB)"), translate("The value -1 is auto and 0 is disable. In default, it is set to 64MiB.")) +o.datatype = "integer" +o.placeholder = "64" + +o = s:taboption("downloads", Value, "DiskWriteCacheTTL", translate("Disk Cache TTL (s)"), translate("In default, it is set to 60s.")) +o.datatype = "integer" +o.placeholder = "60" + +o = s:taboption("downloads", DummyValue, "Saving Management", titlesplit("Saving Management")) + +o = s:taboption("downloads", ListValue, "DisableAutoTMMByDefault", translate("Default Torrent Management Mode")) +o:value("true", translate("Manual")) +o:value("false", translate("Automaic")) +o.default = "true" + +o = s:taboption("downloads", ListValue, "CategoryChanged", translate("Torrent Category Changed"), translate("Choose the action when torrent category changed.")) +o:value("true", translate("Switch torrent to Manual Mode")) +o:value("false", translate("Relocate torrent")) +o.default = "false" + +o = s:taboption("downloads", ListValue, "DefaultSavePathChanged", translate("Default Save Path Changed"), translate("Choose the action when default save path changed.")) +o:value("true", translate("Switch affected torrent to Manual Mode")) +o:value("false", translate("Relocate affected torrent")) +o.default = "true" + +o = s:taboption("downloads", ListValue, "CategorySavePathChanged", translate("Category Save Path Changed"), translate("Choose the action when category save path changed.")) +o:value("true", translate("Switch affected torrent to Manual Mode")) +o:value("false", translate("Relocate affected torrent")) +o.default = "true" + +o = s:taboption("downloads", Value, "TorrentExportDir", translate("Torrent Export Dir"), translate("The .torrent files will be copied to the target directory.")) + +o = s:taboption("downloads", Value, "FinishedTorrentExportDir", translate("Finished Torrent Export Dir"), translate("The .torrent files for finished downloads will be copied to the target directory.")) + +s:tab("bittorrent", translate("Bittorrent Settings")) + +o = s:taboption("bittorrent", Flag, "DHT", translate("Enable DHT"), translate("Enable DHT (decentralized network) to find more peers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", Flag, "PeX", translate("Enable PeX"), translate("Enable Peer Exchange (PeX) to find more peers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", Flag, "LSD", translate("Enable LSD"), translate("Enable Local Peer Discovery to find more peers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("bittorrent", Flag, "uTP_rate_limited", translate("uTP Rate Limit"), translate("Apply rate limit to µTP protocol.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", ListValue, "Encryption", translate("Encryption Mode"), translate("Enable DHT (decentralized network) to find more peers")) +o:value("0", translate("Prefer Encryption")) +o:value("1", translate("Require Encryption")) +o:value("2", translate("Disable Encryption")) +o.default = "0" + +o = s:taboption("bittorrent", Value, "MaxConnecs", translate("Max Connections"), translate("The max number of connections.")) +o.datatype = "integer" +o.placeholder = "500" + +o = s:taboption("bittorrent", Value, "MaxConnecsPerTorrent", translate("Max Connections Per Torrent"), translate("The max number of connections per torrent.")) +o.datatype = "integer" +o.placeholder = "100" + +o = s:taboption("bittorrent", Value, "MaxUploads", translate("Max Uploads"), translate("The max number of connected peers.")) +o.datatype = "integer" +o.placeholder = "8" + +o = s:taboption("bittorrent", Value, "MaxUploadsPerTorrent", translate("Max Uploads Per Torrent"), translate("The max number of connected peers per torrent.")) +o.datatype = "integer" +o.placeholder = "4" + +o = s:taboption("bittorrent", Value, "MaxRatio", translate("Max Ratio"), translate("The max ratio for seeding. -1 is to disable the seeding.")) +o.datatype = "float" +o.placeholder = "-1" + +o = s:taboption("bittorrent", ListValue, "MaxRatioAction", translate("Max Ratio Action"), translate("The action when reach the max seeding ratio.")) +o:value("0", translate("Pause them")) +o:value("1", translate("Remove them")) +o.defaule = "0" + +o = s:taboption("bittorrent", Value, "GlobalMaxSeedingMinutes", translate("Max Seeding Minutes"), translate("Units: minutes")) +o.datatype = "integer" + +o = s:taboption("bittorrent", DummyValue, "Queueing Setting", titlesplit("Queueing Setting")) + +o = s:taboption("bittorrent", Flag, "QueueingEnabled", translate("Enable Torrent Queueing")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", Value, "MaxActiveDownloads", translate("Maximum Active Downloads")) +o.datatype = "integer" +o.placeholder = "3" + +o = s:taboption("bittorrent", Value, "MaxActiveUploads", translate("Max Active Uploads")) +o.datatype = "integer" +o.placeholder = "3" + +o = s:taboption("bittorrent", Value, "MaxActiveTorrents", translate("Max Active Torrents")) +o.datatype = "integer" +o.placeholder = "5" + +o = s:taboption("bittorrent", Flag, "IgnoreSlowTorrents", translate("Ignore Slow Torrents"), translate("Do not count slow torrents in these limits.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("bittorrent", Value, "SlowTorrentsDownloadRate", translate("Download rate threshold"), translate("Units: KiB/s")) +o.datatype = "integer" +o.placeholder = "2" + +o = s:taboption("bittorrent", Value, "SlowTorrentsUploadRate", translate("Upload rate threshold"), translate("Units: KiB/s")) +o.datatype = "integer" +o.placeholder = "2" + +o = s:taboption("bittorrent", Value, "SlowTorrentsInactivityTimer", translate("Torrent inactivity timer"), translate("Units: seconds")) +o.datatype = "integer" +o.placeholder = "60" + +s:tab("webgui", translate("WebUI Settings")) + +o = s:taboption("webgui", Flag, "UseUPnP", translate("Use UPnP for WebUI"), translate("Using the UPnP / NAT-PMP port of the router for connecting to WebUI.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("webgui", Value, "Username", translate("Username"), translate("The login name for WebUI.")) +o.placeholder = "admin" + +o = s:taboption("webgui", Value, "Password", translate("Password"), translate("The login password for WebUI.")) +o.password = true + +o = s:taboption("webgui", Value, "Port", translate("Listen Port"), translate("The listening port for WebUI.")) +o.datatype = "port" +o.placeholder = "8080" + +o = s:taboption("webgui", Flag, "CSRFProtection", translate("CSRF Protection"), translate("Enable Cross-Site Request Forgery (CSRF) protection.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "ClickjackingProtection", translate("Clickjacking Protection"), translate("Enable clickjacking protection.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "HostHeaderValidation", translate("Host Header Validation"), translate("Validate the host header.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "LocalHostAuth", translate("Local Host Authentication"), translate("Force authentication for clients on localhost.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "AuthSubnetWhitelistEnabled", translate("Enable Subnet Whitelist")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("webgui", DynamicList, "AuthSubnetWhitelist", translate("Subnet Whitelist")) +o:depends("AuthSubnetWhitelistEnabled", "true") + +s:tab("advanced", translate("Advance Settings")) + +o = s:taboption("advanced", Flag, "AnonymousMode", translate("Anonymous Mode"), translate("When enabled, qBittorrent will take certain measures to try" + .. " to mask its identity. Refer to the wiki")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Flag, "SuperSeeding", translate("Super Seeding"), translate("The super seeding mode.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("advanced", Flag, "IncludeOverhead", translate("Limit Overhead Usage"), translate("The overhead usage is been limitted.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("advanced", Flag, "IgnoreLimitsLAN", translate("Ignore LAN Limit"), translate("Ignore the speed limit to LAN.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Flag, "osCache", translate("Use os Cache")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Value, "OutgoingPortsMax", translate("Max Outgoing Port"), translate("The max outgoing port.")) +o.datatype = "port" + +o = s:taboption("advanced", Value, "OutgoingPortsMin", translate("Min Outgoing Port"), translate("The min outgoing port.")) +o.datatype = "port" + +o = s:taboption("advanced", ListValue, "SeedChokingAlgorithm", translate("Choking Algorithm"), translate("The strategy of choking algorithm.")) +o:value("RoundRobin", translate("Round Robin")) +o:value("FastestUpload", translate("Fastest Upload")) +o:value("AntiLeech", translate("Anti-Leech")) +o.default = "FastestUpload" + +o = s:taboption("advanced", Flag, "AnnounceToAllTrackers", translate("Announce To All Trackers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("advanced", Flag, "AnnounceToAllTiers", translate("Announce To All Tiers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +return m diff --git a/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbt_value.htm b/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbt_value.htm new file mode 100644 index 0000000000..001625a7f4 --- /dev/null +++ b/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbt_value.htm @@ -0,0 +1,36 @@ +<%# + Copyright 2019 xxx + Licensed to the public under the Apache License 2.0. +-%> + +
" data-index="<%=self.index%>" data-depends="<%=pcdata(self:deplist2json(section))%>"> + <%- if self.title and #self.title > 0 then -%> + +
+ <%- end -%> + /> + <% if self.description and #self.description > 0 then -%> +
+ " type="button"<%= + attr("value", self.description) .. + ifattr(self.btnclick, "onclick", self.btnclick) + %> /> +
+ <%- end %> + <%- if self.title and #self.title > 0 then -%> +
+ <%- end -%> +
diff --git a/package/lean/luci-app-qbittorrent/root/etc/config/qbittorrent b/package/lean/luci-app-qbittorrent/root/etc/config/qbittorrent index 1de5a8ff05..4ec138ff67 100644 --- a/package/lean/luci-app-qbittorrent/root/etc/config/qbittorrent +++ b/package/lean/luci-app-qbittorrent/root/etc/config/qbittorrent @@ -1,11 +1,19 @@ -config basic - option program_dir '/usr/bin' - option library_dir '/usr/lib' - option profile_dir '/root' - option enable '0' -config Preferences - option download_dir '/root/download' - option port '8080' +config qbittorrent 'main' + option user 'root' + option Locale 'zh' + option BTProtocol 'Both' + option DisableAutoTMMByDefault 'true' + option CategoryChanged 'false' + option DefaultSavePathChanged 'true' + option CategorySavePathChanged 'true' + option Encryption '0' + option MaxRatioAction '0' + option CSRFProtection 'false' + option SeedChokingAlgorithm 'FastestUpload' + option Enabled 'false' + option Port '8080' + option profile '/opt' + option enabled '0' diff --git a/package/lean/luci-app-qbittorrent/root/etc/init.d/qbittorrent b/package/lean/luci-app-qbittorrent/root/etc/init.d/qbittorrent index 2f55f48ab5..274aa45719 100755 --- a/package/lean/luci-app-qbittorrent/root/etc/init.d/qbittorrent +++ b/package/lean/luci-app-qbittorrent/root/etc/init.d/qbittorrent @@ -1,77 +1,264 @@ #!/bin/sh /etc/rc.common +# Licensed to the public under the Apache License 2.0. +# ubus call service list + START=99 -get_config() -{ - config_get_bool enable $1 enable 0 +USE_PROCD=1 + +NAME=qbittorrent +args=/usr/bin/qbittorrent-nox + +QBT_PID_FILE=/var/run/qbittorrent.pid +QBT_INI_FILE=/tmp/qBittorrent/config/qBittorrent.conf + +QBT_INSTANCE="" + +_info() { + logger -p daemon.info -t "$NAME" "$*" } -config_qbittorrent() -{ - local download_dir - local port - config_get download_dir $1 download_dir - config_get port $1 port - if [ -f $2/qBittorrent/config/qBittorrent.conf ]; then - sed -i 's/WebUI\\Port=[0-9]*/WebUI\\Port='"$port"'/g' $2/qBittorrent/config/qBittorrent.conf - sed -i 's/Downloads\\SavePath=[a-z,/]*//g' $2/qBittorrent/config/qBittorrent.conf - echo "Downloads\SavePath=$down" >> $2/qBittorrent/config/qBittorrent.conf - else - cat>$2/qBittorrent/config/qBittorrent.conf<"$QBT_INI_FILE"</dev/null 2>&1; + return 1; + } + + local confdir="qBittorrent" + [ -n "$configuration" ] && { + confdir="qBittorrent_$configuration" + } + + [ -d "$profile/$confdir/config" ] || { + mkdir -m 0755 -p "$profile/$confdir/config" + } + + [ "$user" != "root" ] && { + [ -d "$confdir" ] && { + local groupnow="$(ls -l $profile | grep $confdir | awk '{print $3})" + local usernow="$(ls -l $profile | grep $confdir | awk '{print $4})" + + [ "$usernow" != "$user" ] && { _err "Permission denied!"; return 1; } + } || { + chmod -R g+w "$profile/$confdir" + chown -R "$user":"$user" "$profile/$confdir" + } + } + + [ "$AuthSubnetWhitelistEnabled" = true ] && { + AuthSubnetWhitelist="$( echo $AuthSubnetWhitelist | sed 's/ /,/g')" + } || { + AuthSubnetWhitelist="@Invalid()" + } + + QBT_INI_FILE="$profile/$confdir/config/qBittorrent.conf" + config_QBT + + procd_open_instance $QBT_INSTANCE + procd_set_param command $args + procd_append_param command --profile="$profile" + + [ -n "$configuration" ] && { + procd_append_param command --configuration="$configuration" + } + + procd_set_param respawn + procd_set_param user $user + procd_set_param file $QBT_INI_FILE + procd_set_param pidfile $QBT_PID_FILE + procd_close_instance } -stop() +service_triggers() { - killall qbittorrent-nox >/dev/null 2>&1 - return 0 + procd_add_reload_trigger "$NAME" +} + +start_service() { + config_load "$NAME" + config_foreach init_QBT "$NAME" +} + +reload_service() { + restart +} + +restart() { + stop + sleep 2 + start } diff --git a/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/luci-qbittorrent b/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/luci-qbittorrent new file mode 100644 index 0000000000..dd2c37d8d8 --- /dev/null +++ b/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/luci-qbittorrent @@ -0,0 +1,21 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@qbittorrent[-1] + add ucitrack qbittorrent + set ucitrack.@qbittorrent[-1].init=qbittorrent + commit ucitrack +EOF + +if [ ."$(uci -q get qbittorrent.main)" != ."qbittorrent" ]; then + uci -q batch <<-EOF >/dev/null + add qbittorrent qbittorrent + rename qbittorrent.@qbittorrent[-1]="main" + set qbittorrent.main.enabled=0 + set qbittorrent.main.profile="/tmp" + commit qbittorrent + EOF +fi + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/qbittorrent b/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/qbittorrent deleted file mode 100755 index c9995c1562..0000000000 --- a/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/qbittorrent +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -uci -q batch <<-EOF >/dev/null - delete ucitrack.@qbittorrent[-1] - add ucitrack qbittorrent - set ucitrack.@qbittorrent[-1].init=qbittorrent - commit ucitrack -EOF - -/etc/init.d/qbittorrent stop -rm -f /tmp/luci-indexcache -exit 0 diff --git a/package/lean/patches/010-pre_3.6_kernels_fix.patch b/package/lean/patches/010-pre_3.6_kernels_fix.patch new file mode 100644 index 0000000000..818e4efcdd --- /dev/null +++ b/package/lean/patches/010-pre_3.6_kernels_fix.patch @@ -0,0 +1,74 @@ +--- a/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp ++++ b/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp +@@ -33,7 +33,6 @@ + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ +- + #include "socketcanbackend.h" + + #include +@@ -50,29 +49,7 @@ + #include + #include + +-#ifndef CANFD_MTU +-// CAN FD support was added by Linux kernel 3.6 +-// For prior kernels we redefine the missing defines here +-// they are taken from linux/can/raw.h & linux/can.h +- +-enum { +- CAN_RAW_FD_FRAMES = 5 +-}; +- +-#define CAN_MAX_DLEN 8 +-#define CANFD_MAX_DLEN 64 +-struct canfd_frame { +- canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ +- __u8 len; /* frame payload length in byte */ +- __u8 flags; /* additional flags for CAN FD */ +- __u8 __res0; /* reserved / padding */ +- __u8 __res1; /* reserved / padding */ +- __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); +-}; +-#define CAN_MTU (sizeof(struct can_frame)) +-#define CANFD_MTU (sizeof(struct canfd_frame)) + +-#endif + + #ifndef CANFD_BRS + # define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */ +--- a/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.h ++++ b/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.h +@@ -45,6 +45,31 @@ + #include + #include + ++#ifndef CANFD_MTU ++// CAN FD support was added by Linux kernel 3.6 ++// For prior kernels we redefine the missing defines here ++// they are taken from linux/can/raw.h & linux/can.h ++ ++enum { ++ CAN_RAW_FD_FRAMES = 5 ++}; ++ ++#define CAN_MAX_DLEN 8 ++#define CANFD_MAX_DLEN 64 ++struct canfd_frame { ++ canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ ++ __u8 len; /* frame payload length in byte */ ++ __u8 flags; /* additional flags for CAN FD */ ++ __u8 __res0; /* reserved / padding */ ++ __u8 __res1; /* reserved / padding */ ++ __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); ++}; ++#define CAN_MTU (sizeof(struct can_frame)) ++#define CANFD_MTU (sizeof(struct canfd_frame)) ++ ++#endif ++ ++ + QT_BEGIN_NAMESPACE + + class SocketCanBackend : public QCanBusDevice diff --git a/package/lean/patches/020-disable_unused_libs.patch b/package/lean/patches/020-disable_unused_libs.patch new file mode 100644 index 0000000000..e32bae7647 --- /dev/null +++ b/package/lean/patches/020-disable_unused_libs.patch @@ -0,0 +1,91 @@ +This patch disables prinstsupport, sql, concurrent, testlib base libs compilation +--- a/qtbase/src/src.pro ++++ b/qtbase/src/src.pro +@@ -66,22 +66,10 @@ src_dbus.target = sub-dbus + src_dbus.depends = src_corelib + force_dbus_bootstrap: src_dbus.depends += src_tools_bootstrap_dbus # avoid syncqt race + +-src_concurrent.subdir = $$PWD/concurrent +-src_concurrent.target = sub-concurrent +-src_concurrent.depends = src_corelib +- +-src_sql.subdir = $$PWD/sql +-src_sql.target = sub-sql +-src_sql.depends = src_corelib +- + src_network.subdir = $$PWD/network + src_network.target = sub-network + src_network.depends = src_corelib + +-src_testlib.subdir = $$PWD/testlib +-src_testlib.target = sub-testlib +-src_testlib.depends = src_corelib # testlib links only to corelib, but see below for the headers +- + src_3rdparty_pcre2.subdir = $$PWD/3rdparty/pcre2 + src_3rdparty_pcre2.target = sub-3rdparty-pcre2 + +@@ -125,13 +113,6 @@ src_openglextensions.subdir = $$PWD/open + src_openglextensions.target = sub-openglextensions + src_openglextensions.depends = src_gui + +-src_printsupport.subdir = $$PWD/printsupport +-src_printsupport.target = sub-printsupport +-src_printsupport.depends = src_corelib src_gui src_widgets src_tools_uic +- +-src_plugins.subdir = $$PWD/plugins +-src_plugins.target = sub-plugins +- + src_android.subdir = $$PWD/android + + # this order is important +@@ -152,14 +133,8 @@ TOOLS = src_tools_moc src_tools_rcc src_ + win32:SUBDIRS += src_winmain + qtConfig(network) { + SUBDIRS += src_network +- src_plugins.depends += src_network +-} +-qtConfig(sql) { +- SUBDIRS += src_sql +- src_plugins.depends += src_sql + } + qtConfig(xml): SUBDIRS += src_xml +-qtConfig(testlib): SUBDIRS += src_testlib + qtConfig(dbus) { + force_dbus_bootstrap|qtConfig(private_tests): \ + SUBDIRS += src_tools_bootstrap_dbus +@@ -167,9 +142,7 @@ qtConfig(dbus) { + TOOLS += src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml + qtConfig(accessibility-atspi-bridge): \ + src_platformsupport.depends += src_dbus src_tools_qdbusxml2cpp +- src_plugins.depends += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml + } +-qtConfig(concurrent): SUBDIRS += src_concurrent + qtConfig(gui) { + qtConfig(harfbuzz):!qtConfig(system-harfbuzz) { + SUBDIRS += src_3rdparty_harfbuzzng +@@ -190,24 +163,17 @@ qtConfig(gui) { + } + SUBDIRS += src_gui src_platformsupport src_platformheaders + qtConfig(opengl): SUBDIRS += src_openglextensions +- src_plugins.depends += src_gui src_platformsupport src_platformheaders +- src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers + qtConfig(widgets) { + SUBDIRS += src_tools_uic src_widgets + !android-embedded: SUBDIRS += src_printsupport + TOOLS += src_tools_uic +- src_plugins.depends += src_widgets +- !android-embedded: src_plugins.depends += src_printsupport +- src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers + qtConfig(opengl) { + SUBDIRS += src_opengl +- src_plugins.depends += src_opengl + } + } + } +-SUBDIRS += src_plugins + +-nacl: SUBDIRS -= src_network src_testlib ++nacl: SUBDIRS -= src_network + + android:!android-embedded: SUBDIRS += src_android src_3rdparty_gradle + diff --git a/package/lean/rblibtorrent/Makefile b/package/lean/rblibtorrent/Makefile index 1de47fdda4..d2709c7bb5 100644 --- a/package/lean/rblibtorrent/Makefile +++ b/package/lean/rblibtorrent/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rblibtorrent -PKG_VERSION:=1.2.2 -PKG_RELEASE=1 +PKG_VERSION:=1.1.13 +PKG_RELEASE=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/arvidn/libtorrent.git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=9c970550e385df7e5c9dd2950275466f1a1dd8c4 +PKG_SOURCE_VERSION:=6f1250c6535730897909240ea0f4f2a81937d21a PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_LICENSE:=BSD @@ -41,12 +41,15 @@ EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14) TARGET_LDFLAGS += -lstdc++ CONFIGURE_ARGS += \ - --prefix /usr \ - --enable-shared \ - --enable-static \ --disable-debug \ + --disable-rpath \ --enable-encryption \ - --with-boost=$(STAGING_DIR)/usr + --enable-deprecated-functions \ + --with-gnu-ld \ + --with-openssl=$(STAGING_DIR)/usr \ + --with-boost=$(STAGING_DIR)/usr \ + --with-libiconv \ + --with-libiconv-prefix=$(ICONV_PREFIX) define Build/Configure cd $(PKG_BUILD_DIR) ; \ diff --git a/package/lean/src/qtbase/mkspecs/linux-openwrt-g++/qmake.conf b/package/lean/src/qtbase/mkspecs/linux-openwrt-g++/qmake.conf new file mode 100644 index 0000000000..8aec5b857f --- /dev/null +++ b/package/lean/src/qtbase/mkspecs/linux-openwrt-g++/qmake.conf @@ -0,0 +1,31 @@ +# +# qmake configuration for building with linux-openwrt-g++ +# + +MAKEFILE_GENERATOR = UNIX +CONFIG += incremental +QMAKE_INCREMENTAL_STYLE = sublib + +include(../common/linux.conf) +include(../common/gcc-base-unix.conf) +include(../common/g++-unix.conf) + +# modifications to g++.conf +QMAKE_CC = $(TARGET_CROSS)gcc +QMAKE_CXX = $(TARGET_CROSS)g++ + +QMAKE_CFLAGS += $(TARGET_CFLAGS) +QMAKE_CXXFLAGS += $(TARGET_CXXFLAGS) +QMAKE_LFLAGS += $(TARGET_LDFLAGS) + +QMAKE_LINK_C = $(TARGET_CROSS)gcc +QMAKE_LINK_C_SHLIB = $(TARGET_CROSS)gcc +QMAKE_LINK = $(TARGET_CROSS)g++ +QMAKE_LINK_SHLIB = $(TARGET_CROSS)g++ + +# modifications to linux.conf +QMAKE_AR = $(TARGET_CROSS)ar cqs +QMAKE_OBJCOPY = $(TARGET_CROSS)objcopy +QMAKE_NM = $(TARGET_CROSS)nm -P +QMAKE_STRIP = $(TARGET_CROSS)strip +load(qt_config) diff --git a/package/lean/src/qtbase/mkspecs/linux-openwrt-g++/qplatformdefs.h b/package/lean/src/qtbase/mkspecs/linux-openwrt-g++/qplatformdefs.h new file mode 100644 index 0000000000..02e77c9a37 --- /dev/null +++ b/package/lean/src/qtbase/mkspecs/linux-openwrt-g++/qplatformdefs.h @@ -0,0 +1,9 @@ +#include "../linux-g++/qplatformdefs.h" + +#undef QT_SOCKLEN_T + +#if defined(__GLIBC__) && (__GLIBC__ < 2) +#define QT_SOCKLEN_T int +#else +#define QT_SOCKLEN_T socklen_t +#endif