DocSpace-client/build/install/OneClickInstall/install-RedHat/tools.sh

50 lines
1.1 KiB
Bash

#!/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
read_unsupported_installation () {
read -p "$RES_CHOICE_INSTALLATION " CHOICE_INSTALLATION
case "$CHOICE_INSTALLATION" in
y|Y ) yum -y install $DIST*-release
;;
n|N ) exit 0;
;;
* ) echo $RES_CHOICE;
read_unsupported_installation
;;
esac
}