init: samurai setup script — vault clone, git config, Obsidian auto-start

This commit is contained in:
kenpat 2026-06-12 00:04:40 -05:00
commit b013bef372
2 changed files with 85 additions and 0 deletions

71
samurai/setup.sh Normal file
View file

@ -0,0 +1,71 @@
#!/usr/bin/env bash
# samurai setup script — run from Claude Code (Git Bash) on samurai
# Usage: bash setup.sh
set -e
MONK="100.85.209.116"
MONK_GIT_PORT="2222"
VAULT="$HOME/obsidian-vault"
STUDY="$HOME/study-tracker"
echo "=== KiteStacks Samurai Setup ==="
# ── Step 1: SSH host key ──────────────────────────────────────────────
echo "[1/5] Adding Forgejo host key..."
mkdir -p ~/.ssh
ssh-keyscan -p $MONK_GIT_PORT $MONK >> ~/.ssh/known_hosts 2>/dev/null
echo " done"
# ── Step 2: Clone obsidian vault ──────────────────────────────────────
echo "[2/5] Cloning obsidian-vault..."
if [ -d "$VAULT" ]; then
echo " already exists, pulling latest..."
git -C "$VAULT" pull
else
git clone ssh://git@${MONK}:${MONK_GIT_PORT}/kenpat/obsidian-vault.git "$VAULT"
fi
echo " done: $VAULT"
# ── Step 3: Clone study tracker ───────────────────────────────────────
echo "[3/5] Cloning study-tracker..."
if [ -d "$STUDY" ]; then
echo " already exists, pulling latest..."
git -C "$STUDY" pull
else
git clone ssh://git@${MONK}:${MONK_GIT_PORT}/kenpat/study-tracker.git "$STUDY"
fi
echo " done: $STUDY"
# ── Step 4: Configure git identity ───────────────────────────────────
echo "[4/5] Configuring git..."
git -C "$VAULT" config user.email "kenpat7177@gmail.com"
git -C "$VAULT" config user.name "kenpat"
git -C "$STUDY" config user.email "kenpat7177@gmail.com"
git -C "$STUDY" config user.name "kenpat"
echo " done"
# ── Step 5: Obsidian auto-start ───────────────────────────────────────
echo "[5/5] Setting up Obsidian auto-start..."
STARTUP="$APPDATA/Microsoft/Windows/Start Menu/Programs/Startup"
OBSIDIAN_EXE=$(find "$LOCALAPPDATA/Obsidian" -name "Obsidian.exe" 2>/dev/null | head -1)
if [ -n "$OBSIDIAN_EXE" ]; then
powershell.exe -ExecutionPolicy Bypass -Command "
\$lnk = (New-Object -ComObject WScript.Shell).CreateShortcut('$STARTUP\Obsidian.lnk')
\$lnk.TargetPath = '$OBSIDIAN_EXE'
\$lnk.Arguments = '--vault \"$VAULT\"'
\$lnk.Save()
Write-Host 'Auto-start shortcut created'
"
else
echo " Obsidian.exe not found — install Obsidian first then re-run this script"
fi
echo ""
echo "=== Setup complete ==="
echo " Vault: $VAULT"
echo " Study log: $STUDY"
echo " Auto-start: Obsidian opens on login"
echo ""
echo "Next: Open Obsidian, select vault at $VAULT"
echo " Install plugins: Git + Pomodoro Timer"