From 3ef582f2724060a8aa6cd7050c39c0a444d8a93d Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Mon, 9 Sep 2024 17:17:57 -0400 Subject: [PATCH] installer: disallow installation on older macOS and Ubuntu (#2940) Signed-off-by: Jared Van Bortel --- .circleci/continue_config.yml | 30 ++++++------- gpt4all-chat/CHANGELOG.md | 1 + gpt4all-chat/CMakeLists.txt | 5 ++- ...tallerscript.qs => installer_component.qs} | 7 ++- gpt4all-chat/cmake/installer_control.qs | 44 +++++++++++++++++++ 5 files changed, 66 insertions(+), 21 deletions(-) rename gpt4all-chat/cmake/{installerscript.qs => installer_component.qs} (92%) create mode 100644 gpt4all-chat/cmake/installer_control.qs diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml index 9fa92952..0e371aea 100644 --- a/.circleci/continue_config.yml +++ b/.circleci/continue_config.yml @@ -43,7 +43,7 @@ jobs: command: | curl -o qt-unified-macOS-x64-4.6.0-online.dmg https://gpt4all.io/ci/qt-unified-macOS-x64-4.6.0-online.dmg hdiutil attach qt-unified-macOS-x64-4.6.0-online.dmg - /Volumes/qt-unified-macOS-x64-4.6.0-online/qt-unified-macOS-x64-4.6.0-online.app/Contents/MacOS/qt-unified-macOS-x64-4.6.0-online --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.clang_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + /Volumes/qt-unified-macOS-x64-4.6.0-online/qt-unified-macOS-x64-4.6.0-online.app/Contents/MacOS/qt-unified-macOS-x64-4.6.0-online --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.clang_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver hdiutil detach /Volumes/qt-unified-macOS-x64-4.6.0-online - run: name: Setup Keychain @@ -61,7 +61,7 @@ jobs: ccache -o "cache_dir=${PWD}/../.ccache" -o max_size=500M -p -z mkdir build cd build - export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.7/bin + export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.8/bin ~/Qt/Tools/CMake/CMake.app/Contents/bin/cmake \ -S ../gpt4all-chat -B . -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ @@ -181,7 +181,7 @@ jobs: command: | curl -o qt-unified-macOS-x64-4.6.0-online.dmg https://gpt4all.io/ci/qt-unified-macOS-x64-4.6.0-online.dmg hdiutil attach qt-unified-macOS-x64-4.6.0-online.dmg - /Volumes/qt-unified-macOS-x64-4.6.0-online/qt-unified-macOS-x64-4.6.0-online.app/Contents/MacOS/qt-unified-macOS-x64-4.6.0-online --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.clang_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + /Volumes/qt-unified-macOS-x64-4.6.0-online/qt-unified-macOS-x64-4.6.0-online.app/Contents/MacOS/qt-unified-macOS-x64-4.6.0-online --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.clang_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver hdiutil detach /Volumes/qt-unified-macOS-x64-4.6.0-online - run: name: Setup Keychain @@ -199,7 +199,7 @@ jobs: ccache -o "cache_dir=${PWD}/../.ccache" -o max_size=500M -p -z mkdir build cd build - export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.7/bin + export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.8/bin ~/Qt/Tools/CMake/CMake.app/Contents/bin/cmake \ -S ../gpt4all-chat -B . -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ @@ -331,7 +331,7 @@ jobs: command: | wget https://gpt4all.io/ci/qt-unified-linux-x64-4.6.0-online.run chmod +x qt-unified-linux-x64-4.6.0-online.run - ./qt-unified-linux-x64-4.6.0-online.run --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.gcc_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + ./qt-unified-linux-x64-4.6.0-online.run --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.gcc_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver - run: name: Build linuxdeployqt command: | @@ -343,7 +343,7 @@ jobs: command: | set -eo pipefail export CMAKE_PREFIX_PATH=~/Qt/6.5.1/gcc_64/lib/cmake - export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.7/bin + export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.8/bin export PATH=$PATH:/usr/local/cuda/bin ccache -o "cache_dir=${PWD}/../.ccache" -o max_size=500M -p -z mkdir build @@ -407,7 +407,7 @@ jobs: command: | wget https://gpt4all.io/ci/qt-unified-linux-x64-4.6.0-online.run chmod +x qt-unified-linux-x64-4.6.0-online.run - ./qt-unified-linux-x64-4.6.0-online.run --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.gcc_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + ./qt-unified-linux-x64-4.6.0-online.run --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.gcc_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver - run: name: Build linuxdeployqt command: | @@ -419,7 +419,7 @@ jobs: command: | set -eo pipefail export CMAKE_PREFIX_PATH=~/Qt/6.5.1/gcc_64/lib/cmake - export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.7/bin + export PATH=$PATH:$HOME/Qt/Tools/QtInstallerFramework/4.8/bin export PATH=$PATH:/usr/local/cuda/bin ccache -o "cache_dir=${PWD}/../.ccache" -o max_size=500M -p -z mkdir build @@ -471,7 +471,7 @@ jobs: name: Installing Qt command: | Invoke-WebRequest -Uri https://gpt4all.io/ci/qt-unified-windows-x64-4.6.0-online.exe -OutFile qt-unified-windows-x64-4.6.0-online.exe - & .\qt-unified-windows-x64-4.6.0-online.exe --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email ${Env:QT_EMAIL} --password ${Env:QT_PASSWORD} install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.win64_msvc2019_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + & .\qt-unified-windows-x64-4.6.0-online.exe --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email ${Env:QT_EMAIL} --password ${Env:QT_PASSWORD} install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.win64_msvc2019_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver - run: name: Install VulkanSDK command: | @@ -503,7 +503,7 @@ jobs: Enter-VsDevShell -VsInstallPath "$vsInstallPath" -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -no_logo' $Env:PATH = "${Env:PATH};C:\VulkanSDK\1.3.261.1\bin" - $Env:PATH = "${Env:PATH};C:\Qt\Tools\QtInstallerFramework\4.7\bin" + $Env:PATH = "${Env:PATH};C:\Qt\Tools\QtInstallerFramework\4.8\bin" $Env:DOTNET_ROOT="$($(Get-Location).Path)\dotnet\dotnet-sdk-8.0.302-win-x64" $Env:PATH="$Env:DOTNET_ROOT;$Env:PATH" ccache -o "cache_dir=${pwd}\..\.ccache" -o max_size=500M -p -z @@ -592,7 +592,7 @@ jobs: name: Installing Qt command: | Invoke-WebRequest -Uri https://gpt4all.io/ci/qt-unified-windows-x64-4.6.0-online.exe -OutFile qt-unified-windows-x64-4.6.0-online.exe - & .\qt-unified-windows-x64-4.6.0-online.exe --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email ${Env:QT_EMAIL} --password ${Env:QT_PASSWORD} install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.win64_msvc2019_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + & .\qt-unified-windows-x64-4.6.0-online.exe --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email ${Env:QT_EMAIL} --password ${Env:QT_PASSWORD} install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.win64_msvc2019_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver - run: name: Install VulkanSDK command: | @@ -629,7 +629,7 @@ jobs: Enter-VsDevShell -VsInstallPath "$vsInstallPath" -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -no_logo' $Env:PATH = "${Env:PATH};C:\VulkanSDK\1.3.261.1\bin" - $Env:PATH = "${Env:PATH};C:\Qt\Tools\QtInstallerFramework\4.7\bin" + $Env:PATH = "${Env:PATH};C:\Qt\Tools\QtInstallerFramework\4.8\bin" $Env:DOTNET_ROOT="$($(Get-Location).Path)\dotnet\dotnet-sdk-8.0.302-win-x64" $Env:PATH="$Env:DOTNET_ROOT;$Env:PATH" ccache -o "cache_dir=${pwd}\..\.ccache" -o max_size=500M -p -z @@ -738,7 +738,7 @@ jobs: command: | wget https://gpt4all.io/ci/qt-unified-linux-x64-4.6.0-online.run chmod +x qt-unified-linux-x64-4.6.0-online.run - ./qt-unified-linux-x64-4.6.0-online.run --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.gcc_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + ./qt-unified-linux-x64-4.6.0-online.run --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.gcc_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver - run: name: Build command: | @@ -784,7 +784,7 @@ jobs: name: Installing Qt command: | Invoke-WebRequest -Uri https://gpt4all.io/ci/qt-unified-windows-x64-4.6.0-online.exe -OutFile qt-unified-windows-x64-4.6.0-online.exe - & .\qt-unified-windows-x64-4.6.0-online.exe --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email ${Env:QT_EMAIL} --password ${Env:QT_PASSWORD} install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.win64_msvc2019_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + & .\qt-unified-windows-x64-4.6.0-online.exe --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email ${Env:QT_EMAIL} --password ${Env:QT_PASSWORD} install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.win64_msvc2019_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver - run: name: Install VulkanSDK command: | @@ -846,7 +846,7 @@ jobs: command: | curl -o qt-unified-macOS-x64-4.6.0-online.dmg https://gpt4all.io/ci/qt-unified-macOS-x64-4.6.0-online.dmg hdiutil attach qt-unified-macOS-x64-4.6.0-online.dmg - /Volumes/qt-unified-macOS-x64-4.6.0-online/qt-unified-macOS-x64-4.6.0-online.app/Contents/MacOS/qt-unified-macOS-x64-4.6.0-online --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.47 qt.tools.ninja qt.qt6.651.clang_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver + /Volumes/qt-unified-macOS-x64-4.6.0-online/qt-unified-macOS-x64-4.6.0-online.app/Contents/MacOS/qt-unified-macOS-x64-4.6.0-online --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email $QT_EMAIL --password $QT_PASSWORD install qt.tools.cmake qt.tools.ifw.48 qt.tools.ninja qt.qt6.651.clang_64 qt.qt6.651.qt5compat qt.qt6.651.debug_info qt.qt6.651.addons.qtpdf qt.qt6.651.addons.qthttpserver hdiutil detach /Volumes/qt-unified-macOS-x64-4.6.0-online - run: name: Build diff --git a/gpt4all-chat/CHANGELOG.md b/gpt4all-chat/CHANGELOG.md index 1ef2f32f..a8112492 100644 --- a/gpt4all-chat/CHANGELOG.md +++ b/gpt4all-chat/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Use greedy sampling when temperature is set to zero ([#2854](https://github.com/nomic-ai/gpt4all/pull/2854)) - Use configured system prompt in server mode and ignore system messages ([#2921](https://github.com/nomic-ai/gpt4all/pull/2921), [#2924](https://github.com/nomic-ai/gpt4all/pull/2924)) - Add more system information to anonymous usage stats ([#2939](https://github.com/nomic-ai/gpt4all/pull/2939)) +- Check for unsupported Ubuntu and macOS versions at install time ([#2940](https://github.com/nomic-ai/gpt4all/pull/2940)) ### Changed - The offline update button now directs users to the offline installer releases page. (by [@3Simplex](https://github.com/3Simplex) in [#2888](https://github.com/nomic-ai/gpt4all/pull/2888)) diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt index 522802f2..eda59903 100644 --- a/gpt4all-chat/CMakeLists.txt +++ b/gpt4all-chat/CMakeLists.txt @@ -321,7 +321,7 @@ if (LLMODEL_CUDA) endif() if (NOT APPLE) - install(FILES "${CMAKE_BINARY_DIR}/resources/${LOCAL_EMBEDDING_MODEL}" + install(FILES "${LOCAL_EMBEDDING_MODEL_PATH}" DESTINATION resources COMPONENT ${COMPONENT_NAME_MAIN}) endif() @@ -378,6 +378,7 @@ set(CPACK_IFW_PACKAGE_WIZARD_STYLE "Aero") set(CPACK_IFW_PACKAGE_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/icons/gpt4all-48.png") set(CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/gpt4all-32.png") set(CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST OFF) +set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installer_control.qs") include(InstallRequiredSystemLibraries) include(CPack) @@ -390,7 +391,7 @@ endif() cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} ESSENTIAL FORCED_INSTALLATION) cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} VERSION ${APP_VERSION}) cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} LICENSES "MIT LICENSE" ${CPACK_RESOURCE_FILE_LICENSE}) -cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installerscript.qs") +cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installer_component.qs") cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} REPLACES "gpt4all-chat") #Was used in very earliest prototypes if (GPT4ALL_LOCALHOST) diff --git a/gpt4all-chat/cmake/installerscript.qs b/gpt4all-chat/cmake/installer_component.qs similarity index 92% rename from gpt4all-chat/cmake/installerscript.qs rename to gpt4all-chat/cmake/installer_component.qs index 658dc09a..dcedab3b 100644 --- a/gpt4all-chat/cmake/installerscript.qs +++ b/gpt4all-chat/cmake/installer_component.qs @@ -6,8 +6,7 @@ Component.prototype.beginInstallation = function() { targetDirectory = installer.value("TargetDir"); }; -Component.prototype.createOperations = function() -{ +Component.prototype.createOperations = function() { try { // call the base create operations function component.createOperations(); @@ -30,7 +29,7 @@ Component.prototype.createOperations = function() "workingDirectory=" + targetDirectory + "/bin", "iconPath=" + targetDirectory + "/gpt4all.ico", "iconId=0", "description=Open GPT4All"); - } else if (systemInfo.productType === "macos" || systemInfo.productType === "osx") { + } else if (systemInfo.productType === "macos") { var gpt4allAppPath = targetDirectory + "/bin/gpt4all.app"; var symlinkPath = targetDirectory + "/../GPT4All.app"; // Remove the symlink if it already exists @@ -56,7 +55,7 @@ Component.prototype.createOperationsForArchive = function(archive) { component.createOperationsForArchive(archive); - if (systemInfo.productType === "macos" || systemInfo.productType === "osx") { + if (systemInfo.productType === "macos") { var uninstallTargetDirectory = installer.value("TargetDir"); var symlinkPath = uninstallTargetDirectory + "/../GPT4All.app"; diff --git a/gpt4all-chat/cmake/installer_control.qs b/gpt4all-chat/cmake/installer_control.qs new file mode 100644 index 00000000..99478e3e --- /dev/null +++ b/gpt4all-chat/cmake/installer_control.qs @@ -0,0 +1,44 @@ +var finishedText = null; + +function cancelInstaller(message) { + installer.setDefaultPageVisible(QInstaller.Introduction, false); + installer.setDefaultPageVisible(QInstaller.TargetDirectory, false); + installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); + installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false); + installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false); + installer.setDefaultPageVisible(QInstaller.PerformInstallation, false); + installer.setDefaultPageVisible(QInstaller.LicenseCheck, false); + finishedText = message; + installer.setCanceled(); +} + +function vercmp(a, b) { + return a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }); +} + +function Controller() { +} + +Controller.prototype.TargetDirectoryPageCallback = function() { + var failedReq = null; + if (systemInfo.productType === "ubuntu" && vercmp(systemInfo.productVersion, "22.04") < 0) { + failedReq = "Ubuntu 22.04 LTS"; + } else if (systemInfo.productType === "macos" && vercmp(systemInfo.productVersion, "12.6") < 0) { + failedReq = "macOS Monterey 12.6"; + } + + if (failedReq !== null) { + cancelInstaller( + "Installation cannot continue because GPT4All does not support your operating system: " + + `${systemInfo.prettyProductName}

` + + `GPT4All requires ${failedReq} or newer.` + ); + } +} + +Controller.prototype.FinishedPageCallback = function() { + const widget = gui.currentPageWidget(); + if (widget != null && finishedText != null) { + widget.MessageLabel.setText(finishedText); + } +}