2021-09-30 12:05:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
command_exists () {
|
|
|
|
type "$1" &> /dev/null;
|
|
|
|
}
|
|
|
|
|
2021-12-10 13:26:34 +00:00
|
|
|
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
|
|
|
|
|
2021-09-30 12:05:43 +00:00
|
|
|
ARCH="$(dpkg --print-architecture)"
|
|
|
|
if [ "$ARCH" != "amd64" ]; then
|
|
|
|
echo "ONLYOFFICE ${product^^} doesn't support architecture '$ARCH'"
|
|
|
|
exit;
|
|
|
|
fi
|
|
|
|
|
|
|
|
REV=`cat /etc/debian_version`
|
|
|
|
DIST='Debian'
|
|
|
|
if [ -f /etc/lsb-release ] ; then
|
|
|
|
DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
|
|
|
|
REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
|
|
|
|
DISTRIB_CODENAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`
|
|
|
|
DISTRIB_RELEASE=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
|
|
|
|
elif [ -f /etc/lsb_release ] || [ -f /usr/bin/lsb_release ] ; then
|
|
|
|
DIST=`lsb_release -a 2>&1 | grep 'Distributor ID:' | awk -F ":" '{print $2 }' | tr -d '[:space:]'`
|
|
|
|
REV=`lsb_release -a 2>&1 | grep 'Release:' | awk -F ":" '{print $2 }' | tr -d '[:space:]'`
|
|
|
|
DISTRIB_CODENAME=`lsb_release -a 2>&1 | grep 'Codename:' | awk -F ":" '{print $2 }' | tr -d '[:space:]'`
|
|
|
|
DISTRIB_RELEASE=`lsb_release -a 2>&1 | grep 'Release:' | awk -F ":" '{print $2 }' | tr -d '[:space:]'`
|
|
|
|
elif [ -f /etc/os-release ] ; then
|
|
|
|
DISTRIB_CODENAME=$(grep "VERSION=" /etc/os-release |awk -F= {' print $2'}|sed s/\"//g |sed s/[0-9]//g | sed s/\)$//g |sed s/\(//g | tr -d '[:space:]')
|
|
|
|
DISTRIB_RELEASE=$(grep "VERSION_ID=" /etc/os-release |awk -F= {' print $2'}|sed s/\"//g |sed s/[0-9]//g | sed s/\)$//g |sed s/\(//g | tr -d '[:space:]')
|
|
|
|
fi
|
|
|
|
|
|
|
|
DIST=`echo "$DIST" | tr '[:upper:]' '[:lower:]' | xargs`;
|
|
|
|
DISTRIB_CODENAME=`echo "$DISTRIB_CODENAME" | tr '[:upper:]' '[:lower:]' | xargs`;
|