Compare commits

..

1 Commits

Author SHA1 Message Date
Jürgen Weigert
23c958e53d install.sh: support for inplace upgrade
and also support version tags without leading v.
2026-02-05 16:15:46 +01:00
5 changed files with 26 additions and 7 deletions

View File

@@ -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! ***"

2
go.mod
View File

@@ -20,7 +20,7 @@ require (
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/gabriel-vasile/mimetype v1.4.12
github.com/ggwhite/go-masker v1.1.0
github.com/go-chi/chi/v5 v5.2.5
github.com/go-chi/chi/v5 v5.2.4
github.com/go-chi/render v1.0.3
github.com/go-jose/go-jose/v3 v3.0.4
github.com/go-ldap/ldap/v3 v3.4.12

4
go.sum
View File

@@ -381,8 +381,8 @@ github.com/go-asn1-ber/asn1-ber v1.4.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 h1:BP4M0CvQ4S3TGls2FvczZtj5Re/2ZzkV9VwqPHH/3Bo=
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi/v5 v5.2.5 h1:Eg4myHZBjyvJmAFjFvWgrqDTXFyOzjj7YIm3L3mu6Ug=
github.com/go-chi/chi/v5 v5.2.5/go.mod h1:X7Gx4mteadT3eDOMTsXzmI4/rwUpOwBHLpAfupzFJP0=
github.com/go-chi/chi/v5 v5.2.4 h1:WtFKPHwlywe8Srng8j2BhOD9312j9cGUxG1SP4V2cR4=
github.com/go-chi/chi/v5 v5.2.4/go.mod h1:X7Gx4mteadT3eDOMTsXzmI4/rwUpOwBHLpAfupzFJP0=
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0=
github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s=

View File

@@ -79,7 +79,6 @@ func (hr HeaderRouter) Handler(next http.Handler) http.Handler {
if len(hr) == 0 {
// skip if no routes set
next.ServeHTTP(w, r)
return
}
// find first matching header route, and continue

2
vendor/modules.txt vendored
View File

@@ -475,7 +475,7 @@ github.com/go-acme/lego/v4/challenge
# github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667
## explicit; go 1.13
github.com/go-asn1-ber/asn1-ber
# github.com/go-chi/chi/v5 v5.2.5
# github.com/go-chi/chi/v5 v5.2.4
## explicit; go 1.22
github.com/go-chi/chi/v5
github.com/go-chi/chi/v5/middleware