diff options
author | Jybz <j.biernacki+mga@free.fr> | 2020-12-14 12:35:54 +0100 |
---|---|---|
committer | Jybz <j.biernacki+mga@free.fr> | 2020-12-14 12:35:54 +0100 |
commit | bdffb942c7a62b2b160ee490653968f562a70e9f (patch) | |
tree | b56dd371a531528f77c96316f2e8add26ff7af63 | |
parent | 0715baf30e1917b11fc5a609c71847ad497c363d (diff) | |
download | mageia4arm-bdffb942c7a62b2b160ee490653968f562a70e9f.tar mageia4arm-bdffb942c7a62b2b160ee490653968f562a70e9f.tar.gz mageia4arm-bdffb942c7a62b2b160ee490653968f562a70e9f.tar.bz2 mageia4arm-bdffb942c7a62b2b160ee490653968f562a70e9f.tar.xz mageia4arm-bdffb942c7a62b2b160ee490653968f562a70e9f.zip |
Add environemnt checking function
-rwxr-xr-x | create_arm_image.sh | 2 | ||||
-rwxr-xr-x | functions.sh | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/create_arm_image.sh b/create_arm_image.sh index 5a46a69..75b243c 100755 --- a/create_arm_image.sh +++ b/create_arm_image.sh @@ -321,6 +321,8 @@ print_info "Firmware path : ${FIRMWARE_PATH}" print_info "Firmware dir : ${FIRMWARE_DIR}" print_info "Installation method : ${INSTALL_METHOD}" +check_environment + # change dir to install path and create it if not existing if [ "${OPT}" != "clean" ]; then print_info "cd ${INSTALL_PATH}" diff --git a/functions.sh b/functions.sh index ceb848a..5d331e4 100755 --- a/functions.sh +++ b/functions.sh @@ -59,6 +59,21 @@ function error() { } +function check_environment() { + if [ "x${INSTALL_METHOD}" == "xurpmi" ]; then + hash /usr/sbin/urpmi + if [ 0 -ne ${?} ]; then + error "urpmi is missing." + fi + elif [ "x${INSTALL_METHOD}" == "xurpmi" ]; then + hash /usr/bin/dnf + if [ 0 -ne ${?} ]; then + error "dnf is missing." + fi + fi + ### TODO add other environmnet things, like : from function createchroot() +} + function verify_disk_space() { title "Verifying if there is enough space on disk to make the image" DISK_SPACE=$(/usr/bin/df -BG --output=avail "${INSTALL_PATH}" | sed '1d;s/[^0-9]//g') |