-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·62 lines (50 loc) · 1.67 KB
/
bootstrap.sh
File metadata and controls
executable file
·62 lines (50 loc) · 1.67 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
#!/bin/bash
# =============================================================================
# Agent Second Brain - Bootstrap Script
# =============================================================================
# Downloads setup.sh and runs it properly (not via pipe)
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/smixs/agent-second-brain/main/bootstrap.sh | bash
# =============================================================================
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m'
echo ""
echo -e "${CYAN}Agent Second Brain - Bootstrap${NC}"
echo ""
# Check if running as root
if [ "$EUID" -eq 0 ]; then
echo -e "${RED}[X] Do not run as root!${NC}"
echo " Create a user first: adduser myuser && usermod -aG sudo myuser"
echo " Then: su - myuser"
exit 1
fi
# Always download from original repo
SETUP_URL="https://raw.githubusercontent.com/smixs/agent-second-brain/main/setup.sh"
echo "Downloading setup script..."
# Create temp file
TEMP_SCRIPT=$(mktemp /tmp/setup-XXXXXX.sh)
# Download setup script
if command -v curl &> /dev/null; then
curl -fsSL "$SETUP_URL" -o "$TEMP_SCRIPT"
elif command -v wget &> /dev/null; then
wget -q "$SETUP_URL" -O "$TEMP_SCRIPT"
else
echo -e "${RED}[X] Neither curl nor wget found${NC}"
echo " Install: sudo apt install curl"
exit 1
fi
if [ ! -s "$TEMP_SCRIPT" ]; then
echo -e "${RED}[X] Failed to download setup script${NC}"
rm -f "$TEMP_SCRIPT"
exit 1
fi
echo -e "${GREEN}[OK] Downloaded${NC}"
echo ""
# Make executable and run PROPERLY (not via pipe!)
# exec replaces current process, so stdin works normally
chmod +x "$TEMP_SCRIPT"
exec bash "$TEMP_SCRIPT"