Skip to content

Commit

Permalink
[tui/common] Implement #24
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit committed Nov 25, 2023
1 parent b7c8f4d commit 4791b53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tui/methods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
# shellcheck source=locales/en-us/methods.sh
source "tui/locales/$LOCALE/methods.sh"

declare -a available_methods
active_method="containers"
available_methods=(containers virtualenv)

# Limit available method to match the existing instance
# If containers instance has been deployed then only containers
# method will be available.
if [ "$EXISTING_INSTANCE" == "true" ]; then
active_method="$INSTANCE_TYPE"
available_methods=("$INSTANCE_TYPE")
fi

whiptail_args=(
--title "$TITLE"
--radiolist "$CONTENT"
Expand Down
3 changes: 3 additions & 0 deletions utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ function detect_existing_instance() {
echo -ne "➤ Checking for existing instance... "
if [ -n "$(docker ps -a --filter="name=ovos*|hivemind*" -q 2>>"$LOG_FILE")" ]; then
export EXISTING_INSTANCE="true"
export INSTANCE_TYPE="containers"
elif [ -n "$(podman ps -a --filter="name=ovos*|hivemind*" -q 2>>"$LOG_FILE")" ]; then
export EXISTING_INSTANCE="true"
export INSTANCE_TYPE="containers"
elif [ -d "${RUN_AS_HOME}/.venvs/ovos" ]; then
export EXISTING_INSTANCE="true"
export INSTANCE_TYPE="virtualenv"
else
export EXISTING_INSTANCE="false"
fi
Expand Down

0 comments on commit 4791b53

Please sign in to comment.