introduced distro version detection and automatic system dependent configuration loading

This commit is contained in:
levasseur
2021-09-29 17:29:39 +02:00
parent 148742008a
commit dc53b749f1
13 changed files with 155 additions and 10 deletions

13
init.sh
View File

@@ -44,6 +44,9 @@ export MYPATH=$(dirname $0)
# Get hostname
export HOSTNAME=$(hostname)
# System architecture
export SYS_ARCH=$(uname -m)
# Load libraries
for lib in $MYPATH/lib/*.sh; do
. $lib
@@ -65,6 +68,9 @@ function_exists prnt || (
exit 3
)
# Set system dependent vars
get_os_version $(read_os_release)
# ======================
# ==== Main Program ====
# ======================
@@ -102,9 +108,12 @@ exec > >(tee -a $LOGFILE)
exec 2> >(tee -a $LOGFILE >&2)
prnt I "Démarrage d'init version $VERSION."
prnt I "Le fichier de log est $LOGFILE."
prnt I "Lancé sur $SYS_DIST version $SYS_VER ($SYS_CODE) architecture $SYS_ARCH"
# -- Cannot be a function ends here
load_auto_conf
load_configuration
process_commandline_and_vars
@@ -127,7 +136,7 @@ done
if [[ $RUN_SHELL == true ]]; then
prnt I "Lancement d'un shell intéractif..."
bash -i --rcfile $MYPATH/bash.rc
bash --rcfile $MYPATH/bash.rc -i
prnt I "Sortie du script après exécution du shell."
exit 0
fi
@@ -185,3 +194,5 @@ fi
prnt I "That's all folks !"
rm -f $STAGEFILE
# EOF