From 0456e52e217b2c0f5e57d0598fc712116431dcde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 15 Mar 2024 14:34:01 +0100 Subject: [PATCH] Fix upgrade from old version --- scripts/upgrade | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index eef0851..d4c8305 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -44,6 +44,24 @@ if yunohost firewall list | grep -q "\- $port$"; then ynh_exec_warn_less yunohost firewall disallow TCP "$port" fi +if [[ -z "$context" ]]; then + if grep -q "CI_APP" /etc/hosts; then + context=official_infra + else + context=personal_ci + fi + ynh_app_setting_set --app="$app" --key="context" --value="$context" +fi + +if [[ -z "$cluster" ]]; then + if incus cluster list >/dev/null 2>&1; then + cluster=1 + else + cluster=0 + fi + ynh_app_setting_set --app="$app" --key="cluster" --value="$cluster" +fi + # Values now use underscore if echo "$context" | grep -- -; then context=$(echo "$context" | tr - _)