diff --git a/server-tools/lake-lamp-authz/README.md b/server-tools/lake-lamp-authz/README.md index b7d3d26..d40812f 100644 --- a/server-tools/lake-lamp-authz/README.md +++ b/server-tools/lake-lamp-authz/README.md @@ -88,7 +88,7 @@ node server-tools/lake-lamp-authz/authorize-repo-push.js \ `safe.directory`,不得使用通配符。 光湖代码频道本身保留 `UMask=0077`,以免放宽数据库和其他状态目录。仅在 -`guanghu-ice-heart.git/hooks/post-receive` 安装仓库随附的 +`guanghu-ice-heart.git/hooks/post-receive.d/guanghu-ice-heart-share` 安装仓库随附的 `hooks/guanghu-ice-heart-post-receive`,让成功的公共 Git 推送完成后校正 `objects` 与 `refs` 的共享组权限。不要为了共享一个裸仓库而修改整个代码频道服务的 UMask。 diff --git a/server-tools/lake-lamp-authz/hooks/guanghu-ice-heart-post-receive b/server-tools/lake-lamp-authz/hooks/guanghu-ice-heart-post-receive index 3827527..f3bf8d1 100755 --- a/server-tools/lake-lamp-authz/hooks/guanghu-ice-heart-post-receive +++ b/server-tools/lake-lamp-authz/hooks/guanghu-ice-heart-post-receive @@ -4,7 +4,10 @@ set -eu # The code-channel service runs with UMask=0077. Keep that isolation for its # database and other state, but make Git objects and refs readable/writable by # the repository's dedicated shared group after an accepted public push. -repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd -P) +cat >/dev/null +repo_dir=$(git rev-parse --absolute-git-dir) +expected_repo=/var/lib/guanghu/personas/guanghu/hlcc-v16.0.1/data/repositories/bingshuo/guanghu-ice-heart.git +[ "$repo_dir" = "$expected_repo" ] || exit 0 cd "$repo_dir" owner_uid=$(id -u) @@ -30,4 +33,4 @@ for shared_file in HEAD packed-refs; do fi done -printf '%s\n' "post_receive_permissions_reconciled" >"$repo_dir/hooks/post-receive.last" +printf '%s\n' "post_receive_permissions_reconciled" >"$repo_dir/hooks/post-receive-share.last"