Replace heredoc boot scripts with printf one-liners for mobile copy-paste reliability

Heredocs fail silently on Android Termux when copy-pasting from the admin GUI
(trailing whitespace from clipboard prevents EOF recognition). Switched to
printf commands in both the setup wizard and MkDocs docs. Also added
source ~/.bashrc and boot script steps directly in the wizard Step 4.

Bunker Admin
This commit is contained in:
2026-02-27 08:48:42 -07:00
parent 6b47f67d8a
commit a8de30cf8e
2 changed files with 16 additions and 19 deletions

View File

@@ -166,20 +166,12 @@ Install [Termux:Boot](https://f-droid.org/packages/com.termux.boot/) from F-Droi
# Create the boot scripts directory
mkdir -p ~/.termux/boot
# Create the auto-start script
cat > ~/.termux/boot/start-sms-server << 'EOF'
#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
export SMS_API_SECRET="YOUR_KEY_HERE"
mkdir -p ~/logs
nohup python ~/sms-server/android/termux-sms-api-server.py >> ~/logs/sms-api.log 2>&1 &
EOF
chmod +x ~/.termux/boot/start-sms-server
# Create the auto-start script (single command, no heredoc)
printf '#!/data/data/com.termux/files/usr/bin/bash\nsource ~/.bashrc\ntermux-wake-lock\nmkdir -p ~/logs\nnohup python ~/sms-server/android/termux-sms-api-server.py >> ~/logs/sms-api.log 2>&1 &\n' > ~/.termux/boot/start-sms-server && chmod +x ~/.termux/boot/start-sms-server
```
!!! warning "Replace YOUR_KEY_HERE"
Edit the script and replace `YOUR_KEY_HERE` with your actual API key. Or if you've already saved it in `~/.bashrc`, replace the export line with `source ~/.bashrc`.
!!! tip "Why printf instead of heredoc?"
Heredoc (`<< 'EOF'`) blocks are unreliable when copy-pasting on mobile devices — trailing whitespace or clipboard quirks prevent the `EOF` from being recognized. The `printf` one-liner is more reliable for mobile copy-paste.
#### C. Watchdog (auto-restart on crash)
@@ -201,13 +193,9 @@ The watchdog:
For maximum reliability, use the watchdog as your boot script:
```bash
cat > ~/.termux/boot/start-sms-server << 'EOF'
#!/data/data/com.termux/files/usr/bin/sh
source ~/.bashrc
nohup bash ~/sms-server/android/sms-watchdog.sh >> ~/logs/sms-watchdog.log 2>&1 &
EOF
mkdir -p ~/.termux/boot
chmod +x ~/.termux/boot/start-sms-server
printf '#!/data/data/com.termux/files/usr/bin/bash\ntermux-wake-lock\ncd ~/sms-server/android\nnohup bash sms-watchdog.sh >> ~/logs/watchdog.log 2>&1 &\n' > ~/.termux/boot/start-sms-server && chmod +x ~/.termux/boot/start-sms-server
```
#### D. Quick Background (simplest)