From 59a4083eac7305861075692720d3c5840a48c7c8 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 19 Jun 2025 14:28:40 +0200 Subject: [PATCH] Update onlyoffice-install.sh --- install/onlyoffice-install.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/install/onlyoffice-install.sh b/install/onlyoffice-install.sh index 87ea89df..3c7d241a 100644 --- a/install/onlyoffice-install.sh +++ b/install/onlyoffice-install.sh @@ -40,10 +40,22 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" msg_ok "Set up Database" msg_info "Adding ONLYOFFICE GPG Key" -mkdir -p -m 700 ~/.gnupg -$STD curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | - gpg --no-default-keyring --keyring gnupg-ring:/tmp/onlyoffice.gpg --import -msg_ok "GPG Key Added" +GPG_TMP="/tmp/onlyoffice.gpg" +KEY_URL="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE" + +TMP_KEY_CONTENT=$(mktemp) +if curl -fsSL "$KEY_URL" -o "$TMP_KEY_CONTENT" && grep -q "BEGIN PGP PUBLIC KEY BLOCK" "$TMP_KEY_CONTENT"; then + gpg --no-default-keyring --keyring "gnupg-ring:$GPG_TMP" --import "$TMP_KEY_CONTENT" >/dev/null + chmod 644 "$GPG_TMP" + chown root:root "$GPG_TMP" + mv "$GPG_TMP" /usr/share/keyrings/onlyoffice.gpg + msg_ok "GPG Key Added" +else + msg_error "Failed to download or verify GPG key from $KEY_URL" + [[ -f "$TMP_KEY_CONTENT" ]] && rm -f "$TMP_KEY_CONTENT" + exit 1 +fi +rm -f "$TMP_KEY_CONTENT" msg_info "Configuring ONLYOFFICE Repository" chmod 644 /tmp/onlyoffice.gpg