diff --git a/README.md b/README.md index fdaa3f3..a8d9e7b 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,7 @@ The following table is giving a list of error code with explanation: | 6 | Unable to find configuration | | 7 | Misuse of script internal function | | 8 | Can't determine OS version | +| 9 | Unsatisfied dependency | | 11 | Bad function call | | 12 | Error copying files | | 13 | Bad target file system | diff --git a/init.sh b/init.sh index 08d0407..4a71048 100755 --- a/init.sh +++ b/init.sh @@ -36,7 +36,7 @@ export LC_ALL=C export LANG=C # Version of init -export VERSION="0.99.8" +export VERSION="0.99.9" # Store script's path (realpath -s resolve symlinks if init.sh is a symlink) export MYPATH=$(dirname $(realpath -s $0)) @@ -146,11 +146,22 @@ fi # Run prechecks if [[ JUMP != true ]]; then + tmpfile=$(mktemp /tmp/init-XXXXXX) for mod in $MODULE_LIST; do version=VER_$mod prnt I "Vérification initiale pour $mod version ${!version}..." + deps=DEP_$mod + for dep in ${!deps}; do + if [[ ! $(grep $dep $tmpfile) ]]; then + prnt E "Le module $mod a des dépendances non satisfaite ou est exécuté trop tôt." + prnt E " * $dep doit être exécuté avant $mod, vérifiez votre liste de modules." + die 9 + fi + done precheck_$mod + echo $mod >> $tmpfile done + rm -f $tmpfile unset mod fi