code cleanup: force local var before calling a for loop, make sure it's unset when no longer needed

This commit is contained in:
fatalerrors
2021-10-06 10:37:13 +02:00
parent c0b1bf1665
commit 1ac3ec303c
9 changed files with 65 additions and 16 deletions

16
init.sh
View File

@@ -51,6 +51,7 @@ export SYS_ARCH=$(uname -m)
for lib in $MYPATH/lib/*.sh; do
. $lib
done
unset lib
# =============================
# ==== Basic sanity checks ====
@@ -133,6 +134,7 @@ fi
for mod in $MODULE_LIST; do
. modules/$mod.sh
done
unset mod
if [[ $RUN_SHELL == true ]]; then
prnt I "Lancement d'un shell intéractif..."
@@ -142,11 +144,14 @@ if [[ $RUN_SHELL == true ]]; then
fi
# Run prechecks
[[ JUMP != true ]] && for mod in $MODULE_LIST; do
version=VER_$mod
prnt I "Vérification initiale pour $mod version ${!version}..."
precheck_$mod
done
if [[ JUMP != true ]]; then
for mod in $MODULE_LIST; do
version=VER_$mod
prnt I "Vérification initiale pour $mod version ${!version}..."
precheck_$mod
done
unset mod
fi
# If we only checks, we stop here
if [[ $CHECK_ONLY == true ]]; then
@@ -186,6 +191,7 @@ if [[ $key == "C" || $key == 'c' ]]; then
$mod
echo $mod >> $STAGE_FILE # Mark as done for resuming function
done
unset mod
echo
else
echo -e "${Yellow}Le système n'a subit aucune modifications.${DEFAULTCOL}"