Fixed chmod

This commit is contained in:
Sam Latsin 2026-10-09 17:41:36 +03:00
parent 51aba8cc1d
commit c2451f3b7f
2 changed files with 14 additions and 9 deletions

View File

@ -12,6 +12,8 @@
. /usr/share/libubox/jshn.sh . /usr/share/libubox/jshn.sh
export PATH=/usr/sbin:/usr/bin:/sbin:/bin 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 NIKKI_DIR=/etc/nikki
PROFILES_D=$NIKKI_DIR/profiles.d PROFILES_D=$NIKKI_DIR/profiles.d

View File

@ -484,17 +484,20 @@ install_luci() {
src=$KIT_DIR/luci src=$KIT_DIR/luci
[ -d "$src" ] && [ -d /www/luci-static/resources ] || return 0 [ -d "$src" ] && [ -d /www/luci-static/resources ] || return 0
_changed=0 _changed=0
# put <src> <dst> <mode>; uhttpd answers 403 for files that are not world-readable,
# and a run from LuCI inherits rpcd's umask 077
put() { put() {
cmp -s "$1" "$2" && return 0 if ! cmp -s "$1" "$2"; then
mkdir -p "$(dirname "$2")" mkdir -p "$(dirname "$2")"
cp "$1" "$2" cp "$1" "$2"
_changed=1 _changed=1
fi
chmod "$3" "$2"
} }
put "$src/rpcd.sh" /usr/libexec/rpcd/mihomo-kit put "$src/rpcd.sh" /usr/libexec/rpcd/mihomo-kit 755
chmod +x /usr/libexec/rpcd/mihomo-kit put "$src/acl.json" /usr/share/rpcd/acl.d/luci-app-mihomo-kit.json 644
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 644
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 644
put "$src/mihomo-kit.js" /www/luci-static/resources/view/mihomo-kit.js
[ "$_changed" = 1 ] || return 0 [ "$_changed" = 1 ] || return 0
rm -rf /tmp/luci-indexcache* /tmp/luci-modulecache rm -rf /tmp/luci-indexcache* /tmp/luci-modulecache
log "LuCI page installed: Services -> mihomo-kit" log "LuCI page installed: Services -> mihomo-kit"