diff --git a/config/setup.conf b/config/setup.conf index 9bef057..69725cc 100644 --- a/config/setup.conf +++ b/config/setup.conf @@ -24,6 +24,8 @@ GRUB_TIMEOUT_STYLE="menu" DEFAULT_SHELL="zsh" # Ollama AI Configuration +# Suggested custom models path, pre-filled only if the user declines +# Ollama's own default storage location (/usr/share/ollama/.ollama/models). OLLAMA_MODELS_DEFAULT="/mnt/Data/Software/ollama/models" OLLAMA_FLASH_ATTENTION="1" OLLAMA_KV_CACHE_TYPE="q8_0" diff --git a/lib/utils.sh b/lib/utils.sh index 805c313..c78032f 100755 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -255,7 +255,12 @@ prompt_ollama_models_path() { return 0 fi - local default_path="${OLLAMA_MODELS_DEFAULT:-/mnt/Data/Software/ollama/models}" + # Ollama's own default storage location (used by the official install + # script / systemd service, which runs as the "ollama" user). + local ollama_default_path="/usr/share/ollama/.ollama/models" + # Suggested custom path, only ever pre-filled once the user has + # explicitly declined the Ollama default above. + local custom_path_suggestion="${OLLAMA_MODELS_DEFAULT:-/mnt/Data/Software/ollama/models}" local chosen="" local is_interactive=0 if { [[ -t 0 ]] || has_tty; } && [[ "${DEBIAN_FRONTEND:-}" != "noninteractive" && "${CI:-}" != "1" && "${AUTO_CONFIRM:-}" != "1" ]]; then @@ -271,20 +276,20 @@ prompt_ollama_models_path() { fi # If whiptail is available and running on an active terminal, first ask - # whether the configured default path should be used, and only show - # the free-text path dialog (pre-filled with that default) if not. + # whether Ollama's own default path should be used, and only show the + # free-text path dialog (pre-filled with the custom suggestion) if not. if command_exists whiptail && has_tty; then local yesno_status=0 run_whiptail --title "Ollama KI-Modelle Speicherort" \ --yes-button "Standard verwenden" --no-button "Eigenen Pfad angeben" \ - --yesno "Standard-Speicherort für Ollama-Modelle:\n\n$default_path\n\nMöchtest du diesen Speicherort verwenden?" \ + --yesno "Standard-Speicherort für Ollama-Modelle:\n\n$ollama_default_path\n\nMöchtest du diesen Speicherort verwenden?" \ 12 70 || yesno_status=$? if [[ "$yesno_status" -eq 0 || "$yesno_status" -eq 255 ]]; then - # Yes, or ESC/Cancel (255) - use the configured default, + # Yes, or ESC/Cancel (255) - use the Ollama default, # consistent with the inputbox fallback below where an - # empty or cancelled dialog also keeps the default instead - # of asking again. - chosen="$default_path" + # empty or cancelled dialog also keeps its own default + # instead of asking again. + chosen="$ollama_default_path" fi if [[ -z "$chosen" ]]; then @@ -292,34 +297,34 @@ prompt_ollama_models_path() { tui_tmp="$(mktemp)" if run_whiptail --output-fd 3 --title "Ollama KI-Modelle Speicherort" \ --inputbox "Bitte gib den Speicherort für die Ollama KI-Modelle an:" \ - 10 70 "$default_path" \ + 10 70 "$custom_path_suggestion" \ 3> "$tui_tmp"; then chosen="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$tui_tmp")" fi rm -f "$tui_tmp" - [[ -z "$chosen" ]] && chosen="$default_path" + [[ -z "$chosen" ]] && chosen="$custom_path_suggestion" fi fi # CLI fallback if whiptail was not used or failed if [[ -z "$chosen" ]]; then printf "\n%bOllama KI-Modelle Speicherort:%b\n" "${CLR_CYAN}" "${CLR_RESET}" > "$tty_out" - printf "Standard-Pfad: %b%s%b\n" "${CLR_BOLD}" "$default_path" "${CLR_RESET}" > "$tty_out" + printf "Standard-Pfad: %b%s%b\n" "${CLR_BOLD}" "$ollama_default_path" "${CLR_RESET}" > "$tty_out" if confirm_yes_no "Standard-Speicherort verwenden? [J/n]: " "j" "$tty_in" "$tty_out"; then - chosen="$default_path" + chosen="$ollama_default_path" else local input_path="" - read -r -p "Speicherort für Ollama-Modelle eingeben [$default_path]: " input_path < "$tty_in" > "$tty_out" 2>&1 || true + read -r -p "Speicherort für Ollama-Modelle eingeben [$custom_path_suggestion]: " input_path < "$tty_in" > "$tty_out" 2>&1 || true input_path="$(echo "$input_path" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" if [[ -n "$input_path" ]]; then chosen="$input_path" else - chosen="$default_path" + chosen="$custom_path_suggestion" fi fi fi else - chosen="$default_path" + chosen="$ollama_default_path" fi export OLLAMA_MODELS="$chosen"