blob: 22e3f757c51e2dbc2bdfc983833595d23cca8912 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/bash
# sync-credentials — copies Claude and Gemini credentials to workspace
set -euo pipefail
# This script is intended to be run by cron every 10 minutes.
# It copies Claude and Gemini credentials from root home to workspace for claudomator.
# Source paths
SOURCE_CLAUDE="/root/.claude/.credentials.json"
SOURCE_CLAUDE_SETTINGS="/root/.claude.json"
SOURCE_GEMINI_OAUTH="/root/.gemini/oauth_creds.json"
SOURCE_GEMINI_ACCOUNTS="/root/.gemini/google_accounts.json"
# Destination paths
DEST_CLAUDE="/workspace/claudomator/credentials/claude/.credentials.json"
DEST_CLAUDE_SETTINGS="/workspace/claudomator/credentials/claude/.claude.json"
DEST_GEMINI_OAUTH="/workspace/claudomator/credentials/gemini/oauth_creds.json"
DEST_GEMINI_ACCOUNTS="/workspace/claudomator/credentials/gemini/google_accounts.json"
# Sync Claude
if [[ -f "$SOURCE_CLAUDE" ]]; then
mkdir -p "$(dirname "$DEST_CLAUDE")"
cp "$SOURCE_CLAUDE" "$DEST_CLAUDE"
chown root:www-data "$DEST_CLAUDE" 2>/dev/null || true
chmod 640 "$DEST_CLAUDE"
echo "Synced Claude credentials."
fi
if [[ -f "$SOURCE_CLAUDE_SETTINGS" ]]; then
cp "$SOURCE_CLAUDE_SETTINGS" "$DEST_CLAUDE_SETTINGS"
chmod 644 "$DEST_CLAUDE_SETTINGS"
echo "Synced Claude settings."
fi
# Sync Gemini
if [[ -f "$SOURCE_GEMINI_OAUTH" ]]; then
mkdir -p "$(dirname "$DEST_GEMINI_OAUTH")"
cp "$SOURCE_GEMINI_OAUTH" "$DEST_GEMINI_OAUTH"
chmod 600 "$DEST_GEMINI_OAUTH"
echo "Synced Gemini OAuth credentials."
fi
if [[ -f "$SOURCE_GEMINI_ACCOUNTS" ]]; then
mkdir -p "$(dirname "$DEST_GEMINI_ACCOUNTS")"
cp "$SOURCE_GEMINI_ACCOUNTS" "$DEST_GEMINI_ACCOUNTS"
chmod 600 "$DEST_GEMINI_ACCOUNTS"
echo "Synced Gemini Google accounts."
fi
|