From 42c05f37e6f4d0810986184fd6e238deec38ea6f Mon Sep 17 00:00:00 2001 From: Cobra Date: Tue, 7 Apr 2026 15:22:16 -0400 Subject: [PATCH] Fix ANSI rendering and Infisical key storage in operator wizard echo calls in summary/final sections were missing -e flag so ANSI escape codes printed literally instead of rendering. Infisical SSH key storage was targeting a non-existent 'bigbrother' folder, silently failing to store the private key. Removed folder argument so keys store at root where creds CLI can retrieve them. --- operator_setup.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/operator_setup.sh b/operator_setup.sh index 83b2e07..8007626 100755 --- a/operator_setup.sh +++ b/operator_setup.sh @@ -409,25 +409,25 @@ fi # ══════════════════════════════════════════════════════════════════════════════ section "Configuration Summary" -echo "Device ID: ${BOLD}${DEVICE_ID}${NC}" -echo "Hostname: ${BOLD}${BB_HOSTNAME}${NC}" -echo "Target: ${BOLD}/dev/${DEVICE}${NC}" -echo "Image: ${BOLD}$(basename $IMAGE)${NC}" +echo -e "Device ID: ${BOLD}${DEVICE_ID}${NC}" +echo -e "Hostname: ${BOLD}${BB_HOSTNAME}${NC}" +echo -e "Target: ${BOLD}/dev/${DEVICE}${NC}" +echo -e "Image: ${BOLD}$(basename $IMAGE)${NC}" echo "" if [[ "$ROOT_PASS_IS_AUTO" == true ]]; then - echo "Root Pass: ${BOLD}${RED}AUTO-GENERATED — RECORD THIS: ${DEFAULT_ROOT_PASS}${NC}" + echo -e "Root Pass: ${BOLD}${RED}AUTO-GENERATED — RECORD THIS: ${DEFAULT_ROOT_PASS}${NC}" else - echo "Root Pass: ${BOLD}[custom]${NC}" + echo -e "Root Pass: ${BOLD}[custom]${NC}" fi -echo "WiFi: ${BOLD}$([ -n "$WIFI_SSID" ] && echo "$WIFI_SSID" || echo "disabled")${NC}" -echo "SSH Mode: ${BOLD}${SSH_MODE}${NC}" -echo "Auto-start: ${BOLD}${BB_MODE}${NC}" +echo -e "WiFi: ${BOLD}$([ -n "$WIFI_SSID" ] && echo "$WIFI_SSID" || echo "disabled")${NC}" +echo -e "SSH Mode: ${BOLD}${SSH_MODE}${NC}" +echo -e "Auto-start: ${BOLD}${BB_MODE}${NC}" if [[ "$BB_VPN" == "autossh" ]]; then - echo "VPN: ${BOLD}autossh → ${AUTOSSH_USER}@${AUTOSSH_SERVER}:${AUTOSSH_PORT} (remote port ${AUTOSSH_REMOTE_PORT})${NC}" + echo -e "VPN: ${BOLD}autossh → ${AUTOSSH_USER}@${AUTOSSH_SERVER}:${AUTOSSH_PORT} (remote port ${AUTOSSH_REMOTE_PORT})${NC}" else - echo "VPN: ${BOLD}${BB_VPN}${NC}" + echo -e "VPN: ${BOLD}${BB_VPN}${NC}" fi -echo "Alerter: ${BOLD}$([ -n "$BB_ALERTER_TYPE" ] && echo "$BB_ALERTER_TYPE" || echo "disabled")${NC}" +echo -e "Alerter: ${BOLD}$([ -n "$BB_ALERTER_TYPE" ] && echo "$BB_ALERTER_TYPE" || echo "disabled")${NC}" echo "" echo -n -e "${CYAN}Proceed with flashing and configuration? (y/n):${NC} " @@ -524,8 +524,8 @@ if [[ "$SSH_MODE" == "generate" ]]; then echo "$PUBKEY" > "${SSH_DIR}/authorized_keys" INFISICAL_KEY="SSH_PRIVKEY_$(echo "$DEVICE_ID" | tr '[:lower:]-' '[:upper:]_')" - if [[ -x "$CREDS" ]] && "$CREDS" set "$INFISICAL_KEY" "$PRIVKEY" bigbrother 2>/dev/null; then - info "Private key stored in Infisical: bigbrother/${INFISICAL_KEY}" + if [[ -x "$CREDS" ]] && "$CREDS" set "$INFISICAL_KEY" "$PRIVKEY" 2>/dev/null; then + info "Private key stored in Infisical: ${INFISICAL_KEY}" else warn "Could not store in Infisical. SAVE THIS PRIVATE KEY:" echo "---" @@ -770,7 +770,7 @@ info "SD card ready to remove" # ══════════════════════════════════════════════════════════════════════════════ section "Setup Complete" -echo "${GREEN}Insert SD card into device and power on.${NC}" +echo -e "${GREEN}Insert SD card into device and power on.${NC}" echo "" echo "The device will:" echo " 1. Boot and connect to WiFi (if configured)" @@ -782,12 +782,12 @@ echo " 6. Send alerter webhook (if configured)" echo "" echo "No further operator interaction required. Device walks away autonomously." echo "" -echo "${CYAN}To SSH after first-boot:${NC}" +echo -e "${CYAN}To SSH after first-boot:${NC}" if [[ "$SSH_MODE" == "generate" ]]; then INFISICAL_KEY="SSH_PRIVKEY_$(echo "$DEVICE_ID" | tr '[:lower:]-' '[:upper:]_')" if [[ -x "$CREDS" ]]; then - echo " ${CREDS} get ${INFISICAL_KEY} bigbrother > /tmp/${DEVICE_ID}.key" + echo " ${CREDS} get ${INFISICAL_KEY} > /tmp/${DEVICE_ID}.key" echo " chmod 600 /tmp/${DEVICE_ID}.key" echo " ssh -i /tmp/${DEVICE_ID}.key root@" fi @@ -798,13 +798,13 @@ fi echo "" if [[ "$BB_VPN" == "autossh" ]]; then echo "" - echo "${CYAN}Tunnel connection (after first boot):${NC}" + echo -e "${CYAN}Tunnel connection (after first boot):${NC}" echo " From operator server: ssh -p ${AUTOSSH_REMOTE_PORT} root@127.0.0.1" echo " One-liner from anywhere (requires GatewayPorts yes on server):" echo " ssh -p ${AUTOSSH_REMOTE_PORT} root@${AUTOSSH_SERVER}" fi echo "" -echo "${CYAN}Monitor first-boot:${NC}" +echo -e "${CYAN}Monitor first-boot:${NC}" echo " ssh root@ 'tail -f /root/bb-firstboot.log'" echo ""