Revert "Replace whiptail menus with numbered text toggle selection"
This reverts commit c83439f576.
This commit is contained in:
+86
-47
@@ -94,24 +94,38 @@ POSTINSTALL_SCRIPT="$SCRIPT_DIR/ubuntu-post-install.sh"
|
||||
HAS_POSTINSTALL=false
|
||||
[[ -f "$POSTINSTALL_SCRIPT" ]] && HAS_POSTINSTALL=true
|
||||
|
||||
echo ""
|
||||
echo -e " ${BOLD}[1] Select what to run${NC}"
|
||||
echo " (Type a number to toggle, Enter to confirm)"
|
||||
SEL_POST=false; SEL_AI=true
|
||||
while true; do
|
||||
if command -v whiptail &>/dev/null; then
|
||||
WHIP_ARGS=()
|
||||
$HAS_POSTINSTALL && WHIP_ARGS+=(
|
||||
"postinstall" "Full system setup — Ubuntu apps, security, backups" OFF
|
||||
)
|
||||
WHIP_ARGS+=( "aistack" "AI stack — select services on next screen" ON )
|
||||
SELECTED=$(whiptail --title "Local AI Setup" \
|
||||
--checklist "SPACE = toggle TAB = move ENTER = confirm" \
|
||||
12 68 "${#WHIP_ARGS[@]}" "${WHIP_ARGS[@]}" 3>&1 1>&2 2>&3) || die "Cancelled."
|
||||
INSTALL_AI=false
|
||||
[[ "$SELECTED" == *"postinstall"* ]] && INSTALL_POSTINSTALL=true
|
||||
[[ "$SELECTED" == *"aistack"* ]] && INSTALL_AI=true
|
||||
else
|
||||
echo ""
|
||||
$HAS_POSTINSTALL && printf " [%s] 1. Full system setup — Ubuntu apps, security, backups\n" "$($SEL_POST && echo '*' || echo ' ')"
|
||||
printf " [%s] 2. AI stack — select services on next screen\n" "$($SEL_AI && echo '*' || echo ' ')"
|
||||
echo ""
|
||||
read -rp " Toggle [number] or Enter to confirm: " T
|
||||
case "$T" in
|
||||
1) $HAS_POSTINSTALL && { $SEL_POST && SEL_POST=false || SEL_POST=true; } ;;
|
||||
2) $SEL_AI && SEL_AI=false || SEL_AI=true ;;
|
||||
"") break ;;
|
||||
esac
|
||||
done
|
||||
INSTALL_POSTINSTALL=$SEL_POST
|
||||
INSTALL_AI=$SEL_AI
|
||||
echo -e " ${BOLD}[1] Select what to run${NC}"
|
||||
echo " (Type a number to toggle, Enter to confirm)"
|
||||
SEL_POST=false; SEL_AI=true
|
||||
while true; do
|
||||
echo ""
|
||||
$HAS_POSTINSTALL && printf " [%s] 1. Full system setup — Ubuntu apps, security, backups\n" "$($SEL_POST && echo '*' || echo ' ')"
|
||||
printf " [%s] 2. AI stack — select services on next screen\n" "$($SEL_AI && echo '*' || echo ' ')"
|
||||
echo ""
|
||||
read -rp " Toggle [number] or Enter to confirm: " T
|
||||
case "$T" in
|
||||
1) $HAS_POSTINSTALL && { $SEL_POST && SEL_POST=false || SEL_POST=true; } ;;
|
||||
2) $SEL_AI && SEL_AI=false || SEL_AI=true ;;
|
||||
"") break ;;
|
||||
esac
|
||||
done
|
||||
INSTALL_POSTINSTALL=$SEL_POST
|
||||
INSTALL_AI=$SEL_AI
|
||||
fi
|
||||
|
||||
$INSTALL_AI || $INSTALL_POSTINSTALL \
|
||||
|| die "Nothing selected — run again and select at least one option."
|
||||
@@ -123,37 +137,62 @@ if $INSTALL_AI; then
|
||||
docker ps -a --format '{{.Names}}' 2>/dev/null | grep -q "^$1$" && echo ON || echo OFF
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo -e " ${BOLD}[1a] AI Stack — select services to install${NC}"
|
||||
echo " Ollama always included (required core). Type number to toggle, Enter to confirm."
|
||||
_W=$SVC_WEBUI; _R=$SVC_RAG; _M=$SVC_MCP; _S=$SVC_SEARXNG
|
||||
_G=$SVC_GITEA; _I=$SVC_INVOKEAI; _P=$SVC_PORTAINER; _K=$SVC_KIWIX
|
||||
while true; do
|
||||
if command -v whiptail &>/dev/null; then
|
||||
SELECTED_SVCS=$(whiptail --title "AI Stack — Select Services" \
|
||||
--checklist "Ollama always installed (core). SPACE = toggle ENTER = confirm" \
|
||||
20 72 9 \
|
||||
"open-webui" "Open WebUI — Chat interface (like ChatGPT, uses Ollama)" "$(existing_svc open-webui)" \
|
||||
"rag" "RAG + ChromaDB— Code & document search (needed by MCP)" "$(existing_svc rag-server)" \
|
||||
"mcp" "MCP Server — Claude Code tools (bash, files, git, search)" "$(existing_svc mcp-server)" \
|
||||
"searxng" "SearXNG — Private local web search engine" "$(existing_svc searxng)" \
|
||||
"gitea" "Gitea — Self-hosted Git server" "$(existing_svc gitea)" \
|
||||
"invokeai" "InvokeAI — Image generation (Stable Diffusion)" "$(existing_svc invokeai)" \
|
||||
"portainer" "Portainer — Docker management web UI" "$(existing_svc portainer)" \
|
||||
"kiwix" "Kiwix — Offline Wikipedia, Stack Overflow, Arch Wiki" "$(existing_svc kiwix)" \
|
||||
3>&1 1>&2 2>&3) || die "Cancelled."
|
||||
|
||||
SVC_WEBUI=false; [[ "$SELECTED_SVCS" == *'"open-webui"'* ]] && SVC_WEBUI=true
|
||||
SVC_RAG=false; [[ "$SELECTED_SVCS" == *'"rag"'* ]] && SVC_RAG=true
|
||||
SVC_MCP=false; [[ "$SELECTED_SVCS" == *'"mcp"'* ]] && SVC_MCP=true
|
||||
SVC_SEARXNG=false; [[ "$SELECTED_SVCS" == *'"searxng"'* ]] && SVC_SEARXNG=true
|
||||
SVC_GITEA=false; [[ "$SELECTED_SVCS" == *'"gitea"'* ]] && SVC_GITEA=true
|
||||
SVC_INVOKEAI=false; [[ "$SELECTED_SVCS" == *'"invokeai"'* ]] && SVC_INVOKEAI=true
|
||||
SVC_PORTAINER=false;[[ "$SELECTED_SVCS" == *'"portainer"'* ]] && SVC_PORTAINER=true
|
||||
SVC_KIWIX=false; [[ "$SELECTED_SVCS" == *'"kiwix"'* ]] && SVC_KIWIX=true
|
||||
else
|
||||
# Text toggle fallback
|
||||
echo ""
|
||||
printf " [%s] 1. Open WebUI — Chat interface\n" "$($_W && echo '*' || echo ' ')"
|
||||
printf " [%s] 2. RAG+ChromaDB — Code & document search\n" "$($_R && echo '*' || echo ' ')"
|
||||
printf " [%s] 3. MCP Server — Claude Code tools (needs RAG)\n" "$($_M && echo '*' || echo ' ')"
|
||||
printf " [%s] 4. SearXNG — Private web search\n" "$($_S && echo '*' || echo ' ')"
|
||||
printf " [%s] 5. Gitea — Self-hosted Git\n" "$($_G && echo '*' || echo ' ')"
|
||||
printf " [%s] 6. InvokeAI — Image generation\n" "$($_I && echo '*' || echo ' ')"
|
||||
printf " [%s] 7. Portainer — Docker management UI\n" "$($_P && echo '*' || echo ' ')"
|
||||
printf " [%s] 8. Kiwix — Offline Wikipedia, Stack Overflow\n" "$($_K && echo '*' || echo ' ')"
|
||||
echo ""
|
||||
read -rp " Toggle [number] or Enter to confirm: " T
|
||||
case "$T" in
|
||||
1) $_W && _W=false || _W=true ;;
|
||||
2) $_R && _R=false || _R=true ;;
|
||||
3) $_M && _M=false || _M=true ;;
|
||||
4) $_S && _S=false || _S=true ;;
|
||||
5) $_G && _G=false || _G=true ;;
|
||||
6) $_I && _I=false || _I=true ;;
|
||||
7) $_P && _P=false || _P=true ;;
|
||||
8) $_K && _K=false || _K=true ;;
|
||||
"") break ;;
|
||||
esac
|
||||
done
|
||||
SVC_WEBUI=$_W; SVC_RAG=$_R; SVC_MCP=$_M; SVC_SEARXNG=$_S
|
||||
SVC_GITEA=$_G; SVC_INVOKEAI=$_I; SVC_PORTAINER=$_P; SVC_KIWIX=$_K
|
||||
echo -e " ${BOLD}[1a] AI Stack — select services to install${NC}"
|
||||
echo " Ollama always included (required core). Type number to toggle, Enter to confirm."
|
||||
_W=$SVC_WEBUI; _R=$SVC_RAG; _M=$SVC_MCP; _S=$SVC_SEARXNG
|
||||
_G=$SVC_GITEA; _I=$SVC_INVOKEAI; _P=$SVC_PORTAINER; _K=$SVC_KIWIX
|
||||
while true; do
|
||||
echo ""
|
||||
printf " [%s] 1. Open WebUI — Chat interface\n" "$($_W && echo '*' || echo ' ')"
|
||||
printf " [%s] 2. RAG+ChromaDB — Code & document search\n" "$($_R && echo '*' || echo ' ')"
|
||||
printf " [%s] 3. MCP Server — Claude Code tools (needs RAG)\n" "$($_M && echo '*' || echo ' ')"
|
||||
printf " [%s] 4. SearXNG — Private web search\n" "$($_S && echo '*' || echo ' ')"
|
||||
printf " [%s] 5. Gitea — Self-hosted Git\n" "$($_G && echo '*' || echo ' ')"
|
||||
printf " [%s] 6. InvokeAI — Image generation\n" "$($_I && echo '*' || echo ' ')"
|
||||
printf " [%s] 7. Portainer — Docker management UI\n" "$($_P && echo '*' || echo ' ')"
|
||||
printf " [%s] 8. Kiwix — Offline Wikipedia, Stack Overflow\n" "$($_K && echo '*' || echo ' ')"
|
||||
echo ""
|
||||
read -rp " Toggle [number] or Enter to confirm: " T
|
||||
case "$T" in
|
||||
1) $_W && _W=false || _W=true ;;
|
||||
2) $_R && _R=false || _R=true ;;
|
||||
3) $_M && _M=false || _M=true ;;
|
||||
4) $_S && _S=false || _S=true ;;
|
||||
5) $_G && _G=false || _G=true ;;
|
||||
6) $_I && _I=false || _I=true ;;
|
||||
7) $_P && _P=false || _P=true ;;
|
||||
8) $_K && _K=false || _K=true ;;
|
||||
"") break ;;
|
||||
esac
|
||||
done
|
||||
SVC_WEBUI=$_W; SVC_RAG=$_R; SVC_MCP=$_M; SVC_SEARXNG=$_S
|
||||
SVC_GITEA=$_G; SVC_INVOKEAI=$_I; SVC_PORTAINER=$_P; SVC_KIWIX=$_K
|
||||
fi
|
||||
|
||||
# Enforce dependencies: MCP needs RAG
|
||||
$SVC_MCP && ! $SVC_RAG && { warn "MCP Server requires RAG — enabling RAG+ChromaDB"; SVC_RAG=true; }
|
||||
|
||||
Reference in New Issue
Block a user