Browse Source

implement checkPrerequisites() and make a use from it

master
belliash 9 years ago
parent
commit
d3dc2aa2b3
3 changed files with 38 additions and 0 deletions
  1. +5
    -0
      ezbuild
  2. +5
    -0
      ezsync
  3. +28
    -0
      libraries/common

+ 5
- 0
ezbuild 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
- 0
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"

+ 28
- 0
libraries/common 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%


Loading…
Cancel
Save