Commit cb367938 authored by Dominique Martinet's avatar Dominique Martinet
Browse files

cryptpad: restore install-onlyoffice.sh

fix script --check mode and use it
parent c00f7f40
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
From 711aa33dbc75c68ce2184d7c9ed522c0b0358cc6 Mon Sep 17 00:00:00 2001
From: Dominique Martinet <asmadeus@codewreck.org>
Date: Sat, 8 Nov 2025 07:09:39 +0900
Subject: [PATCH] install-onlyoffice.sh: fix --check for new install_version
 function

---
 install-onlyoffice.sh | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/install-onlyoffice.sh b/install-onlyoffice.sh
index 757be5437a74..c26d98d73b48 100755
--- a/install-onlyoffice.sh
+++ b/install-onlyoffice.sh
@@ -271,17 +271,27 @@ install_old_version() {
 }
 
 install_version() {
-    ensure_command_available curl
-    ensure_command_available sha512sum
-    ensure_command_available unzip
-
     local DIR=$1
     local VERSION=$2
     local HASH=$3
     local FULL_DIR=$OO_DIR/$DIR
     local LAST_DIR=$(pwd)
 
-    if [ ! -e "$FULL_DIR"/.version ] || [ "$(cat "$FULL_DIR"/.version)" != "$VERSION" ]; then
+    local ACTUAL_VERSION="not installed"
+    if [ -e "$FULL_DIR"/.version ]; then
+        ACTUAL_VERSION="$(cat "$FULL_DIR"/.version)"
+    fi
+
+    if [ "$ACTUAL_VERSION" != "$VERSION" ]; then
+        if [ ${CHECK+x} ]; then
+            echo "Wrong version in $FULL_DIR. Expected: $VERSION. Found: $ACTUAL_VERSION"
+            exit 1
+        fi
+
+        ensure_command_available sha512sum
+        ensure_command_available curl
+        ensure_command_available unzip
+
         rm -rf "$FULL_DIR"
         mkdir -p "$FULL_DIR"
 
-- 
2.51.1
+8 −3
Original line number Diff line number Diff line
@@ -143,6 +143,9 @@ buildNpmPackage {
    # fix httpSafePort setting
    # https://github.com/cryptpad/cryptpad/pull/1571
    ./0001-env.js-fix-httpSafePort-handling.patch
    # fix install-onlyyofice.sh check
    # https://github.com/cryptpad/cryptpad/pull/2097
    ./0001-install-onlyoffice.sh-fix-check-for-new-install_vers.patch
  ];

  # cryptpad build tries to write in cache dir
@@ -179,9 +182,11 @@ buildNpmPackage {
    # verify that we've installed the correct versions of the various
    # OnlyOffice components.

    # TODO: Patch the new install method to only verify versions;
    # patchShebangs --build $out_cryptpad/install-onlyoffice.sh
    # $out_cryptpad/install-onlyoffice.sh --accept-license --check --rdfind
    patchShebangs --build $out_cryptpad/install-onlyoffice.sh
    mkdir -p $out_cryptpad/onlyoffice-conf
    # Need to set this to verify older versions - next commit will optimize
    echo oldest_needed_version=v1 > $out_cryptpad/onlyoffice-conf/onlyoffice.properties
    $out_cryptpad/install-onlyoffice.sh --accept-license --check --rdfind

    # cryptpad assumes it runs in the source directory and also outputs
    # its state files there, which is not exactly great for us.