summaryrefslogtreecommitdiff
path: root/scripts/install-hooks.sh
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-05-17 11:18:12 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-05-17 11:18:12 +0900
commitb6efad84b51c6df5f595683d66b855c75bddabc4 (patch)
treeb12d164613032105a05e871f7b2e0871b51ea658 /scripts/install-hooks.sh
parentfa882598d3ee6bff4e32892a81b6b2712eb8c11d (diff)
Centralize repo and hook management: add repos.txt and install.sh
All bare repo creation is now driven by repos.txt in this repo. install.sh replaces install-hooks.sh and handles both repo creation and hook deployment. Other repos' server-setup.sh no longer manage bare repos or hooks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'scripts/install-hooks.sh')
-rwxr-xr-xscripts/install-hooks.sh36
1 files changed, 0 insertions, 36 deletions
diff --git a/scripts/install-hooks.sh b/scripts/install-hooks.sh
deleted file mode 100755
index c502496..0000000
--- a/scripts/install-hooks.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-# サーバー上で root として手動実行する
-# server-hooks/ の内容を /var/git/*/hooks/ に展開する
-set -euo pipefail
-
-APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
-HOOKS_SRC="$APP_DIR/server-hooks"
-
-if [[ "$(id -u)" -ne 0 ]]; then
- echo "ERROR: root として実行してください" >&2
- exit 1
-fi
-
-for repo_src in "$HOOKS_SRC"/*/; do
- repo_name="$(basename "$repo_src")"
- git_hooks_dir="/var/git/${repo_name}.git/hooks"
-
- if [[ ! -d "$git_hooks_dir" ]]; then
- echo "SKIP: $git_hooks_dir が存在しません ($repo_name)"
- continue
- fi
-
- for hook_file in "$repo_src"*; do
- hook_name="$(basename "$hook_file")"
- dst="$git_hooks_dir/$hook_name"
- if diff -q "$hook_file" "$dst" >/dev/null 2>&1; then
- echo " unchanged: $repo_name/$hook_name"
- else
- cp "$hook_file" "$dst"
- chmod +x "$dst"
- echo " installed: $repo_name/$hook_name"
- fi
- done
-done
-
-echo "Done."