diff --git a/build/install/OneClickInstall/install-Debian.sh b/build/install/OneClickInstall/install-Debian.sh index d73049cf982..b00d4ee8e75 100644 --- a/build/install/OneClickInstall/install-Debian.sh +++ b/build/install/OneClickInstall/install-Debian.sh @@ -37,6 +37,13 @@ while [ "$1" != "" ]; do fi ;; + -skiphc | --skiphardwarecheck ) + if [ "$2" != "" ]; then + SKIP_HARDWARE_CHECK=$2 + shift + fi + ;; + -? | -h | --help ) echo " Usage $0 [PARAMETER] [[PARAMETER], ...]" echo " Parameters:" @@ -60,6 +67,10 @@ if [ -z "${LOCAL_SCRIPTS}" ]; then LOCAL_SCRIPTS="false"; fi +if [ -z "${SKIP_HARDWARE_CHECK}" ]; then + SKIP_HARDWARE_CHECK="false"; +fi + if [ $(dpkg-query -W -f='${Status}' curl 2>/dev/null | grep -c "ok installed") -eq 0 ]; then apt-get update; apt-get install -yq curl; diff --git a/build/install/OneClickInstall/install-Debian/tools.sh b/build/install/OneClickInstall/install-Debian/tools.sh index c1631d0f0fe..f8a939253d7 100644 --- a/build/install/OneClickInstall/install-Debian/tools.sh +++ b/build/install/OneClickInstall/install-Debian/tools.sh @@ -6,6 +6,37 @@ command_exists () { type "$1" &> /dev/null; } +check_hardware () { + DISK_REQUIREMENTS=40960; + MEMORY_REQUIREMENTS=5500; + CORE_REQUIREMENTS=2; + + AVAILABLE_DISK_SPACE=$(df -m / | tail -1 | awk '{ print $4 }'); + + if [ ${AVAILABLE_DISK_SPACE} -lt ${DISK_REQUIREMENTS} ]; then + echo "Minimal requirements are not met: need at least $DISK_REQUIREMENTS MB of free HDD space" + exit 1; + fi + + TOTAL_MEMORY=$(free -m | grep -oP '\d+' | head -n 1); + + if [ ${TOTAL_MEMORY} -lt ${MEMORY_REQUIREMENTS} ]; then + echo "Minimal requirements are not met: need at least $MEMORY_REQUIREMENTS MB of RAM" + exit 1; + fi + + CPU_CORES_NUMBER=$(cat /proc/cpuinfo | grep processor | wc -l); + + if [ ${CPU_CORES_NUMBER} -lt ${CORE_REQUIREMENTS} ]; then + echo "The system does not meet the minimal hardware requirements. CPU with at least $CORE_REQUIREMENTS cores is required" + exit 1; + fi +} + +if [ "$SKIP_HARDWARE_CHECK" != "true" ]; then + check_hardware +fi + ARCH="$(dpkg --print-architecture)" if [ "$ARCH" != "amd64" ]; then echo "ONLYOFFICE ${product^^} doesn't support architecture '$ARCH'" diff --git a/build/install/OneClickInstall/install-RedHat.sh b/build/install/OneClickInstall/install-RedHat.sh index 16c5ba82a94..c82f0c5a772 100644 --- a/build/install/OneClickInstall/install-RedHat.sh +++ b/build/install/OneClickInstall/install-RedHat.sh @@ -47,6 +47,13 @@ while [ "$1" != "" ]; do fi ;; + -skiphc | --skiphardwarecheck ) + if [ "$2" != "" ]; then + SKIP_HARDWARE_CHECK=$2 + shift + fi + ;; + -? | -h | --help ) echo " Usage $0 [PARAMETER] [[PARAMETER], ...]" echo " Parameters:" @@ -69,6 +76,10 @@ if [ -z "${LOCAL_SCRIPTS}" ]; then LOCAL_SCRIPTS="false"; fi +if [ -z "${SKIP_HARDWARE_CHECK}" ]; then + SKIP_HARDWARE_CHECK="false"; +fi + cat > /etc/yum.repos.d/onlyoffice.repo <