introduced distro version detection and automatic system dependent configuration loading
This commit is contained in:
13
init.sh
13
init.sh
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user