diff --git a/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm b/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm
index fd1c121..c5bf5ab 100644
--- a/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm
+++ b/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm
@@ -6,17 +6,14 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[status]])%>', nu
if (data && tb) {
if (data.running) {
tb.innerHTML = 'AdGuardHome <%:RUNNING%>';
- } else {
- tb.innerHTML = 'AdGuardHome <%:NOT RUNNING%>';
- }
- if (data.redirect)
- {
URL = window.location.protocol.toLowerCase() + "//" + window.location.hostname + ":<%=luci.model.uci.cursor():get("AdGuardHome", "AdGuardHome", "httpport") %>";
tb.innerHTML+=' <%:Redirected%> '
tb.innerHTML += "\" onclick=\"window.open('"+URL+"')\"/>";
} else {
+ tb.innerHTML = 'AdGuardHome <%:NOT RUNNING%>';
tb.innerHTML+='<%:Not redirect%>'
}
+
}
}
);
diff --git a/luci-app-adguardhome/root/etc/init.d/AdGuardHome b/luci-app-adguardhome/root/etc/init.d/AdGuardHome
index 91c8f06..a285cdb 100644
--- a/luci-app-adguardhome/root/etc/init.d/AdGuardHome
+++ b/luci-app-adguardhome/root/etc/init.d/AdGuardHome
@@ -5,9 +5,6 @@ USE_PROCD=1
START=95
STOP=01
-ipt=$(command -v iptables-legacy || command -v iptables)
-ip6t=$(command -v ip6tables-legacy || command -v ip6tables)
-bin_nft=$(command -v nft || which nft)
CONFIGURATION=AdGuardHome
CRON_FILE=/etc/crontabs/root
GFWSET="gfwlist"
@@ -20,47 +17,47 @@ EXTRA_HELP=" do_redirect 0 or 1\
set_forward_dnsmasq()
{
- local PORT="$1"
- addr="127.0.0.1#$PORT"
- OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
+ addr="127.0.0.1#$AdGuardHome_PORT"
+ OLD_SERVER="$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)"
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
if [ $? -eq 0 ]; then
return
fi
uci delete dhcp.@dnsmasq[0].server 2>/dev/null
- uci add_list dhcp.@dnsmasq[0].server=$addr
+ uci add_list dhcp.@dnsmasq[0].server="$addr"
for server in $OLD_SERVER; do
if [ "$server" = "$addr" ]; then
continue
fi
- # uci add_list dhcp.@dnsmasq[0].server=$server
+ uci add_list dhcp.@dnsmasq[0].server=$server
done
uci delete dhcp.@dnsmasq[0].resolvfile 2>/dev/null
uci set dhcp.@dnsmasq[0].noresolv=1
uci commit dhcp
- /etc/init.d/dnsmasq restart
+ /etc/init.d/dnsmasq restart >/dev/null 2>&1
}
stop_forward_dnsmasq()
{
local OLD_PORT="$1"
addr="127.0.0.1#$OLD_PORT"
- OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
+ OLD_SERVER="$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)"
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
if [ $? -ne 0 ]; then
return
fi
- uci del_list dhcp.@dnsmasq[0].server=$addr 2>/dev/null
- addrlist="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
- if [ -z "$addrlist" ] ; then
+ uci del_list dhcp.@dnsmasq[0].server="$addr" 2>/dev/null
+
+ addrlist="$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)"
+ if [ -z "$addrlist" ]; then
resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
[ ! -f "$resolvfile" ] && resolvfile="/tmp/resolv.conf.auto"
uci set dhcp.@dnsmasq[0].resolvfile="$resolvfile" 2>/dev/null
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
fi
uci commit dhcp
- /etc/init.d/dnsmasq restart
+ /etc/init.d/dnsmasq restart >/dev/null 2>&1
}
set_firewall()
@@ -453,7 +450,7 @@ start_service() {
procd_set_param file "$configpath" "/etc/hosts" "/etc/config/AdGuardHome"
procd_close_instance
if [ -f "$configpath" ]; then
- _do_redirect 1
+ (sleep 5 && _do_redirect 1) &
else
_do_redirect 0
config_get "redirect" $CONFIGURATION "redirect" "none"
@@ -465,13 +462,7 @@ start_service() {
fi
fi
echo "AdGuardHome service enabled"
- # echo "luci enable switch=$enabled"
- (sleep 10 && [ -z "$(pgrep $binpath)" ] && logger "AdGuardHome" "no process in 10s cancel redirect" && _do_redirect 0 )&
- if [[ "`uci -q get bypass.@global[0].global_server`" && "`uci -q get bypass.@global[0].adguardhome 2>/dev/null`" == 1 && "$(uci -q get dhcp.@dnsmasq[0].port)" == "53" ]]; then
- uci -q set AdGuardHome.AdGuardHome.redirect='exchange'
- uci commit AdGuardHome
- do_redirect 1
- fi
+
}
reload_service()
@@ -574,6 +565,7 @@ do_crontab(){
}
crontab_editor(){
+ [ ! -f "$CRON_FILE" ] && mkdir -p ${CRON_FILE%/*} && touch "$CRON_FILE" && chmod 600 "$CRON_FILE"
#usage input:
#findstr=
#default=
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua
index 0a27fb6..6710e46 100644
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua
@@ -451,7 +451,7 @@ o.description = desc .. ""
o:depends({dns_shunt = "dnsmasq", tcp_proxy_mode = "proxy", chn_list = "direct"})
for k, v in pairs(nodes_table) do
- if v.protocol and v.protocol ~= "_shunt" then
+ if v.protocol ~= "_shunt" then
s.fields["dns_mode"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
end
end
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
index 20cb114..3dfb002 100644
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
@@ -778,7 +778,7 @@ for k, v in pairs(nodes_table) do
s2.fields["node"]:value(v.id, v["remark"])
end
- if v.protocol and v.protocol ~= "_shunt" then
+ if v.protocol ~= "_shunt" then
s.fields["dns_mode"]:depends({ dns_shunt = "chinadns-ng", tcp_node = v.id })
s.fields["dns_mode"]:depends({ dns_shunt = "dnsmasq", tcp_node = v.id })
if api.is_finded("smartdns") then
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua
index 4d713e6..deec72c 100644
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua
@@ -35,6 +35,21 @@ end)
for k, v in pairs(groups) do
o:value(k)
end
+o.write = function(self, section, value)
+ value = api.trim(value)
+ local lower = value:lower()
+
+ if lower == "" or lower == "default" then
+ return m:del(section, self.option)
+ end
+
+ for _, v in ipairs(self.keylist or {}) do
+ if v:lower() == lower then
+ return m:set(section, self.option, v)
+ end
+ end
+ m:set(section, self.option, value)
+end
o = s:option(ListValue, "type", translate("Type"))
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua
index a2d3694..537d8b9 100644
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua
@@ -163,19 +163,33 @@ end
o = s:option(Value, "remark", translate("Remarks"))
o.width = "auto"
o.rmempty = false
-o.validate = function(self, value, t)
- if value then
- local count = 0
- m.uci:foreach(appname, "subscribe_list", function(e)
- if e[".name"] ~= t and e["remark"] == value then
- count = count + 1
+o.validate = function(self, value, section)
+ value = api.trim(value)
+ if value == "" then
+ return nil, translate("Remark cannot be empty.")
+ end
+ local duplicate = false
+ m.uci:foreach(appname, "subscribe_list", function(e)
+ if e[".name"] ~= section and e["remark"] and e["remark"]:lower() == value:lower() then
+ duplicate = true
+ return false
+ end
+ end)
+ if duplicate or value:lower() == "default" then
+ return nil, translate("This remark already exists, please change a new remark.")
+ end
+ return value
+end
+o.write = function(self, section, value)
+ local old = m:get(section, self.option) or ""
+ if old:lower() ~= value:lower() then
+ m.uci:foreach(appname, "nodes", function(e)
+ if e["group"] and e["group"]:lower() == old:lower() then
+ m.uci:set(appname, e[".name"], "group", value)
end
end)
- if count > 0 then
- return nil, translate("This remark already exists, please change a new remark.")
- end
- return value
end
+ return Value.write(self, section, value)
end
o = s:option(DummyValue, "_node_count", translate("Subscribe Info"))
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua
index 7d6edd2..23ea3ed 100644
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua
@@ -79,13 +79,41 @@ end
o = s:option(Value, "remark", translate("Subscribe Remark"))
o.rmempty = false
+o.validate = function(self, value, section)
+ value = api.trim(value)
+ if value == "" then
+ return nil, translate("Remark cannot be empty.")
+ end
+ local duplicate = false
+ m.uci:foreach(appname, "subscribe_list", function(e)
+ if e[".name"] ~= section and e["remark"] and e["remark"]:lower() == value:lower() then
+ duplicate = true
+ return false
+ end
+ end)
+ if duplicate or value:lower() == "default" then
+ return nil, translate("This remark already exists, please change a new remark.")
+ end
+ return value
+end
+o.write = function(self, section, value)
+ local old = m:get(section, self.option) or ""
+ if old:lower() ~= value:lower() then
+ m.uci:foreach(appname, "nodes", function(e)
+ if e["group"] and e["group"]:lower() == old:lower() then
+ m.uci:set(appname, e[".name"], "group", value)
+ end
+ end)
+ end
+ return Value.write(self, section, value)
+end
o = s:option(TextValue, "url", translate("Subscribe URL"))
o.rows = 5
o.rmempty = false
o.validate = function(self, value)
if not value or value == "" then
- return nil, translate("URL cannot be empty")
+ return nil, translate("URL cannot be empty.")
end
return value:gsub("%s+", ""):gsub("%z", "")
end
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua
index c39b683..00d6e66 100644
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua
@@ -86,7 +86,7 @@ if has_xray or has_singbox then
function o.write(self, section, value)
local old = m:get(section, self.option) or "0"
if old ~= value then
- m:set(section, "flush_set", "1")
+ m:set("@global[0]", "flush_set", "1")
end
return Flag.write(self, section, value)
end
diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua
index 802d92f..1a743ed 100644
--- a/luci-app-passwall/luasrc/passwall/api.lua
+++ b/luci-app-passwall/luasrc/passwall/api.lua
@@ -1155,7 +1155,7 @@ function to_check_self()
}
end
local local_version = get_version()
- local remote_version = sys.exec("echo -n $(grep 'PKG_VERSION' /tmp/passwall_makefile|awk -F '=' '{print $2}')")
+ local remote_version = sys.exec("echo -n $(grep '^PKG_VERSION' /tmp/passwall_makefile | head -n 1 | awk -F '=' '{print $2}')")
exec("/bin/rm", {"-f", tmp_file})
local has_update = compare_versions(local_version, "<", remote_version)
diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm b/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm
index 65a0d12..e71efdb 100644
--- a/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm
+++ b/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm
@@ -126,8 +126,16 @@ local api = require "luci.passwall.api"
var val = input.value.trim();
if (!val) return;
+ if (val.toLowerCase() === "default") {
+ var emptyLi = Array.from(list.querySelectorAll(".dropdown-item"))
+ .find(function(el){ return !el.dataset.value; });
+ if (emptyLi) selectItem(emptyLi);
+ input.value = "";
+ return;
+ }
+
var li = Array.from(list.querySelectorAll(".dropdown-item")).find(function(el){
- return el.dataset.value === val;
+ return el.dataset.value.toLowerCase() === val.toLowerCase();
});
if (!li) {
li = document.createElement("li");
@@ -212,7 +220,7 @@ local api = require "luci.passwall.api"
-
+
diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po
index c7e5a0c..6bb3658 100644
--- a/luci-app-passwall/po/zh-cn/passwall.po
+++ b/luci-app-passwall/po/zh-cn/passwall.po
@@ -1114,6 +1114,12 @@ msgstr "手动订阅全部"
msgid "This remark already exists, please change a new remark."
msgstr "此备注已存在,请改一个新的备注。"
+msgid "Remark cannot be empty."
+msgstr "备注不能为空。"
+
+msgid "URL cannot be empty."
+msgstr "网址不能为空。"
+
msgid "Filter keyword Mode"
msgstr "过滤关键字模式"
diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua
index 557b1b1..efaeb89 100755
--- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua
+++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua
@@ -1546,7 +1546,7 @@ local function truncate_nodes(group)
local removeNodesSet = {}
for k, v in pairs(config.currentNodes) do
if v.currentNode and v.currentNode.add_mode == "2" then
- if (not group) or (group and group == v.currentNode.group) then
+ if (not group) or (group:lower() == (v.currentNode.group or ""):lower()) then
removeNodesSet[v.currentNode[".name"]] = true
end
end
@@ -1561,7 +1561,7 @@ local function truncate_nodes(group)
end
else
if config.currentNode and config.currentNode.add_mode == "2" then
- if (not group) or (group and group == config.currentNode.group) then
+ if (not group) or (group:lower() == (config.currentNode.group or ""):lower()) then
if config.delete then
config.delete(config)
elseif config.set then
@@ -1573,13 +1573,13 @@ local function truncate_nodes(group)
end
uci:foreach(appname, "nodes", function(node)
if node.add_mode == "2" then
- if (not group) or (group and group == node.group) then
+ if (not group) or (group:lower() == (node.group or ""):lower()) then
uci:delete(appname, node['.name'])
end
end
end)
uci:foreach(appname, "subscribe_list", function(o)
- if (not group) or group == o.remark then
+ if (not group) or (group:lower() == (o.remark or ""):lower()) then
uci:delete(appname, o['.name'], "md5")
end
end)
@@ -1714,13 +1714,13 @@ local function update_node(manual)
local group = {}
for _, v in ipairs(nodeResult) do
- group[v["remark"]] = true
+ group[v["remark"]:lower()] = true
end
if manual == 0 and next(group) then
uci:foreach(appname, "nodes", function(node)
-- 如果未发现新节点或手动导入的节点就不要删除了...
- if node.add_mode == "2" and (node.group and group[node.group] == true) then
+ if node.add_mode == "2" and (node.group and group[node.group:lower()] == true) then
uci:delete(appname, node['.name'])
end
end)
diff --git a/luci-app-store/Makefile b/luci-app-store/Makefile
index 2f8cce5..9c72d2a 100644
--- a/luci-app-store/Makefile
+++ b/luci-app-store/Makefile
@@ -11,13 +11,13 @@ LUCI_DEPENDS:=+curl +opkg +luci-lib-ipkg +tar +libuci-lua +mount-utils +luci-lib
LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.19)
LUCI_PKGARCH:=all
-PKG_VERSION:=0.1.29-6
+PKG_VERSION:=0.1.30-1
# PKG_RELEASE MUST be empty for luci.mk
PKG_RELEASE:=
-ISTORE_UI_VERSION:=0.1.28
-ISTORE_UI_RELEASE:=3
-PKG_HASH:=5097082a9d0821ff23f468f20c7ba9f635a9cb52eeac8b155a55b3441741d260
+ISTORE_UI_VERSION:=0.1.30
+ISTORE_UI_RELEASE:=1
+PKG_HASH:=74a9732e78351b0a78596a67410bafd838678e047a11dfdf3d40ab9d7ce65a78
PKG_SOURCE_URL_FILE:=v$(ISTORE_UI_VERSION)-$(ISTORE_UI_RELEASE).tar.gz
PKG_SOURCE:=istore-ui-$(PKG_SOURCE_URL_FILE)
diff --git a/luci-app-store/luasrc/controller/store.lua b/luci-app-store/luasrc/controller/store.lua
index 7a87628..57bf6ec 100644
--- a/luci-app-store/luasrc/controller/store.lua
+++ b/luci-app-store/luasrc/controller/store.lua
@@ -23,6 +23,10 @@ function index()
entry({"admin", "store", "log"}, call("store_log"))
entry({"admin", "store", "uid"}, call("action_user_id"))
entry({"admin", "store", "upload"}, post("store_upload"))
+ entry({"admin", "store", "del_record"}, post("store_del_record"))
+ entry({"admin", "store", "unrun"}, post("store_unrun"))
+ entry({"admin", "store", "run_records"}, call("store_run_records"))
+
entry({"admin", "store", "check_self_upgrade"}, call("check_self_upgrade"))
entry({"admin", "store", "do_self_upgrade"}, post("do_self_upgrade"))
entry({"admin", "store", "toggle_docker"}, post("toggle_docker"))
@@ -435,11 +439,7 @@ function store_upload()
local code, out, err
out = ""
if finished then
- if string.lower(string.sub(path, -4, -1)) == ".run" then
- code, out, err = _action("sh", "-c", "ls -l \"%s\"; md5sum \"%s\" 2>/dev/null; chmod 755 \"%s\" && \"%s\"; RET=$?; rm -f \"%s\"; exit $RET" %{ path, path, path, path, path })
- else
- code, out, err = _action("sh", "-c", "opkg install \"%s\"; RET=$?; rm -f \"%s\"; exit $RET" %{ path, path })
- end
+ code, out, err = _action(myopkg, "dotrun", path)
else
code = 500
err = "upload failed!"
@@ -454,6 +454,46 @@ function store_upload()
luci.http.write_json(ret)
end
+function store_unrun()
+ local record_id = luci.http.formvalue("id")
+ if record_id == nil or record_id == "" then
+ luci.http.status(400, "Bad Request")
+ return
+ end
+ local code, out, err = _action(myopkg, "unrun", record_id)
+ local ret = {
+ code = code,
+ stdout = out,
+ stderr = err
+ }
+ luci.http.prepare_content("application/json")
+ luci.http.write_json(ret)
+end
+
+function store_run_records()
+ local util = require "luci.util"
+ local run_records = util.exec(myopkg .. " run_records")
+ luci.http.prepare_content("application/json")
+ luci.http.write("{\n\"code\":200,\n\"records\":")
+ luci.http.write(run_records)
+ luci.http.write("\n}\n")
+end
+
+function store_del_record()
+ local nixio = require "nixio"
+ local os = require "os"
+ local rshift = nixio.bit.rshift
+
+ local record_id = luci.http.formvalue("id")
+ if record_id == nil or record_id == "" then
+ luci.http.status(400, "Bad Request")
+ return
+ end
+ local r = os.execute(myopkg.." del_record "..luci.util.shellquote(record_id).." >/dev/null 2>&1")
+ luci.http.prepare_content("application/json")
+ luci.http.write_json({code=rshift(r,8)})
+end
+
function configured()
local uci = luci.http.formvalue("uci")
if not validate_pkgname(uci) then
diff --git a/luci-app-store/root/bin/is-opkg b/luci-app-store/root/bin/is-opkg
index 0566af2..2eb1be9 100755
--- a/luci-app-store/root/bin/is-opkg
+++ b/luci-app-store/root/bin/is-opkg
@@ -25,6 +25,8 @@ ISTORE_PKG=luci-app-store
ISTORE_DEP_PKGS="luci-lib-taskd luci-lib-xterm taskd"
ISTORE_INDEX=https://istore.istoreos.com/repo/all/store/Packages.gz
+NEWLINE=$'\n'
+
is_init() {
mkdir -p ${DL_DIR} ${LISTS_DIR} ${IS_ROOT}/etc ${IS_ROOT}/var
@@ -231,6 +233,87 @@ try_upgrade_depends() {
return 0
}
+CMD_INSTALLED="opkg list-installed | cut -d' ' -f1 | sort -u"
+dotrun() {
+ local path="$1"
+ [ -f "$path" ] || { echo "file not found: $path" >&2; return 1; }
+ ls -l "$path"
+ local md5=$(md5sum "$path" 2>/dev/null | cut -d' ' -f1)
+ local ts=$(date '+%s')
+ #local date=$(date '+%Y-%m-%d_%H-%M-%S')
+ echo "MD5: $md5"
+ echo "Save installed pkg list before installing"
+ sh -c "$CMD_INSTALLED" > "/tmp/is-root/tmp/pre_$md5.txt"
+ if echo "$path" | grep -q '\.run$'; then
+ echo "Executing .run file"
+ chmod 0755 "$path" && "$path"
+ else
+ echo "Installing .ipk file"
+ opkg install "$path"
+ fi
+ local RET=$?
+ rm -f "$path"
+ if [ -s "/tmp/is-root/tmp/pre_$md5.txt" ]; then
+ echo "Save installed pkg list after installing"
+ sh -c "$CMD_INSTALLED" > "/tmp/is-root/tmp/post_$md5.txt"
+ grep -Fxf "/tmp/is-root/tmp/pre_$md5.txt" -v "/tmp/is-root/tmp/post_$md5.txt" > "/tmp/is-root/tmp/added_$md5.txt"
+ if [ -s "/tmp/is-root/tmp/added_$md5.txt" ]; then
+ echo "The following packages were added:"
+ cat "/tmp/is-root/tmp/added_$md5.txt"
+ mkdir -p /usr/share/istore/run-records
+ path="${path##*/}"
+ path="${path//\\/\\\\}" #\
+ path="${path//\"/\\\"}" #"
+ path="${path//$NEWLINE/\\n}" # \n
+ path="${path//^M/\\r}" # \r
+ echo "{\"id\":\"$ts-$md5\",\"ts\":$ts,\"md5\":\"$md5\",\"file\":\"$path\"}" > /usr/share/istore/run-records/$ts-$md5.txt
+ cat "/tmp/is-root/tmp/added_$md5.txt" >> /usr/share/istore/run-records/$ts-$md5.txt
+ fi
+ fi
+ rm -f "/tmp/is-root/tmp/pre_$md5.txt" "/tmp/is-root/tmp/post_$md5.txt" "/tmp/is-root/tmp/added_$md5.txt"
+ return $RET
+}
+
+run_records() {
+ local record
+ local file
+ echo "["
+ for record in /usr/share/istore/run-records/*.txt; do
+ [ -f "$record" ] || continue
+ echo "`head -1 "$record"`,"
+ done | head -c -2
+ echo ""
+ echo "]"
+}
+
+unrun() {
+ local id="$1"
+ [ -s "/usr/share/istore/run-records/$id.txt" ] || { echo "record not found: $id" >&2; return 1; }
+ echo "The following packages will be removed:"
+ tail -n +2 "/usr/share/istore/run-records/$id.txt" > "/tmp/is-root/tmp/to_unrun_$id.txt"
+ cat "/tmp/is-root/tmp/to_unrun_$id.txt"
+ local round max_round=6
+ for round in `seq 1 $max_round`; do
+ if [ $round == $max_round ]; then
+ opkg --autoremove remove `cat "/tmp/is-root/tmp/to_unrun_$id.txt"`
+ else
+ opkg --autoremove remove `cat "/tmp/is-root/tmp/to_unrun_$id.txt"` 2>/dev/null && break
+ fi
+ done
+ sh -c "$CMD_INSTALLED" > "/tmp/is-root/tmp/post_unrun_$id.txt"
+ grep -Fxf "/tmp/is-root/tmp/post_unrun_$id.txt" "/tmp/is-root/tmp/to_unrun_$id.txt" > "/tmp/is-root/tmp/remain_unrun_$id.txt"
+ if [ -s "/tmp/is-root/tmp/remain_unrun_$id.txt" ]; then
+ echo "The following packages failed to be removed:"
+ cat "/tmp/is-root/tmp/remain_unrun_$id.txt"
+ else
+ echo "All packages removed successfully."
+ rm -f "/usr/share/istore/run-records/$id.txt"
+ fi
+ rm -f "/tmp/is-root/tmp/to_unrun_$id.txt" "/tmp/is-root/tmp/post_unrun_$id.txt" "/tmp/is-root/tmp/remain_unrun_$id.txt"
+ return 0
+}
+
+
usage() {
echo "usage: is-opkg sub-command [arguments...]"
echo "where sub-command is one of:"
@@ -244,6 +327,11 @@ usage() {
echo " do_self_upgrade Upgrade iStore"
echo " arch Show libc architecture"
echo " opkg sys opkg wrap"
+ echo " dotrun {path} install .run/.ipk"
+ echo " run_records list .run/.ipk install records"
+ echo " del_record {id} delete .run/.ipk install record"
+ echo " unrun {id} Remove installed packages by .run/.ipk"
+ exit 1
}
is_init >/dev/null 2>&1
@@ -284,7 +372,18 @@ case $action in
"opkg")
opkg_wrap "$@"
;;
-
+ "dotrun")
+ dotrun "$@"
+ ;;
+ "run_records")
+ run_records
+ ;;
+ "del_record")
+ rm -f "/usr/share/istore/run-records/$1.txt"
+ ;;
+ "unrun")
+ unrun "$1"
+ ;;
*)
usage
;;
diff --git a/qbittorrent/Makefile b/qbittorrent/Makefile
index 052a7eb..d82ab18 100644
--- a/qbittorrent/Makefile
+++ b/qbittorrent/Makefile
@@ -7,12 +7,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qbittorrent
-PKG_VERSION:=5.1.2
+PKG_VERSION:=5.1.3
PKG_RELEASE=1
PKG_SOURCE:=qBittorrent-release-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/qbittorrent/qBittorrent/tar.gz/release-$(PKG_VERSION)?
-PKG_HASH:=a35448f3c8cb57d033bd3c4bd66c63417b0ca793ae7e9c5c5053960e2229ad9e
+PKG_HASH:=9c6c6018239a461ef02b67534db30232027cb8a431827c1f393f59cb8adc01e9
PKG_BUILD_DIR:=$(BUILD_DIR)/qBittorrent-release-$(PKG_VERSION)