#!/bin/bash set -e 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