Skip to content

Commit

Permalink
Merge pull request #77 from suvanbanerjee/main
Browse files Browse the repository at this point in the history
[FIX] Installer allowing invalid config.yaml files
  • Loading branch information
goldyfruit authored Apr 26, 2024
2 parents 12aa29e + d2a74d8 commit c711226
Showing 1 changed file with 68 additions and 15 deletions.
83 changes: 68 additions & 15 deletions utils/scenario.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,83 @@ if [ -f "$SCENARIO_PATH" ]; then
if in_array SCENARIO_ALLOWED_OPTIONS "$option"; then
case "$option" in
uninstall)
[ "${options[$option]}" == "true" ] && CONFIRM_UNINSTALL="true" || CONFIRM_UNINSTALL="false"
export CONFIRM_UNINSTALL
if [[ "${options[$option]}" == "true" ]]; then
UNINSTALL="true"
elif [[ "${options[$option]}" == "false" ]]; then
UNINSTALL="false"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
method)
[ "${options[$option]}" == "containers" ] && METHOD="containers" || METHOD="virtualenv"
export METHOD
if [[ "${options[$option]}" == "containers" ]]; then
METHOD="containers"
elif [[ "${options[$option]}" == "virtualenv" ]]; then
METHOD="virtualenv"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
channel)
[ "${options[$option]}" == "development" ] && CHANNEL="development" || CHANNEL="stable"
export CHANNEL
if [[ "${options[$option]}" == "development" ]]; then
CHANNEL="development"
elif [[ "${options[$option]}" == "stable" ]]; then
CHANNEL="stable"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
profile)
[ -n "${options[$option]}" ] && export PROFILE="${options[$option]}"
if [[ "${options[$option]}" == "ovos" ]]; then
PROFILE="ovos"
elif [[ "${options[$option]}" == "satellite" ]]; then
PROFILE="satellite"
elif [[ "${options[$option]}" == "listener" ]]; then
PROFILE="listener"
elif [[ "${options[$option]}" == "server" ]]; then
PROFILE="server"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
rapsberry_pi_tuning)
[ "${options[$option]}" == "true" ] && TUNING="yes" || TUNING="no"
export TUNING
if [[ "${options[$option]}" == "true" ]]; then
TUNING="yes"
elif [[ "${options[$option]}" == "false" ]]; then
TUNING="no"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
features)
for feature in "${!features[@]}"; do
# Ensure the feature is supported by the installer
if in_array SCENARIO_ALLOWED_FEATURES "$feature"; then
case "$feature" in
skills)
[ "${features[$feature]}" == "true" ] && FEATURE_SKILLS="true" || FEATURE_SKILLS="false"
export FEATURE_SKILLS
if [[ "${features[$feature]}" == "true" ]]; then
FEATURE_SKILLS="true"
elif [[ "${features[$feature]}" == "false" ]]; then
FEATURE_SKILLS="false"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
gui)
[ "${features[$feature]}" == "true" ] && FEATURE_GUI="true" || FEATURE_GUI="false"
export FEATURE_GUI
if [[ "${features[$feature]}" == "true" ]]; then
FEATURE_GUI="true"
elif [[ "${features[$feature]}" == "false" ]]; then
FEATURE_GUI="false"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
*)
export SCENARIO_NOT_SUPPORTED="true"
Expand Down Expand Up @@ -103,8 +150,14 @@ if [ -f "$SCENARIO_PATH" ]; then
done
;;
share_telemetry)
[ "${options[$option]}" == "true" ] && SHARE_TELEMETRY="true" || SHARE_TELEMETRY="false"
export SHARE_TELEMETRY
if [[ "${options[$option]}" == "true" ]]; then
SHARE_TELEMETRY="true"
elif [[ "${options[$option]}" == "false" ]]; then
SHARE_TELEMETRY="false"
else
export SCENARIO_NOT_SUPPORTED="true"
break
fi
;;
*)
export SCENARIO_NOT_SUPPORTED="true"
Expand Down

0 comments on commit c711226

Please sign in to comment.