finished main program, added no-root-check option
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user