diff --git a/ezbuild b/ezbuild index a9d1184..02d9f21 100755 --- a/ezbuild +++ b/ezbuild @@ -14,3 +14,8 @@ source ${EZROOT}/libraries/common # Load EzBuild libraries & configuration loadLibraries loadConfiguration + +# Check system requirements +printInfo "Checking system prerequisites..." +checkPrerequisites +[ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements" diff --git a/ezsync b/ezsync index a9d1184..02d9f21 100755 --- a/ezsync +++ b/ezsync @@ -14,3 +14,8 @@ source ${EZROOT}/libraries/common # Load EzBuild libraries & configuration loadLibraries loadConfiguration + +# Check system requirements +printInfo "Checking system prerequisites..." +checkPrerequisites +[ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements" diff --git a/libraries/common b/libraries/common index 6a88ebd..0c1f988 100644 --- a/libraries/common +++ b/libraries/common @@ -3,6 +3,34 @@ # Distributed under the terms of the GNU General Public License v3 +#------------------------------------------------------------------------------- +# Checks if system running EzBuild meets its requirements +#------------------------------------------------------------------------------- +function checkPrerequisites() { + if [ "$(uname -s)" != "Linux" ]; then + printError "You are trying to launch ${EZNAME} on non-Linux system!" + return 1 + fi + if [ "${EUID}" != "0" ] && [ "${USER}" != "root" ]; then + printError "The ${EZNAME} needs to be launched from root account!" + return 1 + fi + if [ ! -e /dev/null ]; then + printError "The /dev directory seems to be not mounted!" + return 1 + fi + if [ ! -e /proc/mounts ]; then + printError "The /proc directory seems to be not mounted!" + return 1 + fi + ping -c 1 google.com &> /dev/null + if [ ${?} -ne 0 ]; then + printError "There seems to be no Internet conectivity!" + return 1 + fi + return 0 +} + #------------------------------------------------------------------------------- # Tests for a minimum version level by comparing version numbers # Parameters: %min_version% %test_version%