commit fb8402d0ce2b6fb92d980bfba8366d3d96d78993 parent cf68d94a0c7bcb5e18f45ba8cc3aca4b41296418 Author: Christian Ermann <christianermann@gmail.com> Date: Wed, 23 Oct 2024 21:17:10 +0000 Add post receive hook to update site Diffstat:
M | install.sh | | | 4 | ++++ |
A | post-receive | | | 9 | +++++++++ |
M | repo-init.sh | | | 3 | +++ |
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/install.sh b/install.sh @@ -4,6 +4,10 @@ cp repo-init.sh /usr/local/bin/repo-init cp repo-index.sh /usr/local/bin/repo-index cp repo-site.sh /usr/local/bin/repo-site cp repo-full-site.sh /usr/local/bin/repo-full-site + cp config.rc /home/git/config.rc +mkdir -p /home/git/template +cp post-receive /home/git/template/post-receive chown root:wheel /home/git/config.rc +chown -R git:git /home/git/template diff --git a/post-receive b/post-receive @@ -0,0 +1,9 @@ +#! /bin/sh + +set -euf + +CONFIG_PATH="/home/git/config.rc" +. "${CONFIG_PATH}" + +repo-index +repo-site diff --git a/repo-init.sh b/repo-init.sh @@ -13,3 +13,6 @@ git init --bare "${REPO_PATH}" printf "%s\n" "${OWNER}" > "${REPO_PATH}/owner" printf "%s\n" "${DESC}" > "${REPO_PATH}/description" touch "${REPO_PATH}/git-daemon-export-ok" + +cp "${GIT_ROOT}/template/post-receive" "${REPO_PATH}/hooks/post-receive" +chmod u+x "${REPO_PATH}/hooks/post-receive"