OpenCloud: bump to v9.0.0, configure the service account through env (#18586)

* OpenCloud: bump to v9.0.0, configure the service account through env

- Pin v9.0.0 in the update and install scripts.
- Copy the service account from opencloud.yaml into opencloud.env as
  OC_SERVICE_ACCOUNT_ID/OC_SERVICE_ACCOUNT_SECRET, which every service
  falls back to (covers 9.0's new auth_guest). Replaces the sed block
  that inserted sharing.service_account into the YAML.
- Rename GRAPH_SPACES_DEFAULT_QUOTA to OC_SPACES_DEFAULT_QUOTA.
- Remove the unused thumbnails/files cache.
- Add a commented OC_ENABLE_GUEST_LINKS block to opencloud.env.

* OpenCloud: warn on install if the service account cannot be read

Same check as the update path, in case the opencloud init output changes.

* OpenCloud: name the FQDN variables literally for unattended installs

The prompt loop builds var_opencloud_<server>_fqdn at runtime, so the PR
script test found no variables to pre-answer and the install exited 64.

---------

Co-authored-by: Sim Kai Long <2094270+SimKaiLong@users.noreply.github.com>
This commit is contained in:
Sim Kai LongandSim Kai Long authored and GitHub committed 2026-11-15 20:10:55 +01:00
1 parent 043c45a39e
commit 4d9546fbb2
2 files changed
+38 -9

No files matched your search

+23 -8
View File
@@ -40,7 +40,7 @@ function update_script() {
msg_ok "Allowed OpenCloud to embed Collabora"
fi
RELEASE="v8.1.0"
RELEASE="v9.0.0"
if check_for_gh_release "OpenCloud" "opencloud-eu/opencloud" "${RELEASE}" "each release is tested individually before the version is updated. Please do not open issues for this"; then
OLD_VERSION="$(cat ~/.opencloud 2>/dev/null)"
msg_info "Stopping services"
@@ -68,15 +68,30 @@ function update_script() {
# STORAGE_USERS_POSIX_WATCH_PATH=<path-to-storage-or-bind-mount>' /etc/opencloud/opencloud.env
fi
if ! sed -n '/^sharing:/,/^storage_users:/p' /etc/opencloud/opencloud.yaml | grep -q 'service_account'; then
ACCOUNT_ID="$(sed -n '/^activitylog:/,/*.$/p' /etc/opencloud/opencloud.yaml | awk -F'id:' '{print $2}' | tr -d '[:space:]')"
ACCOUNT_SECRET="$(sed -n '/^activitylog:/,/*.$/p' /etc/opencloud/opencloud.yaml | awk -F'secret:' '{print $2}' | tr -d '[:space:]')"
sed -i "/^sharing:/a\\
service_account:\\
service_account_id: $ACCOUNT_ID\\
service_account_secret: $ACCOUNT_SECRET" /etc/opencloud/opencloud.yaml
# Every OpenCloud service falls back to OC_SERVICE_ACCOUNT_ID/SECRET, so services that newly
# need the service account (sharing in 8.0, auth_guest in 9.0) work without editing opencloud.yaml
if ! grep -q '^OC_SERVICE_ACCOUNT_ID=' /etc/opencloud/opencloud.env; then
ACCOUNT_ID="$(awk '/service_account_id:/ {gsub(/["'\'']/, "", $2); print $2; exit}' /etc/opencloud/opencloud.yaml)"
ACCOUNT_SECRET="$(awk '/service_account_secret:/ {sub(/^[^:]*:[[:space:]]*/, ""); gsub(/^["'\'']|["'\'']$/, ""); print; exit}' /etc/opencloud/opencloud.yaml)"
if [[ -n "$ACCOUNT_ID" && -n "$ACCOUNT_SECRET" && "$ACCOUNT_SECRET" != *"'"* ]]; then
printf "OC_SERVICE_ACCOUNT_ID=%s\nOC_SERVICE_ACCOUNT_SECRET='%s'\n" "$ACCOUNT_ID" "$ACCOUNT_SECRET" |
sed -i '/^STORAGE_SYSTEM_OC_ROOT=/r /dev/stdin' /etc/opencloud/opencloud.env
else
msg_warn "Could not read the service account from opencloud.yaml; set OC_SERVICE_ACCOUNT_ID/SECRET in opencloud.env"
fi
fi
if ! grep -q 'OC_ENABLE_GUEST_LINKS' /etc/opencloud/opencloud.env; then
sed -i '/^## Start additional services/i ## Guest links - share with external people by email\
## Requires the SMTP settings above and notifications in OC_ADD_RUN_SERVICES\
# OC_ENABLE_GUEST_LINKS=true\
' /etc/opencloud/opencloud.env
fi
# 9.0: the default space quota is read only under its new name, and thumbnails are cached in thumbnails/cache
sed -i 's/^GRAPH_SPACES_DEFAULT_QUOTA=/OC_SPACES_DEFAULT_QUOTA=/' /etc/opencloud/opencloud.env
rm -rf /var/lib/opencloud/thumbnails/files
msg_info "Starting services"
systemctl start opencloud opencloud-wopi
msg_ok "Started services"
+15 -1
View File
@@ -14,6 +14,8 @@ network_check
update_os
MAX_ATTEMPTS=3
# Each FQDN is read from var_opencloud_opencloud_fqdn, var_opencloud_collabora_fqdn and var_opencloud_wopi_fqdn when set.
# Named literally here because the prompt below builds the name from $server, and unattended runs look for the literal names.
servers=("opencloud" "collabora" "wopi")
attempt=0
for server in "${servers[@]}"; do
@@ -68,7 +70,7 @@ $STD sudo -u cool coolconfig set-admin-password --user=admin --password="$COOLPA
echo "$COOLPASS" >~/.coolpass
msg_ok "Installed Collabora Online"
fetch_and_deploy_gh_release "OpenCloud" "opencloud-eu/opencloud" "singlefile" "v8.1.0" "/usr/bin" "opencloud-*-linux-$(arch_resolve)"
fetch_and_deploy_gh_release "OpenCloud" "opencloud-eu/opencloud" "singlefile" "v9.0.0" "/usr/bin" "opencloud-*-linux-$(arch_resolve)"
mv /usr/bin/OpenCloud /usr/bin/opencloud
msg_info "Configuring OpenCloud"
@@ -128,6 +130,10 @@ COLLABORATION_JWT_SECRET=
## Allow insecure connections. Defaults to false.
# NOTIFICATIONS_SMTP_INSECURE=false
## Guest links - share with external people by email
## Requires the SMTP settings above and notifications in OC_ADD_RUN_SERVICES
# OC_ENABLE_GUEST_LINKS=true
## Start additional services at runtime
## Examples: notifications, antivirus etc.
## Do not uncomment unless configured above.
@@ -217,6 +223,14 @@ chown -R opencloud:opencloud "$CONFIG_DIR" "$DATA_DIR"
sudo -u opencloud opencloud init --config-path "$CONFIG_DIR" --insecure no
OPENCLOUD_SECRET="$(sed -n '/jwt/p' "$CONFIG_DIR"/opencloud.yaml | awk '{print $2}')"
sed -i "s/JWT_SECRET=/&${OPENCLOUD_SECRET//&/\\&}/" "$ENV_FILE"
ACCOUNT_ID="$(awk '/service_account_id:/ {gsub(/["'\'']/, "", $2); print $2; exit}' "$CONFIG_DIR"/opencloud.yaml)"
ACCOUNT_SECRET="$(awk '/service_account_secret:/ {sub(/^[^:]*:[[:space:]]*/, ""); gsub(/^["'\'']|["'\'']$/, ""); print; exit}' "$CONFIG_DIR"/opencloud.yaml)"
if [[ -n "$ACCOUNT_ID" && -n "$ACCOUNT_SECRET" && "$ACCOUNT_SECRET" != *"'"* ]]; then
printf "OC_SERVICE_ACCOUNT_ID=%s\nOC_SERVICE_ACCOUNT_SECRET='%s'\n" "$ACCOUNT_ID" "$ACCOUNT_SECRET" |
sed -i '/^STORAGE_SYSTEM_OC_ROOT=/r /dev/stdin' "$ENV_FILE"
else
msg_warn "Could not read the service account from opencloud.yaml; set OC_SERVICE_ACCOUNT_ID/SECRET in opencloud.env"
fi
msg_ok "Configured OpenCloud"
msg_info "Starting services"