From 23c958e53d0bbc1b43a932d18e4547c7e4322d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Weigert?= Date: Thu, 5 Feb 2026 16:15:46 +0100 Subject: [PATCH] install.sh: support for inplace upgrade and also support version tags without leading v. --- .../examples/bare-metal-simple/install.sh | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/deployments/examples/bare-metal-simple/install.sh b/deployments/examples/bare-metal-simple/install.sh index 874cb409d4..be999f1153 100755 --- a/deployments/examples/bare-metal-simple/install.sh +++ b/deployments/examples/bare-metal-simple/install.sh @@ -48,6 +48,7 @@ get_latest_version dlversion="${OC_VERSION:-$latest_version}" dlurl="https://github.com/opencloud-eu/opencloud/releases/download/v${dlversion}/" +dlurl2="https://github.com/opencloud-eu/opencloud/releases/download/${dlversion}/" sandbox="opencloud-sandbox-${dlversion}" @@ -74,6 +75,17 @@ fi dlfile="opencloud-${dlversion}-${os}-${dlarch}" # download +status=$(curl -I -L -o /dev/null -s -w "%{http_code}\n" "$dlurl/$dlfile") +if [ "$status" -ne 200 ]; then + echo "HTTP code: $status ($dlurl/$dlfile)" + dlurl=$dlurl2 + status=$(curl -I -L -o /dev/null -s -w "%{http_code}\n" "$dlurl2/$dlfile") + if [ "$status" -ne 200 ]; then + echo "HTTP code: $status ($dlurl/$dlfile)" + # exit -1 # or try nevertheless? + fi +fi + echo "Downloading ${dlurl}/${dlfile}" curl -L -o "${dlfile}" --progress-bar "${dlurl}/${dlfile}" @@ -84,12 +96,12 @@ export OC_CONFIG_DIR="$basedir/config" export OC_BASE_DATA_PATH="$basedir/data" mkdir -p "$OC_CONFIG_DIR" "$OC_BASE_DATA_PATH" +maincfg="$OC_CONFIG_DIR/opencloud.yaml" + # It is bound to localhost for now to deal with non existing routes # to certain host names for example in WSL host="${OC_HOST:-localhost}" -./${dlfile} init --insecure yes --ap admin - echo '#!/bin/bash SCRIPT_DIR="$(dirname "$(readlink -f "${0}")")" cd "${SCRIPT_DIR}"' > runopencloud.sh @@ -108,6 +120,14 @@ export OC_LOG_LEVEL=warning chmod 755 runopencloud.sh +if [ -f "$maincfg" ]; then + echo "Main config file $maincfg exists." + echo "Skipping initialization. This might be an update from a previous version." + echo "To restart the server, refer to the script in $basedir or $basedir/$sandbox" + exit 0 +fi +./${dlfile} init --insecure yes --ap admin + echo "Connect to OpenCloud via https://${host}:9200" echo "" echo "*** This is a fragile test setup, not suitable for production! ***"