From 6f4ec2113ba7681d18e6d0c10c361841443f8cc6 Mon Sep 17 00:00:00 2001 From: levasseur Date: Mon, 21 Jun 2021 18:51:13 +0200 Subject: [PATCH] started basic documentation, help in main program --- README.md | 16 +++++++++++++++ README.md.backup | 16 +++++++++++++++ init.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ nom_module.sh | 0 4 files changed, 84 insertions(+) create mode 100644 README.md create mode 100644 README.md.backup create mode 100644 nom_module.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..1de3742 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# init.sh +**init.sh** is an automated configurator for system administrator. It's fully written using Bash scripting and aims to be platform independent. Nevertheless it's requirements turns it naturally to Linux systems. It have long been tested using Debian GNU/Linux, Devuan and different flavor of Ubuntu. + +## Getting started +You should consider reading the Beginners guide. If you need to create additional modules to meet your needs, consider reading the Developers guide. + +Please also consider that your needs might meet the needs of someone else, thus it would be a good idea to submit your module to init.sh source base. + +## Design +**init.sh** relies on three different elements to work: + +- the init.sh script, which provide a simple framework and libraries to do simple taks and embed system dependent functions to provide system independent function calls. +- modules that actually do the job on a system independant way through the use of the framework and consisting on very small and simple task. +- multilevel configuration files, being just Bash variables declaration. + +Additionally some module might be ran regularly so it could be integrated to a cron-like service. \ No newline at end of file diff --git a/README.md.backup b/README.md.backup new file mode 100644 index 0000000..1de3742 --- /dev/null +++ b/README.md.backup @@ -0,0 +1,16 @@ +# init.sh +**init.sh** is an automated configurator for system administrator. It's fully written using Bash scripting and aims to be platform independent. Nevertheless it's requirements turns it naturally to Linux systems. It have long been tested using Debian GNU/Linux, Devuan and different flavor of Ubuntu. + +## Getting started +You should consider reading the Beginners guide. If you need to create additional modules to meet your needs, consider reading the Developers guide. + +Please also consider that your needs might meet the needs of someone else, thus it would be a good idea to submit your module to init.sh source base. + +## Design +**init.sh** relies on three different elements to work: + +- the init.sh script, which provide a simple framework and libraries to do simple taks and embed system dependent functions to provide system independent function calls. +- modules that actually do the job on a system independant way through the use of the framework and consisting on very small and simple task. +- multilevel configuration files, being just Bash variables declaration. + +Additionally some module might be ran regularly so it could be integrated to a cron-like service. \ No newline at end of file diff --git a/init.sh b/init.sh index 56390c3..786c85a 100755 --- a/init.sh +++ b/init.sh @@ -65,10 +65,62 @@ else fi fi +# Affiche l'aide +disp_help() +{ + cat << EOF +Utilisation : init.sh [OPTION] [-m module1,...,moduleN] +Initialise une machine pour l'intégrer à un réseau. + +Option : + -m, --module= Lance les modules indiqués même s'il ne sont pas + dans les fichiers de configuration. + -c, --check-only Lance les procédure de vérification préexecution + sans rien modifier. + -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é. + -h, --help Affiche ce texte d'aide. + +Variable d'environnement : + LOGFILE Stocke le nom complet du fichier de log qui sera + utilisé. + +Fichiers de configuration : + Le fichier de configuration principal fournira les détails nécessaire + au déploiement de la nouvelle machine. Il doit se situer dans le + répertoire conf/ à coté du script init.sh. Si un fichier appelé + "hostname.sh" (ou hostname est le nom d'hote) existe il sera le fichier + de configuration principal. Dans le cas contraire, le nom générique + "init.conf.sh" sera recherché. En l'absence de fichier de configuration + ce script ne pourra pas fonctionner. + + Veuiller consulter les fichiers de configuration fournis en exemple + pour avoir un aperçu des paramêtres disponibles. +EOF +} + + # ====================== # ==== Main Program ==== # ====================== +# Processing command line options +for opt in $@; do + case $opt in + "-h"|"--help") + disp_help + exit 0 + ;; + *) + prnt E "Paramètre \'$opt\' non géré." + disp_help + exit 1 + ;; + esac +done + + upgrade_dist [[ ! $PVEHST ]] && install_ceph && conf_ceph [[ ! $PVEHST ]] && apt_blacklist diff --git a/nom_module.sh b/nom_module.sh new file mode 100644 index 0000000..e69de29