diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 4cdb05bb2..e24f8f47b 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=4.53 -PKG_RELEASE:=10 +PKG_RELEASE:=11 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \ diff --git a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh index cd35dd960..0d53dc2c9 100755 --- a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh +++ b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.sh @@ -45,10 +45,10 @@ logic_restart() { for server in $(uci -q get dhcp.@dnsmasq[0].server); do [ -n "$(echo $server | grep '\/')" ] || uci -q del_list dhcp.@dnsmasq[0].server="$server" done - /etc/init.d/dnsmasq restart >/dev/null 2>&1 & + /etc/init.d/dnsmasq restart >/dev/null 2>&1 restore_servers else - /etc/init.d/dnsmasq restart >/dev/null 2>&1 & + /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi echolog "重启 dnsmasq 服务" LOG_FILE=${_LOG_FILE} @@ -59,7 +59,7 @@ restart() { eval_set_val $@ _LOG_FILE=$LOG_FILE [ -n "$no_log" ] && LOG_FILE="/dev/null" - /etc/init.d/dnsmasq restart >/dev/null 2>&1 & + /etc/init.d/dnsmasq restart >/dev/null 2>&1 echolog "重启 dnsmasq 服务" LOG_FILE=${_LOG_FILE} } diff --git a/luci-app-passwall/root/usr/share/passwall/helper_smartdns.sh b/luci-app-passwall/root/usr/share/passwall/helper_smartdns.sh index b63f53beb..7d6d4712c 100755 --- a/luci-app-passwall/root/usr/share/passwall/helper_smartdns.sh +++ b/luci-app-passwall/root/usr/share/passwall/helper_smartdns.sh @@ -6,7 +6,7 @@ restart() { _LOG_FILE=$LOG_FILE [ -n "$no_log" ] && LOG_FILE="/dev/null" rm -rf /tmp/smartdns.cache - /etc/init.d/smartdns reload >/dev/null 2>&1 & + /etc/init.d/smartdns reload >/dev/null 2>&1 LOG_FILE=${_LOG_FILE} } @@ -20,7 +20,7 @@ del() { rm -rf /tmp/etc/smartdns/passwall.conf sed -i "/passwall/d" /etc/smartdns/custom.conf >/dev/null 2>&1 rm -rf /tmp/smartdns.cache - /etc/init.d/smartdns reload >/dev/null 2>&1 & + /etc/init.d/smartdns reload >/dev/null 2>&1 } arg1=$1 diff --git a/luci-app-store/API.md b/luci-app-store/API.md index aa3c83ef2..ca713e440 100644 --- a/luci-app-store/API.md +++ b/luci-app-store/API.md @@ -139,3 +139,12 @@ {"code":0, "stdout":"", "stderr":""} ``` + +2. 枚举块设备 + ``` + GET /cgi-bin/luci/admin/store/get_block_devices + + + {"code":500, "msg":"Unable to execute block utility"} + {"code":200, "data":{"sda1":{"dev":"\/dev\/sda1","uuid":"f54566dd-ec58-4e24-9451-bbf75834add3","version":"1.0","type":"ext4","size":"238.46 GB"},"mmcblk0p2":{"dev":"\/dev\/mmcblk0p2","uuid":"dba3d0dc-f072-4e81-a0ac-ac35197fb286","version":"1.0","label":"etc","mount":"\/overlay","type":"ext4","size":"6.87 GB"},"mmcblk0p1":{"dev":"\/dev\/mmcblk0p1","uuid":"8f9564a1-68006e25-c4c26df6-de88ef16","version":"4.0","mount":"\/rom","type":"squashfs","size":"127.99 MB"}}} + ``` diff --git a/luci-app-store/luasrc/controller/store.lua b/luci-app-store/luasrc/controller/store.lua index eced840b8..4fc2a44f8 100644 --- a/luci-app-store/luasrc/controller/store.lua +++ b/luci-app-store/luasrc/controller/store.lua @@ -35,6 +35,7 @@ function index() entry({"admin", "store", "get_available_backup_file_list"}, call("get_available_backup_file_list")) entry({"admin", "store", "set_local_backup_dir_path"}, post("set_local_backup_dir_path")) entry({"admin", "store", "get_local_backup_dir_path"}, call("get_local_backup_dir_path")) + entry({"admin", "store", "get_block_devices"}, call("get_block_devices")) for _, action in ipairs({"update", "install", "upgrade", "remove"}) do store_api(action, true) @@ -285,7 +286,7 @@ function store_upload() out = "" if finished then if string.lower(string.sub(path, -4, -1)) == ".run" then - code, out, err = _action("sh", "-c", "chmod 755 \"%s\" && \"%s\"" %{ path, path }) + code, out, err = _action("sh", "-c", "ls -l \"%s\"; md5sum \"%s\" 2>/dev/null; chmod 755 \"%s\" && \"%s\"" %{ path, path, path, path }) else code, out, err = _action("opkg", "install", path) end @@ -624,3 +625,66 @@ function get_local_backup_dir_path() luci.http.write_json(error_ret) end end + +-- copy from /usr/lib/lua/luci/model/diskman.lua +local function byte_format(byte) + local suff = {"B", "KB", "MB", "GB", "TB"} + for i=1, 5 do + if byte > 1024 and i < 5 then + byte = byte / 1024 + else + return string.format("%.2f %s", byte, suff[i]) + end + end +end + +-- copy from /usr/libexec/rpcd/luci +local function getBlockDevices() + local fs = require "nixio.fs" + + local block = io.popen("/sbin/block info", "r") + if block then + local rv = {} + + while true do + local ln = block:read("*l") + if not ln then + break + end + + local dev = ln:match("^/dev/(.-):") + if dev then + local s = tonumber((fs.readfile("/sys/class/block/" .. dev .."/size"))) + local e = { + dev = "/dev/" .. dev, + size = s and byte_format(s * 512) + } + + local key, val = { } + for key, val in ln:gmatch([[(%w+)="(.-)"]]) do + e[key:lower()] = val + end + + rv[dev] = e + end + end + + block:close() + + return rv + else + return + end +end + +function get_block_devices() + local error_ret = {code = 500, msg = "Unable to execute block utility"} + local devices = getBlockDevices() + if devices ~= nil then + luci.http.prepare_content("application/json") + luci.http.write_json({code = 200, data = devices}) + else + luci.http.prepare_content("application/json") + luci.http.write_json(error_ret) + end +end diff --git a/smartdns/Makefile b/smartdns/Makefile index 0d64157cc..db377f852 100644 --- a/smartdns/Makefile +++ b/smartdns/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=smartdns PKG_VERSION:=Release36.1 -PKG_RELEASE:=18 +PKG_RELEASE:=19 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://www.github.com/pymumu/smartdns.git -PKG_SOURCE_VERSION:=24661c2419a81e660b11a0e3d35a3bc269cd4bfa -PKG_MIRROR_HASH:=skip +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/pymumu/smartdns/tar.gz/Release$(PKG_VERSION)? +PKG_HASH:=skip +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-Release$(PKG_VERSION) PKG_MAINTAINER:=Nick Peng PKG_LICENSE:=GPL-3.0-or-later @@ -21,8 +21,8 @@ PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk -MAKE_VARS += VER=$(PKG_VERSION) MAKE_PATH:=src +MAKE_VARS+= VER=$(PKG_VERSION) define Package/smartdns SECTION:=net diff --git a/v2ray-geodata/Makefile b/v2ray-geodata/Makefile index 6525f43dc..0dec9a5de 100644 --- a/v2ray-geodata/Makefile +++ b/v2ray-geodata/Makefile @@ -12,22 +12,22 @@ PKG_MAINTAINER:=Tianling Shen include $(INCLUDE_DIR)/package.mk -GEOIP_VER:=202203100039 +GEOIP_VER:=202204210050 GEOIP_FILE:=geoip.dat.$(GEOIP_VER) define Download/geoip URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/ URL_FILE:=geoip.dat FILE:=$(GEOIP_FILE) - HASH:=7532aadf5bda5e2bc1b9a100662022405f19d61245a27b3ace9a982ca0242bc9 + HASH:=9414426b105894bbacd6e913d180e4d86c32bd08d468f08b8ea8d4f9ecd6674c endef -GEOSITE_VER:=20220310015105 +GEOSITE_VER:=20220425025949 GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER) define Download/geosite URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/ URL_FILE:=dlc.dat FILE:=$(GEOSITE_FILE) - HASH:=c7d9ee11e415ffbd8458e2cb9716eea7a220a3023d1db35d84e47d33b1f4cd72 + HASH:=9065ea5d6fa20acf3e1a687b1c33f8669c48bf61b4979768ce2f50fe507053ee endef define Package/v2ray-geodata/template