Skip to content

An always-on second brain you talk to. Voice notes in Telegram → typed, linked knowledge in your Obsidian vault. Runs 24/7 on the Claude subscription you already have.

fix(bootstrap): download to file then exec, no pipe stdin issues

smixs4cce52b51975
diff --git a/bootstrap.sh b/bootstrap.sh
index 18419ae..12a4de3 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -3,13 +3,10 @@
# =============================================================================
# Agent Second Brain - Bootstrap Script
# =============================================================================
-# Downloads and runs the full setup script
+# Downloads setup.sh and runs it properly (not via pipe)
#
-# Usage (after forking the repo):
-# curl -fsSL https://raw.githubusercontent.com/YOUR_USER/agent-second-brain/main/bootstrap.sh | bash
-#
-# Or with your username:
-# curl -fsSL https://raw.githubusercontent.com/YOUR_USER/agent-second-brain/main/bootstrap.sh | bash -s YOUR_USER
+# Usage:
+# curl -fsSL https://raw.githubusercontent.com/smixs/agent-second-brain/main/bootstrap.sh | bash
# =============================================================================
set -e
@@ -31,58 +28,35 @@ if [ "$EUID" -eq 0 ]; then
exit 1
fi
-# Get GitHub username
-GITHUB_USER="${1:-}"
-
-if [ -z "$GITHUB_USER" ]; then
- echo -e "${CYAN}Enter your GitHub username (where you forked the repo):${NC}"
- # Read from /dev/tty to handle curl | bash case
- read -r GITHUB_USER < /dev/tty
-fi
-
-if [ -z "$GITHUB_USER" ]; then
- echo -e "${RED}[X] GitHub username is required${NC}"
- echo ""
- echo "Usage:"
- echo " curl -fsSL URL | bash -s YOUR_GITHUB_USER"
- echo " Example: curl -fsSL URL | bash -s smixs"
- exit 1
-fi
+# Always download from original repo
+SETUP_URL="https://raw.githubusercontent.com/smixs/agent-second-brain/main/setup.sh"
-SETUP_URL="https://raw.githubusercontent.com/$GITHUB_USER/agent-second-brain/main/setup.sh"
+echo "Downloading setup script..."
-echo ""
-echo "Downloading setup script from:"
-echo " $SETUP_URL"
-echo ""
+# Create temp file
+TEMP_SCRIPT=$(mktemp /tmp/setup-XXXXXX.sh)
-# Check if curl or wget available
+# Download setup script
if command -v curl &> /dev/null; then
- SETUP_SCRIPT=$(curl -fsSL "$SETUP_URL")
+ curl -fsSL "$SETUP_URL" -o "$TEMP_SCRIPT"
elif command -v wget &> /dev/null; then
- SETUP_SCRIPT=$(wget -qO- "$SETUP_URL")
+ wget -q "$SETUP_URL" -O "$TEMP_SCRIPT"
else
- echo -e "${RED}[X] Neither curl nor wget found. Install one first:${NC}"
- echo " sudo apt install curl"
+ echo -e "${RED}[X] Neither curl nor wget found${NC}"
+ echo " Install: sudo apt install curl"
exit 1
fi
-if [ -z "$SETUP_SCRIPT" ]; then
+if [ ! -s "$TEMP_SCRIPT" ]; then
echo -e "${RED}[X] Failed to download setup script${NC}"
- echo " Make sure you've forked the repo and the username is correct"
+ rm -f "$TEMP_SCRIPT"
exit 1
fi
-echo -e "${GREEN}[OK] Setup script downloaded${NC}"
-echo ""
-
-# Run the setup script
-echo "Starting setup..."
+echo -e "${GREEN}[OK] Downloaded${NC}"
echo ""
-# Create temp file and run
-TEMP_SCRIPT=$(mktemp)
-echo "$SETUP_SCRIPT" > "$TEMP_SCRIPT"
+# Make executable and run PROPERLY (not via pipe!)
+# exec replaces current process, so stdin works normally
chmod +x "$TEMP_SCRIPT"
-bash "$TEMP_SCRIPT"
-rm -f "$TEMP_SCRIPT"
+exec bash "$TEMP_SCRIPT"
diff --git a/setup.sh b/setup.sh
index cd8c4fb..22a9c6e 100755
--- a/setup.sh
+++ b/setup.sh
@@ -129,7 +129,7 @@ check_os() {
. /etc/os-release
if [[ "$ID" != "ubuntu" && "$ID" != "debian" ]]; then
warn "This script is tested on Ubuntu/Debian. You're running: $ID"
- read -p "Continue anyway? (y/N): " -r REPLY < /dev/tty
+ read -p "Continue anyway? (y/N): " -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
@@ -245,7 +245,7 @@ clone_repository() {
if [ -d "$PROJECT_DIR" ]; then
warn "Project directory already exists: $PROJECT_DIR"
- read -p "Remove and re-clone? (y/N): " -r REPLY < /dev/tty
+ read -p "Remove and re-clone? (y/N): " -r REPLY
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf "$PROJECT_DIR"
else
@@ -256,7 +256,7 @@ clone_repository() {
fi
ask "Enter your GitHub username (the one where you forked the repo):"
- read -r GITHUB_USER < /dev/tty
+ read -r GITHUB_USER
if [ -z "$GITHUB_USER" ]; then
error "GitHub username cannot be empty"
@@ -293,7 +293,7 @@ collect_tokens() {
# Telegram Bot Token
while true; do
ask "Telegram Bot Token (from @BotFather):"
- read -r TELEGRAM_BOT_TOKEN < /dev/tty
+ read -r TELEGRAM_BOT_TOKEN
if validate_telegram_token "$TELEGRAM_BOT_TOKEN"; then
success "Token format valid"
break
@@ -305,7 +305,7 @@ collect_tokens() {
# Telegram User ID
while true; do
ask "Your Telegram User ID (from @userinfobot):"
- read -r TELEGRAM_USER_ID < /dev/tty
+ read -r TELEGRAM_USER_ID
if validate_telegram_id "$TELEGRAM_USER_ID"; then
success "User ID valid"
break
@@ -317,7 +317,7 @@ collect_tokens() {
# Deepgram API Key
while true; do
ask "Deepgram API Key (from console.deepgram.com):"
- read -r DEEPGRAM_API_KEY < /dev/tty
+ read -r DEEPGRAM_API_KEY
if validate_deepgram_key "$DEEPGRAM_API_KEY"; then
success "API Key format valid"
break
@@ -329,7 +329,7 @@ collect_tokens() {
# Todoist API Token
while true; do
ask "Todoist API Token (from Settings > Integrations > Developer):"
- read -r TODOIST_API_KEY < /dev/tty
+ read -r TODOIST_API_KEY
if validate_todoist_key "$TODOIST_API_KEY"; then
success "API Token format valid"
break
@@ -346,7 +346,7 @@ create_env_file() {
if [ -f "$ENV_FILE" ]; then
warn ".env file already exists"
- read -p "Overwrite? (y/N): " -r REPLY < /dev/tty
+ read -p "Overwrite? (y/N): " -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
success "Keeping existing .env"
return
@@ -436,7 +436,7 @@ configure_git_remote() {
git config user.email "bot@localhost"
ask "Do you want to configure GitHub push access? (for auto-sync)"
- read -p "(y/N): " -r REPLY < /dev/tty
+ read -p "(y/N): " -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
warn "Skipping GitHub push configuration"
@@ -451,7 +451,7 @@ configure_git_remote() {
echo ""
ask "Enter your GitHub Personal Access Token:"
- read -rs GITHUB_TOKEN < /dev/tty
+ read -rs GITHUB_TOKEN
echo ""
if [ -z "$GITHUB_TOKEN" ]; then
@@ -463,7 +463,7 @@ configure_git_remote() {
if [ -z "$GITHUB_USER" ]; then
ask "Enter your GitHub username:"
- read -r GITHUB_USER < /dev/tty
+ read -r GITHUB_USER
fi
git remote set-url origin "https://[email protected]/$GITHUB_USER/agent-second-brain.git"
@@ -609,7 +609,7 @@ main() {
echo " 5. Set up auto-start service"
echo ""
- read -p "Ready to start? (Y/n): " -r REPLY < /dev/tty
+ read -p "Ready to start? (Y/n): " -r REPLY
if [[ $REPLY =~ ^[Nn]$ ]]; then
echo "Setup cancelled."
exit 0