-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·220 lines (186 loc) · 7.19 KB
/
install.sh
File metadata and controls
executable file
·220 lines (186 loc) · 7.19 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/bin/bash
# One-liner installer for Obsidian Meeting Tasks Plugin
# Usage: curl -fsSL https://raw.githubusercontent.com/jimallen/TasksAgent/master/install.sh | bash
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
REPO_OWNER="jimallen"
REPO_NAME="TasksAgent"
PLUGIN_ID="meeting-tasks"
echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
echo -e "${GREEN} Obsidian Meeting Tasks Plugin Installer${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
echo
# Check for required commands
for cmd in curl unzip; do
if ! command -v $cmd &> /dev/null; then
echo -e "${RED}❌ Error: $cmd is required but not installed.${NC}"
exit 1
fi
done
# Detect OS for vault search paths
OS_TYPE="$(uname -s)"
case "${OS_TYPE}" in
Linux*) MACHINE=Linux;;
Darwin*) MACHINE=Mac;;
CYGWIN*|MINGW*|MSYS*) MACHINE=Windows;;
*) MACHINE="UNKNOWN"
esac
echo -e "${YELLOW}📦 Downloading latest release...${NC}"
# Get latest release info
LATEST_RELEASE=$(curl -fsSL "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest")
VERSION=$(echo "$LATEST_RELEASE" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$VERSION" ]; then
echo -e "${YELLOW}⚠️ No releases found. Using files from master branch...${NC}"
BASE_URL="https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_NAME}/master"
USE_RELEASES=false
else
echo -e "${GREEN}✅ Found version: ${VERSION}${NC}"
BASE_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${VERSION}"
USE_RELEASES=true
fi
# Create temporary directory
TEMP_DIR=$(mktemp -d)
trap "rm -rf ${TEMP_DIR}" EXIT
echo -e "${YELLOW}📥 Downloading plugin files...${NC}"
# Download required files
if [ "$USE_RELEASES" = true ]; then
# Download from release assets
curl -fsSL "${BASE_URL}/main.js" -o "${TEMP_DIR}/main.js"
curl -fsSL "${BASE_URL}/manifest.json" -o "${TEMP_DIR}/manifest.json"
curl -fsSL "${BASE_URL}/styles.css" -o "${TEMP_DIR}/styles.css"
else
# Fallback to raw repository files
curl -fsSL "${BASE_URL}/main.js" -o "${TEMP_DIR}/main.js"
curl -fsSL "${BASE_URL}/manifest.json" -o "${TEMP_DIR}/manifest.json"
curl -fsSL "${BASE_URL}/styles.css" -o "${TEMP_DIR}/styles.css"
fi
# Verify files downloaded
for file in main.js manifest.json styles.css; do
if [ ! -f "${TEMP_DIR}/${file}" ]; then
echo -e "${RED}❌ Failed to download ${file}${NC}"
exit 1
fi
done
echo -e "${GREEN}✅ Files downloaded successfully!${NC}"
echo
echo -e "${BLUE}🔍 Searching for Obsidian vaults...${NC}"
echo
# Search for vaults
VAULTS=()
DEFAULT_PATHS=(
"$HOME/Documents"
"$HOME/Obsidian"
"$HOME"
"$HOME/Desktop"
"$HOME/OneDrive"
"$HOME/Dropbox"
"$HOME/Google Drive"
"$HOME/iCloud"
)
for base_path in "${DEFAULT_PATHS[@]}"; do
if [ -d "$base_path" ]; then
while IFS= read -r -d '' vault; do
vault_dir=$(dirname "$vault")
if [[ ! " ${VAULTS[*]} " =~ " ${vault_dir} " ]]; then
VAULTS+=("$vault_dir")
fi
done < <(find "$base_path" -maxdepth 4 -type d -name ".obsidian" -print0 2>/dev/null)
fi
done
if [ ${#VAULTS[@]} -eq 0 ]; then
echo -e "${YELLOW}No Obsidian vaults found automatically.${NC}"
echo
echo -e "${BLUE}Please enter the full path to your Obsidian vault:${NC}"
# Read from /dev/tty for piped script support
if [ -t 0 ]; then
read -r custom_path
else
read -r custom_path < /dev/tty 2>/dev/null || {
echo -e "${RED}❌ Cannot read input. Please run this script interactively.${NC}"
exit 1
}
fi
custom_path="${custom_path/#\~/$HOME}"
if [ ! -d "$custom_path/.obsidian" ]; then
echo -e "${RED}❌ No .obsidian folder found at: $custom_path${NC}"
echo -e "${YELLOW}Make sure you entered the correct vault path.${NC}"
exit 1
fi
VAULTS+=("$custom_path")
fi
echo -e "${GREEN}Found ${#VAULTS[@]} Obsidian vault(s):${NC}"
echo
for i in "${!VAULTS[@]}"; do
vault_name=$(basename "${VAULTS[$i]}")
echo -e " ${BLUE}[$((i+1))]${NC} $vault_name"
echo -e " ${YELLOW}${VAULTS[$i]}${NC}"
done
echo
echo -e "${BLUE}Select a vault to install the plugin (enter number):${NC}"
if [ ${#VAULTS[@]} -gt 1 ]; then
echo -e "${YELLOW}Or enter 'all' to install to all vaults:${NC}"
fi
# Read from /dev/tty for piped script support
if [ -t 0 ]; then
read -r selection
else
read -r selection < /dev/tty 2>/dev/null || {
echo -e "${RED}❌ Cannot read input. Please run this script interactively.${NC}"
exit 1
}
fi
if [ "$selection" = "all" ] && [ ${#VAULTS[@]} -gt 1 ]; then
SELECTED_VAULTS=("${VAULTS[@]}")
elif [[ "$selection" =~ ^[0-9]+$ ]] && [ "$selection" -ge 1 ] && [ "$selection" -le ${#VAULTS[@]} ]; then
SELECTED_VAULTS=("${VAULTS[$((selection-1))]}")
else
echo -e "${RED}❌ Invalid selection!${NC}"
echo -e "${YELLOW}Please enter a valid number (1-${#VAULTS[@]})${NC}"
exit 1
fi
for vault_path in "${SELECTED_VAULTS[@]}"; do
echo
vault_name=$(basename "$vault_path")
echo -e "${BLUE}Installing to: ${vault_name}${NC}"
PLUGIN_DIR="$vault_path/.obsidian/plugins/$PLUGIN_ID"
# Check if plugin is already installed
if [ -f "$PLUGIN_DIR/data.json" ]; then
echo -e "${YELLOW}⚠️ Plugin already installed - updating plugin files only${NC}"
echo -e "${GREEN}✓ Your settings and data will be preserved${NC}"
fi
mkdir -p "$PLUGIN_DIR"
# Only copy plugin code files, never overwrite user data (data.json)
cp "${TEMP_DIR}/main.js" "$PLUGIN_DIR/"
cp "${TEMP_DIR}/manifest.json" "$PLUGIN_DIR/"
cp "${TEMP_DIR}/styles.css" "$PLUGIN_DIR/"
if [ $? -eq 0 ]; then
echo -e "${GREEN}✅ Successfully installed to: $vault_name${NC}"
if [ -f "$PLUGIN_DIR/data.json" ]; then
echo -e "${GREEN} Plugin updated - your settings preserved${NC}"
else
echo -e "${YELLOW} First-time install - configure plugin settings in Obsidian${NC}"
fi
else
echo -e "${RED}❌ Failed to install to: $vault_name${NC}"
fi
done
echo
echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
echo -e "${GREEN}✨ Installation complete!${NC}"
echo
echo -e "${GREEN}📌 Note: Only plugin code was updated${NC}"
echo -e "${GREEN} Your settings, API keys, and data are safe${NC}"
echo
echo -e "${YELLOW}Next steps:${NC}"
echo -e " 1. Restart Obsidian or reload with Ctrl/Cmd+R"
echo -e " 2. Enable the plugin in Settings → Community Plugins"
echo -e " 3. Configure Gmail OAuth and Claude API in plugin settings"
echo
echo -e "${BLUE}Documentation:${NC}"
echo -e " ${YELLOW}https://github.com/jimallen/TasksAgent${NC}"
echo
echo -e "${BLUE}═══════════════════════════════════════════════${NC}"