added support for dependency checks, version bump

This commit is contained in:
levasseur
2021-10-08 11:32:08 +02:00
parent de3a8fb0cc
commit 9eb9928307
2 changed files with 13 additions and 1 deletions

View File

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

13
init.sh
View File

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