added file dependency check, switched back to english, smaller fix and improvements

This commit is contained in:
fatalerrors
2021-11-18 14:53:11 +01:00
parent 9fc9b96165
commit b71a0c2ee8
21 changed files with 360 additions and 173 deletions

View File

@@ -16,7 +16,7 @@ read_commandline()
{
syntax_error()
{
prnt E "Erreur d'analyse de la ligne de commande, vérifiez vos paramètres."
prnt E "Error while analysing command line, please check your parameters."
die 1 --force
}
@@ -52,8 +52,8 @@ read_commandline()
if [[ -s $STAGE_FILE ]]; then
export RESUME=true
else
prnt E "Le fichier d'état n'existe pas ou est vide !"
prnt E "Sans ce fichier, la reprise n'est pas possible."
prnt E "The state file doesn't exists or is empty!"
prnt E "Without it, resuming is impossible."
die 1 --force
fi
;;
@@ -90,8 +90,8 @@ read_commandline()
export MANUAL_MODULE_LIST=$opt
want_module=false
else
prnt E "Une liste de module à déjà été fournie !"
prnt E "La ligne de commande ne tolère qu'un seul paramètre --module."
prnt E "A module list have already been given!"
prnt E "Commande line only tolerate one --module parameter."
die 1 --force
fi
elif [[ $want_logfile == true ]]; then
@@ -102,7 +102,7 @@ read_commandline()
export NEW_LOGFILE=$opt
want_logfile=false
else
prnt E "Il n'est pas possible de spécifier plusieurs fichiers de log."
prnt E "It's impossible to specify several log files."
die 1 --force
fi
elif [[ $want_conffile == true ]]; then
@@ -119,11 +119,11 @@ read_commandline()
export CHROOT_PATH=$opt
want_chroot=false
else
prnt E "Un chemin pour chroot à déjà été fournis."
prnt E "A chroot path have already been given."
die 1 --force
fi
else
prnt E "Paramètre \"$opt\" non géré."
prnt E "Unknow parameter \"$opt\"."
die 1 --force
fi
;;
@@ -161,13 +161,13 @@ chroot_bootstrap()
bootstrap_items="$bootstrap_items $STAGE_FILE"
fi
prnt I "Préparation du changement de racine."
prnt I "Preparing root change."
cp -av $bootstrap_items $tmpdir
prnt I "Changement de racine et démarrage d'un fork d'init.sh..."
prnt I "Changing root and starting a fork of init.sh..."
chroot $CHROOT_PATH /bin/bash -c 'CHROOT_DONE=true; $tmpdir/init.sh $@'
prnt I "Retours au système hote et nettoyage."
prnt I "Back to host system and clean up."
rm -rf $tmpdir
}
@@ -222,26 +222,26 @@ load_configuration()
if [[ -n $CONFFILES ]]; then
local f=
for f in $CONFFILES; do
prnt I "Chargement de $f spécifié manuellement."
prnt I "Loading $f manuelly specified."
if [[ -s $f ]]; then
. $f
else
prnt E "Le fichier $f n'existe pas ou est vide."
prnt E "The $f file doesn't exists or is empty."
die 6 --force
fi
done
unset f
else
prnt I "Chargement de la configuration..."
prnt I "Loading configuration..."
if [[ -e $MYPATH/conf/$HOSTNAME.conf.sh ]]; then
prnt I "Une configuration spécifique sera utilisé."
prnt I "A specific configuration will be used."
. $MYPATH/conf/$HOSTNAME.conf.sh
else
if [[ -e $MYPATH/conf/init.conf.sh ]]; then
prnt I "Une configuration générique sera utilisé."
prnt I "A generic configuration will be used."
. $MYPATH/conf/init.conf.sh
else
prnt E "Aucune configuration trouvée, impossible de continuer."
prnt E "No configuration found, impossible to continue."
die 6 --force
fi
fi
@@ -257,46 +257,46 @@ process_commandline_and_vars()
# Check unconsistant parameters
if [[ $CHECK_ONLY == true ]]; then
if [[ $JUMP == true ]]; then
prnt E "Les options --check-only et --jump s'excluent mutuellement !"
prnt E "The options --check-only and --jump are mutually exclusive!"
die 1 --force
fi
if [[ $KEEPGOING == true ]]; then
prnt E "Les options --keep-going et --check-only sont incompatible !"
prnt E "The options --keep-going and --check-only are not compatible!"
die 1 --force
fi
fi
if [[ $RESUME == true ]]; then
if [[ $CHECK_ONLY == true ]]; then
prnt E "La reprise n'a pas de sens avec --check-only."
prnt E "Resuming doesn't make sense with --check-only."
die 1 --force
fi
if [[ $MANUAL_MODULE_LIST ]]; then
prnt E "Le mode reprise ne fonctionne pas avec une liste de modules passé manuellement."
prnt E "Recovery mode can't work with a manual module list."
die 1 --force
fi
fi
if [[ $CRON_MODE == true ]]; then
if [[ $CHECK_ONLY == true || $JUMP == true ]]; then
prnt E "Des paramètres sont incompatibles avec le mode cron."
prnt E "Some parameters are incompatible with cron mode."
die 16 --force
fi
fi
# Configure module list
if [[ -n $MANUAL_MODULE_LIST ]]; then
prnt W "Une liste de modules manuelle sera utilisé."
prnt W "A manual module list will be used."
export MODULE_LIST=$(echo $MANUAL_MODULE_LIST | sed "s/,/ /g")
fi
# Check for module list existance and basic syntax
if [[ -n $MODULE_LIST ]]; then
if [[ $(echo $MODULE_LIST | grep '-') ]]; then
prnt E "Le tiret est interdit dans les noms de module."
prnt E "Dash is forbidden in module name."
die 5
fi
else
prnt E "Aucun module à exécuter !"
prnt E "No module to execute!"
die 5
fi
}