diff --git a/init.sh b/init.sh index 863c53c..b74fa40 100755 --- a/init.sh +++ b/init.sh @@ -66,6 +66,7 @@ read_commandline check_root # Logfile variable treatment -- cannot be a function + export LOGFILE=${LOGFILE:-"$MYPATH/log/init-$(uname -n)-$(stdtime).log"} prnt I "Création du répertoire d'accueil du fichier log..." @@ -96,12 +97,22 @@ done if [[ $CHECK_ONLY == true ]]; then prnt I "Mode de vérification seulement, on s'arrête là." exit 0 +else + [[ $JUMP == true ]] && print I "Toutes les vérification ont été faites." + echo + echo "Appuyez sur CTLR + C maintenant si vous souhaitez interrompre." + echo -e "${BYellow}Si vous continuez après cette étape le système sera modifié !${DEFAULTCOL}" + echo + read -n 1 -s -r -p "Appuyer sur n'importe quelle touche pour continuer..." fi # We launch modules one after one for mod in $MODULE_LIST; do - : # do everything + # We need this only if JUMP is set but doesn't matter if it's done again + . modules/$mod.sh + version=VER_$mod + prnt I "Application des modifications pour $mod version ${!version}..." + $mod done - prnt I "That's all folks !" diff --git a/lib/aaa_errors.sh b/lib/aaa_errors.sh index 995d2df..492a48a 100644 --- a/lib/aaa_errors.sh +++ b/lib/aaa_errors.sh @@ -8,7 +8,7 @@ function die() # Don't trigger the ERR signal as we already managed the error trap - ERR - if [[ "$KEEPGOING" != "true" || "$2" == "--force" ]]; then + if [[ "$KEEPGOING" != "true" ]] || [[ "$2" == "--force" ]]; then prnt E "Sortie prématuré avec erreur (code #$errorcode)." exit $errorcode else @@ -83,6 +83,7 @@ function backtrace check_root() { + [[ $NO_ROOT_CHECK == true ]] && return 0 if [[ $EUID -ne 0 ]]; then prnt E "Ce script doit être démarré en tant que root. Arrêt." die 4 --force diff --git a/lib/support.sh b/lib/support.sh index d9836bf..b085945 100644 --- a/lib/support.sh +++ b/lib/support.sh @@ -14,6 +14,7 @@ Options : -j, --jump Saute les procédures de vérification. -k, --keep-going L'execution continura en cas d'erreur. -r, --resume Reprend l'execution la ou elle c'est arrêté. + -R, --no-root-check Ne pas vérifier les droits root (ou UID 0) -h, --help Affiche ce texte d'aide. -v, --version Show version of that script and version of all available modules. diff --git a/lib/zzz_main_fct.sh b/lib/zzz_main_fct.sh index 36074e2..96add56 100644 --- a/lib/zzz_main_fct.sh +++ b/lib/zzz_main_fct.sh @@ -35,6 +35,9 @@ read_commandline() die 1 --force fi ;; + "-R"|"--no-root-check") + export NO_ROOT_CHECK=true + ;; *) prnt E "Paramètre \'$opt\' non géré." disp_help