begining work on the chroot option

This commit is contained in:
levasseur
2021-10-15 18:39:16 +02:00
parent 5fd16fbd69
commit 53c546fe20
3 changed files with 19 additions and 0 deletions

View File

@@ -157,6 +157,10 @@ isdirempty()
{
dir=$1
if [[ -f $dir ]]; then
prnt E "isdirempty():The given parameter is not a directory."
die 15
fi
if [[ ! -d $dir ]]; then
return 0
fi

View File

@@ -35,10 +35,13 @@ Options :
-R, --no-root-check Ne pas vérifier les droits root (ou UID 0)
-P, --no-proxy Ne pas utiliser de proxy lors de l'utilisation de
ce script (n'empêche pas leur configuration via modules)
-D, --no-deps Ne pas vérifier les dépendances entre les modules.
-h, --help Affiche ce texte d'aide.
-s, --shell Lance un shell avec tout l'environnement du script pour
débogage. Aucune action ou vérification n'est faite en
dehors des commandes lancées dans le shell.
--chroot <chemin> Permet à init de ne pas appliquer les modifications au
système de fichier racine mais à un système différent.
-l, --logfile <nom> Nom du fichier de log. Peut aussi être changé
via la variable d'environnement LOGFILE.
-v, --version Affiche la version de ce script et celles de

View File

@@ -24,6 +24,7 @@ read_commandline()
local want_module=false
local want_logfile=false
local want_conffile=false
local want_conffile=false
local opt=
for opt in $@; do
@@ -75,10 +76,14 @@ read_commandline()
"-s"|"--shell")
export RUN_SHELL=true
;;
"--chroot")
local want_chroot
;;
*)
if [[ $want_module == true ]]; then
[[ $want_logfile == true ]] && synthax_error
[[ $want_conffile == true ]] && synthax_error
[[ $want_chroot == true ]] && synthax_error
if [[ -z $MANUAL_MODULE_LIST ]]; then
export MANUAL_MODULE_LIST=$opt
want_module=false
@@ -90,6 +95,7 @@ read_commandline()
elif [[ $want_logfile == true ]]; then
[[ $want_module == true ]] && synthax_error
[[ $want_conffile == true ]] && synthax_error
[[ $want_chroot == true ]] && synthax_error
if [[ -z $NEW_LOGFILE ]]; then
export NEW_LOGFILE=$opt
want_logfile=false
@@ -100,8 +106,14 @@ read_commandline()
elif [[ $want_conffile == true ]]; then
[[ $want_module == true ]] && synthax_error
[[ $want_logfile == true ]] && synthax_error
[[ $want_chroot == true ]] && synthax_error
export CONFFILES="$CONFFILES $opt"
want_logfile=false
elif [[ $want_chroot == true ]]; then
[[ $want_module == true ]] && synthax_error
[[ $want_logfile == true ]] && synthax_error
[[ $want_conffile == true ]] && synthax_error
# To be finished
else
prnt E "Paramètre \"$opt\" non géré."
die 1 --force