-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hardware check in deb and rpm OneClickInstall (#479)
* Add hardware check in deb and rpm OneClickInstall * Modify docker document server run config (#476) * Revert "Modify docker document server run config (#476)" This reverts commit 9ed7f71.
- Loading branch information
1 parent
0855ead
commit eca872c
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/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 |