implement checkPrerequisites() and make a use from it

This commit is contained in:
belliash 2012-01-03 11:24:11 +01:00
parent e6ce238bf4
commit d3dc2aa2b3
3 changed files with 38 additions and 0 deletions

View File

@ -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"

5
ezsync
View File

@ -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"

View File

@ -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%