From c2451f3b7fe199f2fc7a27995cd47b4eba2b1ec4 Mon Sep 17 00:00:00 2001 From: Sam Latsin Date: Fri, 9 Oct 2026 17:41:36 +0300 Subject: [PATCH] Fixed chmod --- luci/rpcd.sh | 2 ++ router/mihomo-kit.sh | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/luci/rpcd.sh b/luci/rpcd.sh index fd78eb7..ac063fa 100644 --- a/luci/rpcd.sh +++ b/luci/rpcd.sh @@ -12,6 +12,8 @@ . /usr/share/libubox/jshn.sh export PATH=/usr/sbin:/usr/bin:/sbin:/bin +# rpcd runs with umask 077; jobs (kit update) install web files that must stay readable +umask 022 NIKKI_DIR=/etc/nikki PROFILES_D=$NIKKI_DIR/profiles.d diff --git a/router/mihomo-kit.sh b/router/mihomo-kit.sh index d49802b..79bee12 100755 --- a/router/mihomo-kit.sh +++ b/router/mihomo-kit.sh @@ -484,17 +484,20 @@ install_luci() { src=$KIT_DIR/luci [ -d "$src" ] && [ -d /www/luci-static/resources ] || return 0 _changed=0 + # put ; uhttpd answers 403 for files that are not world-readable, + # and a run from LuCI inherits rpcd's umask 077 put() { - cmp -s "$1" "$2" && return 0 - mkdir -p "$(dirname "$2")" - cp "$1" "$2" - _changed=1 + if ! cmp -s "$1" "$2"; then + mkdir -p "$(dirname "$2")" + cp "$1" "$2" + _changed=1 + fi + chmod "$3" "$2" } - put "$src/rpcd.sh" /usr/libexec/rpcd/mihomo-kit - chmod +x /usr/libexec/rpcd/mihomo-kit - put "$src/acl.json" /usr/share/rpcd/acl.d/luci-app-mihomo-kit.json - put "$src/menu.json" /usr/share/luci/menu.d/luci-app-mihomo-kit.json - put "$src/mihomo-kit.js" /www/luci-static/resources/view/mihomo-kit.js + put "$src/rpcd.sh" /usr/libexec/rpcd/mihomo-kit 755 + put "$src/acl.json" /usr/share/rpcd/acl.d/luci-app-mihomo-kit.json 644 + put "$src/menu.json" /usr/share/luci/menu.d/luci-app-mihomo-kit.json 644 + put "$src/mihomo-kit.js" /www/luci-static/resources/view/mihomo-kit.js 644 [ "$_changed" = 1 ] || return 0 rm -rf /tmp/luci-indexcache* /tmp/luci-modulecache log "LuCI page installed: Services -> mihomo-kit"