fix: update cmd check logic

Signed-off-by: reidliu <reid201711@gmail.com>
This commit is contained in:
reidliu 2025-03-02 09:39:22 +08:00
parent 46b0a404e8
commit b4717561ba

View file

@ -100,12 +100,6 @@ esac
set -x set -x
# Check if container command is available
if ! is_command_available $CONTAINER_BINARY; then
printf "${RED}Error: ${CONTAINER_BINARY} command not found. Is ${CONTAINER_BINARY} installed and in your PATH?${NC}" >&2
exit 1
fi
if [[ "$env_type" == "venv" || "$env_type" == "conda" ]]; then if [[ "$env_type" == "venv" || "$env_type" == "conda" ]]; then
$PYTHON_BINARY -m llama_stack.distribution.server.server \ $PYTHON_BINARY -m llama_stack.distribution.server.server \
--yaml-config "$yaml_config" \ --yaml-config "$yaml_config" \
@ -113,6 +107,12 @@ if [[ "$env_type" == "venv" || "$env_type" == "conda" ]]; then
$env_vars \ $env_vars \
$other_args $other_args
elif [[ "$env_type" == "container" ]]; then elif [[ "$env_type" == "container" ]]; then
# Check if container command is available
if ! is_command_available $CONTAINER_BINARY; then
printf "${RED}Error: ${CONTAINER_BINARY} command not found. Is ${CONTAINER_BINARY} installed and in your PATH?${NC}" >&2
exit 1
fi
if is_command_available selinuxenabled &> /dev/null && selinuxenabled; then if is_command_available selinuxenabled &> /dev/null && selinuxenabled; then
# Disable SELinux labels # Disable SELinux labels
CONTAINER_OPTS="$CONTAINER_OPTS --security-opt label=disable" CONTAINER_OPTS="$CONTAINER_OPTS --security-opt label=disable"