summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-05-17 17:04:49 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-05-17 17:04:49 +0900
commit230537b994d29710d1c33c2eef35487573dc550e (patch)
tree48b3815c60cc51cf2ca0301e09971dc043ce95b9 /git
parent4a2def16fa9b66d0f7b3ce0812325365bb821287 (diff)
Add server/ dir, CLAUDE.md, and SSH key management via install.sh
- server/authorized_keys: root SSH keys managed in repo - server/requirements.md: list of required tools/packages - git/install.sh: now also applies authorized_keys on install - CLAUDE.md: repo overview for Claude Code - Deploy.md: simplified Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'git')
-rwxr-xr-xgit/install.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/git/install.sh b/git/install.sh
index 12f561c..d4522ea 100755
--- a/git/install.sh
+++ b/git/install.sh
@@ -7,12 +7,27 @@ set -euo pipefail
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
REPOS_FILE="$APP_DIR/git/repos.txt"
HOOKS_SRC="$APP_DIR/git/hooks"
+AUTH_KEYS_SRC="$APP_DIR/server/authorized_keys"
if [[ "$(id -u)" -ne 0 ]]; then
echo "ERROR: root として実行してください" >&2
exit 1
fi
+echo "=== SSH authorized_keys ==="
+if [[ -f "$AUTH_KEYS_SRC" ]]; then
+ mkdir -p /root/.ssh
+ chmod 700 /root/.ssh
+ if diff -q "$AUTH_KEYS_SRC" /root/.ssh/authorized_keys >/dev/null 2>&1; then
+ echo " unchanged"
+ else
+ cp "$AUTH_KEYS_SRC" /root/.ssh/authorized_keys
+ chmod 600 /root/.ssh/authorized_keys
+ echo " installed"
+ fi
+fi
+
+echo ""
echo "=== Repositories ==="
while IFS=: read -r repo_name work_tree; do
[[ "$repo_name" =~ ^#.*$ || -z "$repo_name" ]] && continue