diff --git a/services/web/modules/server-ce-scripts/scripts/check-texlive-images.js b/services/web/modules/server-ce-scripts/scripts/check-texlive-images.js index 110b884134..4f474650ff 100644 --- a/services/web/modules/server-ce-scripts/scripts/check-texlive-images.js +++ b/services/web/modules/server-ce-scripts/scripts/check-texlive-images.js @@ -21,6 +21,13 @@ async function readImagesInUse() { return images } +function checkIsServerPro() { + if (process.env.OVERLEAF_IS_SERVER_PRO !== 'true') { + console.log('Running Overleaf Community Edition, skipping TexLive checks') + process.exit(0) + } +} + function checkSandboxedCompilesAreEnabled() { if (process.env.SANDBOXED_COMPILES !== 'true') { console.log('Sandboxed compiles disabled, skipping TexLive checks') @@ -46,6 +53,7 @@ async function main() { process.exit(0) } + checkIsServerPro() checkSandboxedCompilesAreEnabled() checkTexLiveEnvVariablesAreProvided() diff --git a/services/web/modules/server-ce-scripts/test/acceptance/src/ServerCEScriptsTests.js b/services/web/modules/server-ce-scripts/test/acceptance/src/ServerCEScriptsTests.js index 61726ed39f..0c304e14f1 100644 --- a/services/web/modules/server-ce-scripts/test/acceptance/src/ServerCEScriptsTests.js +++ b/services/web/modules/server-ce-scripts/test/acceptance/src/ServerCEScriptsTests.js @@ -524,6 +524,7 @@ describe('ServerCEScripts', function () { SANDBOXED_COMPILES, TEX_LIVE_DOCKER_IMAGE, ALL_TEX_LIVE_DOCKER_IMAGES, + OVERLEAF_IS_SERVER_PRO = true, }) { let cmd = `SANDBOXED_COMPILES=${SANDBOXED_COMPILES ? 'true' : 'false'}` if (TEX_LIVE_DOCKER_IMAGE) { @@ -532,6 +533,9 @@ describe('ServerCEScripts', function () { if (ALL_TEX_LIVE_DOCKER_IMAGES) { cmd += ` ALL_TEX_LIVE_DOCKER_IMAGES='${ALL_TEX_LIVE_DOCKER_IMAGES}'` } + if (OVERLEAF_IS_SERVER_PRO === true) { + cmd += ` OVERLEAF_IS_SERVER_PRO=${OVERLEAF_IS_SERVER_PRO}` + } return ( cmd + ' node modules/server-ce-scripts/scripts/check-texlive-images' ) @@ -544,6 +548,18 @@ describe('ServerCEScripts', function () { await user.createProject('test-project') }) + describe('when running in CE', function () { + beforeEach('run script', function () { + output = run(buildCheckTexLiveCmd({ OVERLEAF_IS_SERVER_PRO: false })) + }) + + it('should skip checks', function () { + expect(output).to.include( + 'Running Overleaf Community Edition, skipping TexLive checks' + ) + }) + }) + describe('when sandboxed compiles are disabled', function () { beforeEach('run script', function () { output = run(buildCheckTexLiveCmd({ SANDBOXED_COMPILES: false }))